From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,MIME_HTML_ONLY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 983EDC433DB for ; Fri, 26 Mar 2021 20:47:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F46861A18 for ; Fri, 26 Mar 2021 20:47:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F46861A18 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4F6Yvc1q0Xz3c15 for ; Sat, 27 Mar 2021 07:47:56 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=k379yqok; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=atrajeev@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=k379yqok; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4F6Qlf5Ml7z2yxl for ; Sat, 27 Mar 2021 02:25:33 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12QF4kbc054118; Fri, 26 Mar 2021 11:25:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : mime-version : content-type : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=pp1; bh=Gm+ijsFl4p3uMAan0H33QCN2mxd9l3KpwnR/Z1F/jPQ=; b=k379yqokN8kyo9DBcT91evKesqHGR1Tuwdkcj1Kn4BrYSsUe8+tpmq5lX9bwT0Z2KeSM EZXHH8PBs8MoQaYuAz4WXRSuba+NyMlPUrlFawDae4LkJmgbUFL9qlu0Kq1+LHuULvnW yKZoBfrtHSVLo07wVP2u+ABUMnZGRjCXU8vvUOKNrteUE8aSt1sSwnbIXfN6rc+RpUkA uPPjFBCByjOkIdBPDlN3B748dPMu2XMy5lHy5DpCajrZ/lemL4QggoGEt43b0l/H+6XK jziQgZqRruAJrvKsu4nnDjlu2WCpRVeFTAvDHkzWyRbKrInEbFgcO3SLAM5n1rMGJqFX Aw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37hhghshnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Mar 2021 11:25:12 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12QF4tDN054939; Fri, 26 Mar 2021 11:25:12 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 37hhghshmv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Mar 2021 11:25:12 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12QF7vJN008216; Fri, 26 Mar 2021 15:25:10 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma01fra.de.ibm.com with ESMTP id 37h1518dex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Mar 2021 15:25:10 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12QFOmeJ19399124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Mar 2021 15:24:48 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FBBD11C064; Fri, 26 Mar 2021 15:25:07 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E45C11C050; Fri, 26 Mar 2021 15:24:43 +0000 (GMT) Received: from [9.124.223.127] (unknown [9.124.223.127]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 26 Mar 2021 15:24:41 +0000 (GMT) Subject: Re: [PATCH V2 3/5] tools/perf: Add powerpc support for PERF_SAMPLE_WEIGHT_STRUCT Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: text/html; charset=us-ascii X-Apple-Auto-Saved: 1 X-Apple-Mail-Plain-Text-Draft: yes From: Athira Rajeev X-Apple-Mail-Remote-Attachments: YES X-Apple-Base-Url: x-msg://2/ In-Reply-To: X-Apple-Windows-Friendly: 1 Date: Fri, 26 Mar 2021 20:53:04 +0530 X-Apple-Mail-Signature: SKIP_SIGNATURE Content-Transfer-Encoding: quoted-printable Message-Id: <80EE46ED-9007-4CB7-9A52-A7A2ADC616C6@linux.vnet.ibm.com> References: <1616425047-1666-1-git-send-email-atrajeev@linux.vnet.ibm.com> <1616425047-1666-4-git-send-email-atrajeev@linux.vnet.ibm.com> X-Uniform-Type-Identifier: com.apple.mail-draft To: Jiri Olsa X-Mailer: Apple Mail (2.3608.120.23.2.4) X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: kF_aDhmMcV66rL06HTmTXBSzna55EN-c X-Proofpoint-GUID: hsb2U2DAWpG6y9BKGotENgADXLOkjyHj X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-26_06:2021-03-26, 2021-03-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 phishscore=0 mlxscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260115 X-Mailman-Approved-At: Sat, 27 Mar 2021 07:47:30 +1100 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ravi.bangoria@linux.ibm.com, Madhavan Srinivasan , peterz@infradead.org, linux-kernel@vger.kernel.org, acme@kernel.org, linux-perf-users@vger.kernel.org, jolsa@kernel.org, kjain@linux.ibm.com, linuxppc-dev , kan.liang@linux.intel.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev"


On = 25-Mar-2021, at 1:13 AM, Jiri Olsa <jolsa@redhat.com> = wrote:

On Mon, Mar 22, 2021 at 10:57:25AM -0400, Athira Rajeev = wrote:
Add arch specific = arch_evsel__set_sample_weight() to set the new
sample type for = powerpc.

Add arch specific arch_perf_parse_sample_weight() to = store the
sample->weight values depending on the sample type = applied.
if the new sample type (PERF_SAMPLE_WEIGHT_STRUCT) is = applied,
store only the lower 32 bits to sample->weight. If sample = type
is 'PERF_SAMPLE_WEIGHT', store the full 64-bit to = sample->weight.

Signed-off-by: Athira Rajeev = <atrajeev@linux.vnet.ibm.com>
---
tools/perf/arch/powerpc/util= /Build   |  2 ++
tools/perf/arch/powerpc/util/event.c = | 32 = ++++++++++++++++++++++++++++++++
tools/perf/arch/powerpc/util/evsel.c = |  8 ++++++++
3 files changed, 42 insertions(+)
create mode = 100644 tools/perf/arch/powerpc/util/event.c
create mode 100644 = tools/perf/arch/powerpc/util/evsel.c

diff --git = a/tools/perf/arch/powerpc/util/Build = b/tools/perf/arch/powerpc/util/Build
index b7945e5a543b..8a79c4126e5b = 100644
--- a/tools/perf/arch/powerpc/util/Build
+++ = b/tools/perf/arch/powerpc/util/Build
@@ -4,6 +4,8 @@ perf-y +=3D = kvm-stat.o
perf-y +=3D perf_regs.o
perf-y +=3D = mem-events.o
perf-y +=3D sym-handling.o
+perf-y +=3D = evsel.o
+perf-y +=3D event.o

perf-$(CONFIG_DWARF) +=3D = dwarf-regs.o
perf-$(CONFIG_DWARF) +=3D skip-callchain-idx.o
diff = --git a/tools/perf/arch/powerpc/util/event.c = b/tools/perf/arch/powerpc/util/event.c
new file mode 100644
index = 000000000000..f49d32c2c8ae
--- /dev/null
+++ = b/tools/perf/arch/powerpc/util/event.c
@@ -0,0 +1,32 @@
+// = SPDX-License-Identifier: GPL-2.0
+#include = <linux/types.h>
+#include <linux/string.h>
+#include = <linux/zalloc.h>
+
+#include = "../../../util/event.h"
+#include = "../../../util/synthetic-events.h"
+#include = "../../../util/machine.h"
+#include = "../../../util/tool.h"
+#include "../../../util/map.h"
+#include = "../../../util/debug.h"

nit, just #include = "utils/...h" should work no?

other than that, the patchset looks = ok to me

Acked-by: Jiri Olsa = <jolsa@redhat.com>


Hi Jiri, = Arnaldo

Thanks for reviewing the patch set.
I checked that, = just using "utils/...h" also works.
Below is the change which I = verified. Since the patches are presently merged in =
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=3D= tmp.perf/core,
can you please suggest how can we go about this = change ?

diff --git a/tools/perf/arch/powerpc/util/event.c = b/tools/perf/arch/powerpc/util/event.c
index = 3bf441257466..c479d0a0e696 100644
--- = a/tools/perf/arch/powerpc/util/event.c
+++ = b/tools/perf/arch/powerpc/util/event.c
@@ -3,12 +3,12 @@
#include = <linux/string.h>
#include = <linux/zalloc.h>

-#include = "../../../util/event.h"
-#include = "../../../util/synthetic-events.h"
-#include = "../../../util/machine.h"
-#include = "../../../util/tool.h"
-#include "../../../util/map.h"
-#include = "../../../util/debug.h"
+#include "util/event.h"
+#include = "util/synthetic-events.h"
+#include "util/machine.h"
+#include = "util/tool.h"
+#include "util/map.h"
+#include = "util/debug.h"

void arch_perf_parse_sample_weight(struct = perf_sample *data,
  const __u64 *array, = u64 type)


Thanks
Athira


thanks,
jirka

+
+void arch_perf_parse_sample_weight(struct = perf_sample *data,
+   const __u64 *array, = u64 type)
+{
+ union perf_sample_weight = weight;
+
+= weight.full =3D *array;
+ if (type & = PERF_SAMPLE_WEIGHT)
+ data->weight =3D = weight.full;
+= else
+ data->weight =3D = weight.var1_dw;
+}
+
+void = arch_perf_synthesize_sample_weight(const struct perf_sample = *data,
+ = = = = = __u64 *array, u64 type)
+{
+ *array =3D = data->weight;
+
+ if (type & = PERF_SAMPLE_WEIGHT_STRUCT)
+ *array &=3D = 0xffffffff;
+}
diff --git a/tools/perf/arch/powerpc/util/evsel.c = b/tools/perf/arch/powerpc/util/evsel.c
new file mode 100644
index = 000000000000..2f733cdc8dbb
--- /dev/null
+++ = b/tools/perf/arch/powerpc/util/evsel.c
@@ -0,0 +1,8 @@
+// = SPDX-License-Identifier: GPL-2.0
+#include = <stdio.h>
+#include "util/evsel.h"
+
+void = arch_evsel__set_sample_weight(struct evsel *evsel)
+{
+ = evsel__set_sample_bit(evsel, WEIGHT_STRUCT);
+}
-- =
1.8.3.1

=