From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id DC3FC1A001D for ; Thu, 21 Jan 2016 20:57:50 +1100 (AEDT) Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Jan 2016 02:57:48 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 4EE253E40041 for ; Thu, 21 Jan 2016 02:57:43 -0700 (MST) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0L9vhgv23789740 for ; Thu, 21 Jan 2016 02:57:43 -0700 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0L9vgKW030034 for ; Thu, 21 Jan 2016 02:57:43 -0700 Subject: Re: [PATCH V10 2/4] perf/powerpc: add support for sampling intr machine state To: Michael Ellerman References: <1452508104-16507-1-git-send-email-anju@linux.vnet.ibm.com> <1452508104-16507-3-git-send-email-anju@linux.vnet.ibm.com> <1453286426.14751.19.camel@ellerman.id.au> Cc: khandual@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com, jolsa@redhat.com, dsahern@gmail.com, acme@redhat.com, sukadev@linux.vnet.ibm.com, hemant@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org From: Anju T Message-ID: <56A0AB91.6070104@linux.vnet.ibm.com> Date: Thu, 21 Jan 2016 15:27:37 +0530 MIME-Version: 1.0 In-Reply-To: <1453286426.14751.19.camel@ellerman.id.au> Content-Type: multipart/alternative; boundary="------------020204030007030200040404" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This is a multi-part message in MIME format. --------------020204030007030200040404 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi mpe, On Wednesday 20 January 2016 04:10 PM, Michael Ellerman wrote: > On Mon, 2016-01-11 at 15:58 +0530, Anju T wrote: >> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig >> index 9a7057e..c4ce60d 100644 >> --- a/arch/powerpc/Kconfig >> +++ b/arch/powerpc/Kconfig >> @@ -119,6 +119,7 @@ config PPC >> select GENERIC_ATOMIC64 if PPC32 >> select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE >> select HAVE_PERF_EVENTS >> + select HAVE_PERF_REGS >> select HAVE_REGS_AND_STACK_ACCESS_API >> select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64 >> select ARCH_WANT_IPC_PARSE_VERSION >> diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c >> new file mode 100644 >> index 0000000..d32581763 >> --- /dev/null >> +++ b/arch/powerpc/perf/perf_regs.c > ... >> + >> +u64 perf_reg_abi(struct task_struct *task) >> +{ >> + return PERF_SAMPLE_REGS_ABI_64; > What is this value used for exactly? > > It seems like on 32-bit kernels we should be returning PERF_SAMPLE_REGS_ABI_32. Values to determine ABI of the registers dump. enum perf_sample_regs_abi { PERF_SAMPLE_REGS_ABI_NONE = 0, PERF_SAMPLE_REGS_ABI_32 = 1, PERF_SAMPLE_REGS_ABI_64 = 2, }; Initially the ABI is set as NONE. So when we enable PERF_SAMPLE_REGS_INTR we need to get the correspodning ABI. This in turn required for .. void perf_output_sample(struct perf_output_handle *handle, if (sample_type & PERF_SAMPLE_TRANSACTION) perf_output_put(handle, data->txn); if (sample_type & PERF_SAMPLE_REGS_INTR) { u64 abi = data->regs_intr.abi; /* * If there are no regs to dump, notice it through * first u64 being zero (PERF_SAMPLE_REGS_ABI_NONE). */ perf_output_put(handle, abi); if (abi) { u64 mask = event->attr.sample_regs_intr; perf_output_sample_regs(handle, data->regs_intr.regs, mask); } } Here as you suggested we may need to pass the right ABI for 64 and 32 bit. Thanks and Regards Anju > >> +} >> + >> +void perf_get_regs_user(struct perf_regs *regs_user, >> + struct pt_regs *regs, >> + struct pt_regs *regs_user_copy) >> +{ >> + regs_user->regs = task_pt_regs(current); >> + regs_user->abi = perf_reg_abi(current); >> +} > cheers > --------------020204030007030200040404 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Hi mpe,
On Wednesday 20 January 2016 04:10 PM, Michael Ellerman wrote:
On Mon, 2016-01-11 at 15:58 +0530, Anju T wrote:
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9a7057e..c4ce60d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -119,6 +119,7 @@ config PPC
 	select GENERIC_ATOMIC64 if PPC32
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select HAVE_PERF_EVENTS
+	select HAVE_PERF_REGS
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
 	select ARCH_WANT_IPC_PARSE_VERSION
diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c
new file mode 100644
index 0000000..d32581763
--- /dev/null
+++ b/arch/powerpc/perf/perf_regs.c
...
+
+u64 perf_reg_abi(struct task_struct *task)
+{
+	return PERF_SAMPLE_REGS_ABI_64;
What is this value used for exactly?

It seems like on 32-bit kernels we should be returning PERF_SAMPLE_REGS_ABI_32.


Values to determine ABI of the registers dump.

enum perf_sample_regs_abi {

PERF_SAMPLE_REGS_ABI_NONE = 0,

PERF_SAMPLE_REGS_ABI_32 = 1,

PERF_SAMPLE_REGS_ABI_64 = 2,

};


Initially the ABI is set as NONE. So when we enable PERF_SAMPLE_REGS_INTR we need to get the correspodning ABI. This in turn required for ..

void perf_output_sample(struct perf_output_handle *handle,
        if (sample_type & PERF_SAMPLE_TRANSACTION)
                perf_output_put(handle, data->txn);
 
       if (sample_type & PERF_SAMPLE_REGS_INTR) {
               u64 abi = data->regs_intr.abi;
               /*
                * If there are no regs to dump, notice it through
                * first u64 being zero (PERF_SAMPLE_REGS_ABI_NONE).
                */
               perf_output_put(handle, abi);

               if (abi) {
                       u64 mask = event->attr.sample_regs_intr;

                       perf_output_sample_regs(handle,
                                               data->regs_intr.regs,
                                               mask);
               }
       }



Here as you suggested we may need to pass the right ABI for 64 and 32 bit.


Thanks and Regards

Anju





+}
+
+void perf_get_regs_user(struct perf_regs *regs_user,
+			struct pt_regs *regs,
+			struct pt_regs *regs_user_copy)
+{
+	regs_user->regs = task_pt_regs(current);
+	regs_user->abi  = perf_reg_abi(current);
+}
cheers


--------------020204030007030200040404--