From patchwork Wed Mar 19 09:42:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 26546 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D3C2203C3 for ; Wed, 19 Mar 2014 09:42:55 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf31113656obc.1 for ; Wed, 19 Mar 2014 02:42:54 -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=Wx8jer2HMVxn9lSaJxY0YMY6k/XkvRHrHsgyJI2aVOY=; b=XKzkJMvxBX2Gtau1Ek7uSSmz+M2IrDZ5sVHXdYUqd74uAN9yWPY4y5yy2viWz7IxdK gXAyoupLGJeH6Zs7KMjW846L5868Hb2uLRc2P3D6+FCQ2TwB6VfH6OHVVVTu5b9QjSIK JmfZzkz8r+WDnI8faRh3az6fgZ4Ef5J/lMbkEr6FNn4TyPo9Bxi5TRvhoVdh2Lwg9Hzu GZUFihXXUO13qFG6Bns9OvIvjCQCvtv5amdqbxwvpKSEt64ZwzvdIk1v+REukp+J/Mkh EPxswYKwpdjJeu68DA2wGYOur1YUhO1ANp3xfXJHJ8TLuxsrOcpBIqpjjnkafjdC23wo AXKg== X-Gm-Message-State: ALoCoQkGcgHguO24SnX/muHlqyOqU1bO+RrlwZG3AhA2QBSX8ug2i30FASlpXzCTNdwjWYx8K17a X-Received: by 10.182.55.102 with SMTP id r6mr598662obp.7.1395222174745; Wed, 19 Mar 2014 02:42:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.20 with SMTP id b20ls2382572qga.5.gmail; Wed, 19 Mar 2014 02:42:54 -0700 (PDT) X-Received: by 10.52.65.132 with SMTP id x4mr75360vds.36.1395222174605; Wed, 19 Mar 2014 02:42:54 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id w1si4309845vet.173.2014.03.19.02.42.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Mar 2014 02:42:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so8412945veb.24 for ; Wed, 19 Mar 2014 02:42:54 -0700 (PDT) X-Received: by 10.220.92.135 with SMTP id r7mr29357060vcm.11.1395222174511; Wed, 19 Mar 2014 02:42:54 -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.78.9 with SMTP id i9csp284475vck; Wed, 19 Mar 2014 02:42:53 -0700 (PDT) X-Received: by 10.15.73.134 with SMTP id h6mr16930613eey.3.1395222173240; Wed, 19 Mar 2014 02:42:53 -0700 (PDT) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx.google.com with ESMTPS id g45si26066142eev.130.2014.03.19.02.42.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Mar 2014 02:42:53 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=74.125.83.49; Received: by mail-ee0-f49.google.com with SMTP id c41so6290424eek.22 for ; Wed, 19 Mar 2014 02:42:52 -0700 (PDT) X-Received: by 10.14.182.131 with SMTP id o3mr19495292eem.67.1395222172583; Wed, 19 Mar 2014 02:42:52 -0700 (PDT) Received: from localhost.localdomain (90.102-241-81.adsl-dyn.isp.belgacom.be. [81.241.102.90]) by mx.google.com with ESMTPSA id n5sm3004316eex.14.2014.03.19.02.42.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Mar 2014 02:42:51 -0700 (PDT) From: Jean Pihet To: "linux-kernel@vger.kernel.org" , "linaro-kernel@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , Arnaldo , Ingo Molnar , Jiri Olsa , Steve Capper , Mark Rutland Cc: patches@linaro.org, Jean Pihet , Corey Ashford , Frederic Weisbecker , Namhyung Kim , Paul Mackerras , Peter Zijlstra , David Ahern Subject: [PATCH 1/3] perf tests: Introduce perf_regs_load function on ARM64 Date: Wed, 19 Mar 2014 10:42:33 +0100 Message-Id: <1395222155-22205-2-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1395222155-22205-1-git-send-email-jean.pihet@linaro.org> References: <1395222155-22205-1-git-send-email-jean.pihet@linaro.org> 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: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 | 39 +++++++++++++++++++++++++++++++ 3 files changed, 42 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..92ab968 --- /dev/null +++ b/tools/perf/arch/arm64/tests/regs_load.S @@ -0,0 +1,39 @@ +#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: + * - 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 pc as lr in order to skip the call + // to this function + ret +ENDPROC(perf_regs_load)