Message ID | 20221130165158.517385-1-james.clark@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1038044wrr; Wed, 30 Nov 2022 08:58:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf7iDrFXNPZcAybBR4MqJ0GqQJDyHheT9iPXkxyyM2sJ2SAFOb4tJg4pg9IUcEnJJ1a6dyUC X-Received: by 2002:a17:902:b608:b0:189:7a8b:537d with SMTP id b8-20020a170902b60800b001897a8b537dmr21118785pls.95.1669827523272; Wed, 30 Nov 2022 08:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669827523; cv=none; d=google.com; s=arc-20160816; b=E/7LuKsjyZeYIrRf8OCHNXbwEziRrF8rgcCPMu4MiNIZEs+OZzn80SciFLjIarRZUI RssEDI3cv7FgIw8pZV/ThwoHwtkfCVicJoBK7FHt294/Ib4gMrQCrlQ2roRAYYOjDkOt EPr25Oi8B0kg7qX2I+SXkx5D7fWmMQX0j1U6y7Mgh/9naWDUVYp4XI7QwQLkeD+GTUpL eqRoablHRw6yslRqiALCFvdMCWTCmnILqNF+nk6ljvRUo6IE3eMwqjjM2zU9CDqEZQry CiDXR1VxBr9ONHBgFUIMecCupbRy4/VgYsP71/J+gVhgZhs5kN43jsHovslzxmLrFcPk S8Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=NC8w0XnE+T04EKHfxFrNr4vjfOLJEOBKacXGqx1yz1M=; b=KCZQGXnrFfJnTeiSUM7F80XRd+YvgGOt7Sd12MHgR7K+nJWvUjcAr88owfw61ko2PG Fd0XLR/hrAQYFgBVnTKrJKdHj5dnLaHrcBYhjn19LRgtMeGNmXf7nJCTVoI1xyvq8KNk 2wokpYgITT34V0OLUhcrNeuFtm1zAnTpPNkJzERBW5zW9IjV3djGKsvSiTbIOZK+Wqxg LhvJVn1YlZunp/WdDRhgQ0zf7jNcRbZrq4Kzn/wYs034utvznums45eHDW/eJ1w9wbEq HSPL4uaGBB1CXW7QPydGWrerwrbJCpI97IELFgIDToFE5JRWz6qt7S3IUd3pTvCHkYBQ gwAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a656897000000b0046f5a213b6bsi1726131pgt.750.2022.11.30.08.58.28; Wed, 30 Nov 2022 08:58:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbiK3QwN (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Wed, 30 Nov 2022 11:52:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbiK3QwL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 30 Nov 2022 11:52:11 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0945B2654C; Wed, 30 Nov 2022 08:52:09 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06D15D6E; Wed, 30 Nov 2022 08:52:16 -0800 (PST) Received: from e126815.warwick.arm.com (e126815.arm.com [10.32.32.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A6A2F3F73B; Wed, 30 Nov 2022 08:52:07 -0800 (PST) From: James Clark <james.clark@arm.com> To: linux-perf-users@vger.kernel.org, acme@kernel.org, sandipan.das@amd.com, Anshuman.Khandual@arm.com Cc: linux-kernel@vger.kernel.org, James Clark <james.clark@arm.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org> Subject: [PATCH] perf: Fix interpretation of branch records Date: Wed, 30 Nov 2022 16:51:58 +0000 Message-Id: <20221130165158.517385-1-james.clark@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750941065212900500?= X-GMAIL-MSGID: =?utf-8?q?1750941065212900500?= |
Series |
perf: Fix interpretation of branch records
|
|
Commit Message
James Clark
Nov. 30, 2022, 4:51 p.m. UTC
Commit 93315e46b000 ("perf/core: Add speculation info to branch
entries") added a new field in between type and new_type. Perf has
its own copy of this struct so update it to match the kernel side.
This doesn't currently cause any issues because new_type is only used
by the Arm BRBE driver which isn't merged yet.
Fixes: 93315e46b000 ("perf/core: Add speculation info to branch entries")
Signed-off-by: James Clark <james.clark@arm.com>
---
tools/perf/util/branch.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Wed, Nov 30, 2022 at 8:52 AM James Clark <james.clark@arm.com> wrote: > > Commit 93315e46b000 ("perf/core: Add speculation info to branch > entries") added a new field in between type and new_type. Perf has > its own copy of this struct so update it to match the kernel side. > > This doesn't currently cause any issues because new_type is only used > by the Arm BRBE driver which isn't merged yet. > > Fixes: 93315e46b000 ("perf/core: Add speculation info to branch entries") > Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Thanks, Namhyung > --- > tools/perf/util/branch.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h > index d6017c9b1872..3ed792db1125 100644 > --- a/tools/perf/util/branch.h > +++ b/tools/perf/util/branch.h > @@ -22,9 +22,10 @@ struct branch_flags { > u64 abort:1; > u64 cycles:16; > u64 type:4; > + u64 spec:2; > u64 new_type:4; > u64 priv:3; > - u64 reserved:33; > + u64 reserved:31; > }; > }; > }; > -- > 2.25.1 >
On 11/30/22 22:21, James Clark wrote: > Commit 93315e46b000 ("perf/core: Add speculation info to branch > entries") added a new field in between type and new_type. Perf has > its own copy of this struct so update it to match the kernel side. > > This doesn't currently cause any issues because new_type is only used > by the Arm BRBE driver which isn't merged yet. > > Fixes: 93315e46b000 ("perf/core: Add speculation info to branch entries") > Signed-off-by: James Clark <james.clark@arm.com> Again, problem from having the same structure in two different places Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- > tools/perf/util/branch.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h > index d6017c9b1872..3ed792db1125 100644 > --- a/tools/perf/util/branch.h > +++ b/tools/perf/util/branch.h > @@ -22,9 +22,10 @@ struct branch_flags { > u64 abort:1; > u64 cycles:16; > u64 type:4; > + u64 spec:2; > u64 new_type:4; > u64 priv:3; > - u64 reserved:33; > + u64 reserved:31; > }; > }; > };
On 11/30/2022 10:21 PM, James Clark wrote: > Commit 93315e46b000 ("perf/core: Add speculation info to branch > entries") added a new field in between type and new_type. Perf has > its own copy of this struct so update it to match the kernel side. > > This doesn't currently cause any issues because new_type is only used > by the Arm BRBE driver which isn't merged yet. > > Fixes: 93315e46b000 ("perf/core: Add speculation info to branch entries") Technically, in the kernel sources, commit 93315e46b000 ("perf/core: Add speculation info to branch entries") landed before commit b190bc4ac9e6 ("perf: Extend branch type classification"). So I think the Fixes tag should instead have commit 0ddea8e2a0c2 ("perf branch: Extend branch type classification") which added the UAPI changes to the perf tool headers. Aside from that, the patch looks good to me. > Signed-off-by: James Clark <james.clark@arm.com> > --- > tools/perf/util/branch.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h > index d6017c9b1872..3ed792db1125 100644 > --- a/tools/perf/util/branch.h > +++ b/tools/perf/util/branch.h > @@ -22,9 +22,10 @@ struct branch_flags { > u64 abort:1; > u64 cycles:16; > u64 type:4; > + u64 spec:2; > u64 new_type:4; > u64 priv:3; > - u64 reserved:33; > + u64 reserved:31; > }; > }; > };
On 01/12/2022 09:02, Sandipan Das wrote: > On 11/30/2022 10:21 PM, James Clark wrote: >> Commit 93315e46b000 ("perf/core: Add speculation info to branch >> entries") added a new field in between type and new_type. Perf has >> its own copy of this struct so update it to match the kernel side. >> >> This doesn't currently cause any issues because new_type is only used >> by the Arm BRBE driver which isn't merged yet. >> >> Fixes: 93315e46b000 ("perf/core: Add speculation info to branch entries") > > Technically, in the kernel sources, commit 93315e46b000 ("perf/core: Add > speculation info to branch entries") landed before commit b190bc4ac9e6 > ("perf: Extend branch type classification"). > > So I think the Fixes tag should instead have commit 0ddea8e2a0c2 > ("perf branch: Extend branch type classification") which added the > UAPI changes to the perf tool headers. Yes maybe, or 831c05a7621b ("tools headers UAPI: Sync linux/perf_event.h with the kernel sources") where spec was added to the perf copy of the headers. It's hard to say for sure which one is best. I think that the earliest possible one is best in case anyone is debugging that kernel version with userspace Perf. And to me it seems any kernel that has the spec record should have it matching in userspace so I would still prefer 93315e46b000. Applying it on top of any other change would still lead to misleading interpretation of the records. > > Aside from that, the patch looks good to me. Thanks for the review. > >> Signed-off-by: James Clark <james.clark@arm.com> >> --- >> tools/perf/util/branch.h | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h >> index d6017c9b1872..3ed792db1125 100644 >> --- a/tools/perf/util/branch.h >> +++ b/tools/perf/util/branch.h >> @@ -22,9 +22,10 @@ struct branch_flags { >> u64 abort:1; >> u64 cycles:16; >> u64 type:4; >> + u64 spec:2; >> u64 new_type:4; >> u64 priv:3; >> - u64 reserved:33; >> + u64 reserved:31; >> }; >> }; >> }; > >
Em Thu, Dec 01, 2022 at 09:46:53AM +0530, Anshuman Khandual escreveu: > > > On 11/30/22 22:21, James Clark wrote: > > Commit 93315e46b000 ("perf/core: Add speculation info to branch > > entries") added a new field in between type and new_type. Perf has > > its own copy of this struct so update it to match the kernel side. > > > > This doesn't currently cause any issues because new_type is only used > > by the Arm BRBE driver which isn't merged yet. > > > > Fixes: 93315e46b000 ("perf/core: Add speculation info to branch entries") > > Signed-off-by: James Clark <james.clark@arm.com> > > Again, problem from having the same structure in two different places Indeed, this was my first reaction, how about backward compatibility, is this really an ABI? - Arnaldo > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> > > --- > > tools/perf/util/branch.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h > > index d6017c9b1872..3ed792db1125 100644 > > --- a/tools/perf/util/branch.h > > +++ b/tools/perf/util/branch.h > > @@ -22,9 +22,10 @@ struct branch_flags { > > u64 abort:1; > > u64 cycles:16; > > u64 type:4; > > + u64 spec:2; > > u64 new_type:4; > > u64 priv:3; > > - u64 reserved:33; > > + u64 reserved:31; > > }; > > }; > > };
diff --git a/tools/perf/util/branch.h b/tools/perf/util/branch.h index d6017c9b1872..3ed792db1125 100644 --- a/tools/perf/util/branch.h +++ b/tools/perf/util/branch.h @@ -22,9 +22,10 @@ struct branch_flags { u64 abort:1; u64 cycles:16; u64 type:4; + u64 spec:2; u64 new_type:4; u64 priv:3; - u64 reserved:33; + u64 reserved:31; }; }; };