From patchwork Mon Apr 28 13:12:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 29243 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 82ECF202FE for ; Mon, 28 Apr 2014 13:12:29 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id at1sf8398038iec.6 for ; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=SEqj9IYRdM/bxo9q1ywOGuvyl6d4AuBv1WI7/Ybe4Z4=; b=ANY3C55PDtYl6qPpvC4SkJ2xxcKovs/diDtUHqsWv5t8af9U88l4/TjaiThpuILnmv VdZV1gtbjtLu+6yUZIzdaS4qstQzA9pkIJaeoEZORpkKKyVcaHqTm3E3DzQOKL3tlD3c gOlEWgfJHkyUkvWXg7VerpIYjI5SnEwdMhZG2PQgXdp4FzsBb+JB7qlKHIP4gxMoruQf 2wwnBOZuE8PEDdQw7DitBEHsiawIBCVNYaE6TD+rX9ebjUXZ+8V25v1vz6LFWAxvakDa lGfydWRFpPY99d0FowwyYG+SeGNucoyjGOk3o+4XB7Ae5XXMBPbLFm6WMKYXYDbG6zOk 4Pdw== X-Gm-Message-State: ALoCoQlBE0pv+XrdLnUvdlIGDz/2AmUhdkZ+QNZjrm2oBJ9OiifShbr9KJ2DsURuXydNp/CiZjCx X-Received: by 10.183.11.102 with SMTP id eh6mr12926647obd.37.1398690748945; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.248 with SMTP id i111ls2540425qge.7.gmail; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) X-Received: by 10.58.1.5 with SMTP id 5mr24159441vei.8.1398690748762; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id d9si3612500vca.26.2014.04.28.06.12.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:12:28 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lc6so7874268vcb.7 for ; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) X-Received: by 10.58.13.104 with SMTP id g8mr23542641vec.16.1398690748679; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp116396vcb; Mon, 28 Apr 2014 06:12:28 -0700 (PDT) X-Received: by 10.14.179.193 with SMTP id h41mr33052077eem.27.1398690747414; Mon, 28 Apr 2014 06:12:27 -0700 (PDT) Received: from mail-ee0-f52.google.com (mail-ee0-f52.google.com [74.125.83.52]) by mx.google.com with ESMTPS id w48si23061098een.224.2014.04.28.06.12.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:12:27 -0700 (PDT) Received-SPF: none (google.com: jean.pihet@linaro.org does not designate permitted sender hosts) client-ip=74.125.83.52; Received: by mail-ee0-f52.google.com with SMTP id e49so4748687eek.25 for ; Mon, 28 Apr 2014 06:12:26 -0700 (PDT) X-Received: by 10.14.211.133 with SMTP id w5mr32922301eeo.5.1398690746850; Mon, 28 Apr 2014 06:12:26 -0700 (PDT) Received: from localhost.localdomain ([109.139.146.108]) by mx.google.com with ESMTPSA id a42sm50299360ees.10.2014.04.28.06.12.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:12:26 -0700 (PDT) From: Jean Pihet To: Will Deacon Cc: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Ingo Molnar , Jiri Olsa , patches@linaro.org, Arnaldo Carvalho de Melo , Jean Pihet , Steve Capper , Corey Ashford , Frederic Weisbecker , Namhyung Kim , Paul Mackerras , Peter Zijlstra , Arnaldo Carvalho de Melo , David Ahern Subject: [PATCH 1/3] perf tests: Introduce perf_regs_load function on ARM64 Date: Mon, 28 Apr 2014 15:12:10 +0200 Message-Id: <1398690730-5454-1-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jean.pihet@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Introducing perf_regs_load function, which is going to be used for dwarf unwind test in following patches. It takes single argument as a pointer to the regs dump buffer and populates it with current registers values, as expected by the perf built-in unwinding test. Signed-off-by: Jean Pihet Cc: Steve Capper Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa --- tools/perf/arch/arm64/Makefile | 1 + tools/perf/arch/arm64/include/perf_regs.h | 2 ++ tools/perf/arch/arm64/tests/regs_load.S | 40 +++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 tools/perf/arch/arm64/tests/regs_load.S diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 67e9b3d..9b8f87e 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -4,4 +4,5 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif ifndef NO_LIBUNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o endif diff --git a/tools/perf/arch/arm64/include/perf_regs.h b/tools/perf/arch/arm64/include/perf_regs.h index 2359546..1e052f1 100644 --- a/tools/perf/arch/arm64/include/perf_regs.h +++ b/tools/perf/arch/arm64/include/perf_regs.h @@ -9,6 +9,8 @@ #define PERF_REG_IP PERF_REG_ARM64_PC #define PERF_REG_SP PERF_REG_ARM64_SP +void perf_regs_load(u64 *regs); + static inline const char *perf_reg_name(int id) { switch (id) { diff --git a/tools/perf/arch/arm64/tests/regs_load.S b/tools/perf/arch/arm64/tests/regs_load.S new file mode 100644 index 0000000..40b8b99 --- /dev/null +++ b/tools/perf/arch/arm64/tests/regs_load.S @@ -0,0 +1,40 @@ +#include + +/* + * Implementation of void perf_regs_load(u64 *regs); + * + * This functions fills in the 'regs' buffer from the actual registers values, + * in the way the perf built-in unwinding test expects them, e.g. an address + * within the caller: + * - the PC at the time at the call to this function. Since this function + * is called using a bl instruction, the PC value is taken from LR, + * - the current SP (not touched by this function), + * - the current value of LR is merely retrieved and stored because the + * value before the call to this function is unknown at this time; it will + * be unwound from the dwarf information in unwind__get_entries. + */ + +.text +.type perf_regs_load,%function +ENTRY(perf_regs_load) + stp x0, x1, [x0], #16 // store x0..x29 + stp x2, x3, [x0], #16 + stp x4, x5, [x0], #16 + stp x6, x7, [x0], #16 + stp x8, x9, [x0], #16 + stp x10, x11, [x0], #16 + stp x12, x13, [x0], #16 + stp x14, x15, [x0], #16 + stp x16, x17, [x0], #16 + stp x18, x19, [x0], #16 + stp x20, x21, [x0], #16 + stp x22, x23, [x0], #16 + stp x24, x25, [x0], #16 + stp x26, x27, [x0], #16 + stp x28, x29, [x0], #16 + mov x1, sp + stp x30, x1, [x0], #16 // store lr and sp + str x30, [x0] // store lr as the PC in order to skip the call + // to this function + ret +ENDPROC(perf_regs_load)