Message ID | 20230427234833.1576130-1-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp610105vqo; Thu, 27 Apr 2023 17:23:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lZ68cbOsN77LT9PyoacU3t27eyvJjQs+a93izXrnPMSeUbMlevbr9NNLnP5SpbXCLg17V X-Received: by 2002:a17:90a:3b41:b0:24b:3476:9867 with SMTP id t1-20020a17090a3b4100b0024b34769867mr3234609pjf.48.1682641391025; Thu, 27 Apr 2023 17:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682641391; cv=none; d=google.com; s=arc-20160816; b=tHIqUWCDAI6i0gNZlhdNo9Yulml8/KXEvW9pou1CRyiG68xZPZ+nDBTxW5fAzoaY7I 509TPpxM+HTUASktG7NesDcbrwe8Gfr/NtlgXtnS44ZnEAXD/wRz5rHdjH1LDvixjh7c X1nkdVekvWU3leSfanHtp74ut1NBsdYIBiOplkPdJJ0bXvyB+E8csPPPoVnSZdVO5yKO qaILIJbiM9gpO4/ErIfkCqBibAf9FKqZbRFYQ4msf35w461zZ8yuRlO5dU+1hoeVI2gJ wKGnQLLl9k+q7X5tLM4uEcJPj0QRN2ht+y1WbZYQ15VmNkGCWp/uti60VIi+q2U0vTIu IvQg== 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:sender:dkim-signature; bh=Hvu69ObOjDcoWXd9/X9TroW2MzYAQKs3/cK182eTWso=; b=PM9qpeAoiLTTU3STEIYk30eIP+vrABBDW1zyfUDO3WPosN+H4u6SeqsE5+40F4yB1x 8hd4AdtlWsTgooprnNI1uTELKa4ZTVHVFfKpfj/EyBb/dWaYqPyp9B7bFfE8EqTBYXCh jd0UDydDZKVeoHK27BSLX2bhrcI8mjHY9/X0krWLHMZ75vEbNYuL9zKnOlmN5bxsrXZU lK12ihieN4lLaZ6GEXHvCCCRX38aV+3VnPzmhwy4BQfj/iwvw5A394F4hbUqMd85h7fA sSjo1H0GoP2WMqj4LuQI7CSphrqpRH7V/3l5mJKF1tNYZfPsBfxktGHmc0TFf1qUvWTF mDyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g3HuvbQZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 94-20020a17090a0fe700b002479fe0bab6si21878372pjz.4.2023.04.27.17.22.58; Thu, 27 Apr 2023 17:23:11 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g3HuvbQZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344428AbjD0Xsr (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Thu, 27 Apr 2023 19:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344184AbjD0Xsi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 27 Apr 2023 19:48:38 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 151F91FF1; Thu, 27 Apr 2023 16:48:38 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-63b5465fb99so7558337b3a.1; Thu, 27 Apr 2023 16:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682639317; x=1685231317; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=Hvu69ObOjDcoWXd9/X9TroW2MzYAQKs3/cK182eTWso=; b=g3HuvbQZVP2pSxXHQq5VztWSAvsdyuZP5ZBaS5Wt/5ogAm1OprxA2RbaMZdQ+CTVcW k5JDl+Dcfesu1P3kGh5FBK2y8B/KyTo+TQeVUoZKNh6fsBgRa0V/HCWx0Qo0pekT4kAy VVS8BFIcUEDGhJ5XM3tg2YstfH50R6xRfWvkrj4icOIHKzHh4/9k53278/nOLXhrBQxc 5NZGCk9uww6uKK/Fh9uZSeIQfnX+jMZvOYecRE5EP076c4iWCNxaTqggLYfPGg8lRLZp 2izea5nCTvQyYiFHEHhluYXtX7V527ho5YDkQTeoHdoXhejgoCU7tp8ZBIIN59z7oRj0 f6zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682639317; x=1685231317; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Hvu69ObOjDcoWXd9/X9TroW2MzYAQKs3/cK182eTWso=; b=flxv8fm7QO/xWXFXzn/faJkUK0AmaqnqoKqN70XHLXct02hxg9Az00q8EEA5w+fjP6 KXbM7uHBLkqN5hC6uV6n9ZwIIgmNWEqtlwnNUozh4K4sme9CqPkXfb6bjVYu1p8YZzwJ wDMN50KgTqz7DrZvuL01BAZeY7hTudDSi6ply1QG9k6A0LihS7uMUqiWyNV+WA3WTVth Yi52Di9Cc1StjgUe2sJ5SX9WX1u3J8yncxqRQanSMwdTC6U1t+gta8zh3k12fANqJQOV bHCYynz77oKEzD68H86Aydx60fl1SQEHQfDi6dNEp/9hrLaT0ZPSDlgNXzrPFO5fIkUu hJ6w== X-Gm-Message-State: AC+VfDwnGLm+FHuiSx2m2TlVR6QVujjBnRNOxOkr2upDqYQG8hQNqnI5 Sg1W2nQ+EhC3IN7R9b9bI5s= X-Received: by 2002:a05:6a00:23c1:b0:63d:3d08:4792 with SMTP id g1-20020a056a0023c100b0063d3d084792mr5334327pfc.32.1682639316271; Thu, 27 Apr 2023 16:48:36 -0700 (PDT) Received: from moohyul.svl.corp.google.com ([2620:15c:2d4:203:55cd:594d:edb:e780]) by smtp.gmail.com with ESMTPSA id p5-20020a056a000b4500b0062a56e51fd7sm13769425pfo.188.2023.04.27.16.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 16:48:35 -0700 (PDT) Sender: Namhyung Kim <namhyung@gmail.com> From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org> Cc: Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>, LKML <linux-kernel@vger.kernel.org>, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Andrii Nakryiko <andrii@kernel.org>, Hao Luo <haoluo@google.com>, Song Liu <song@kernel.org> Subject: [PATCH 1/2] perf lock contention: Fix struct rq lock access Date: Thu, 27 Apr 2023 16:48:32 -0700 Message-ID: <20230427234833.1576130-1-namhyung@kernel.org> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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?1764377378897243976?= X-GMAIL-MSGID: =?utf-8?q?1764377378897243976?= |
Series |
[1/2] perf lock contention: Fix struct rq lock access
|
|
Commit Message
Namhyung Kim
April 27, 2023, 11:48 p.m. UTC
The BPF CO-RE's ignore suffix rule requires three underscores.
Otherwise it'd fail like below:
$ sudo perf lock contention -ab
libbpf: prog 'collect_lock_syms': BPF program load failed: Invalid argument
libbpf: prog 'collect_lock_syms': -- BEGIN PROG LOAD LOG --
reg type unsupported for arg#0 function collect_lock_syms#380
; int BPF_PROG(collect_lock_syms)
0: (b7) r6 = 0 ; R6_w=0
1: (b7) r7 = 0 ; R7_w=0
2: (b7) r9 = 1 ; R9_w=1
3: <invalid CO-RE relocation>
failed to resolve CO-RE relocation <byte_off> [381] struct rq__new.__lock (0:0 @ offset 0)
Fixes: 0c1228486bef ("perf lock contention: Support pre-5.14 kernels")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/bpf_skel/lock_contention.bpf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On Thu, Apr 27, 2023 at 4:48 PM Namhyung Kim <namhyung@kernel.org> wrote: > > The BPF CO-RE's ignore suffix rule requires three underscores. > Otherwise it'd fail like below: > > $ sudo perf lock contention -ab > libbpf: prog 'collect_lock_syms': BPF program load failed: Invalid argument > libbpf: prog 'collect_lock_syms': -- BEGIN PROG LOAD LOG -- > reg type unsupported for arg#0 function collect_lock_syms#380 > ; int BPF_PROG(collect_lock_syms) > 0: (b7) r6 = 0 ; R6_w=0 > 1: (b7) r7 = 0 ; R7_w=0 > 2: (b7) r9 = 1 ; R9_w=1 > 3: <invalid CO-RE relocation> > failed to resolve CO-RE relocation <byte_off> [381] struct rq__new.__lock (0:0 @ offset 0) > > Fixes: 0c1228486bef ("perf lock contention: Support pre-5.14 kernels") > Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Thanks, Ian > --- > tools/perf/util/bpf_skel/lock_contention.bpf.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c > index 8911e2a077d8..30c193078bdb 100644 > --- a/tools/perf/util/bpf_skel/lock_contention.bpf.c > +++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c > @@ -418,11 +418,11 @@ int contention_end(u64 *ctx) > > extern struct rq runqueues __ksym; > > -struct rq__old { > +struct rq___old { > raw_spinlock_t lock; > } __attribute__((preserve_access_index)); > > -struct rq__new { > +struct rq___new { > raw_spinlock_t __lock; > } __attribute__((preserve_access_index)); > > @@ -434,8 +434,8 @@ int BPF_PROG(collect_lock_syms) > > for (int i = 0; i < MAX_CPUS; i++) { > struct rq *rq = bpf_per_cpu_ptr(&runqueues, i); > - struct rq__new *rq_new = (void *)rq; > - struct rq__old *rq_old = (void *)rq; > + struct rq___new *rq_new = (void *)rq; > + struct rq___old *rq_old = (void *)rq; > > if (rq == NULL) > break; > -- > 2.40.1.495.gc816e09b53d-goog >
Em Thu, Apr 27, 2023 at 05:32:08PM -0700, Ian Rogers escreveu: > On Thu, Apr 27, 2023 at 4:48 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > The BPF CO-RE's ignore suffix rule requires three underscores. > > Otherwise it'd fail like below: > > > > $ sudo perf lock contention -ab > > libbpf: prog 'collect_lock_syms': BPF program load failed: Invalid argument > > libbpf: prog 'collect_lock_syms': -- BEGIN PROG LOAD LOG -- > > reg type unsupported for arg#0 function collect_lock_syms#380 > > ; int BPF_PROG(collect_lock_syms) > > 0: (b7) r6 = 0 ; R6_w=0 > > 1: (b7) r7 = 0 ; R7_w=0 > > 2: (b7) r9 = 1 ; R9_w=1 > > 3: <invalid CO-RE relocation> > > failed to resolve CO-RE relocation <byte_off> [381] struct rq__new.__lock (0:0 @ offset 0) > > > > Fixes: 0c1228486bef ("perf lock contention: Support pre-5.14 kernels") > > Signed-off-by: Namhyung Kim <namhyung@kernel.org> > > Acked-by: Ian Rogers <irogers@google.com> Thanks, applied the series. - Arnaldo > Thanks, > Ian > > > --- > > tools/perf/util/bpf_skel/lock_contention.bpf.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c > > index 8911e2a077d8..30c193078bdb 100644 > > --- a/tools/perf/util/bpf_skel/lock_contention.bpf.c > > +++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c > > @@ -418,11 +418,11 @@ int contention_end(u64 *ctx) > > > > extern struct rq runqueues __ksym; > > > > -struct rq__old { > > +struct rq___old { > > raw_spinlock_t lock; > > } __attribute__((preserve_access_index)); > > > > -struct rq__new { > > +struct rq___new { > > raw_spinlock_t __lock; > > } __attribute__((preserve_access_index)); > > > > @@ -434,8 +434,8 @@ int BPF_PROG(collect_lock_syms) > > > > for (int i = 0; i < MAX_CPUS; i++) { > > struct rq *rq = bpf_per_cpu_ptr(&runqueues, i); > > - struct rq__new *rq_new = (void *)rq; > > - struct rq__old *rq_old = (void *)rq; > > + struct rq___new *rq_new = (void *)rq; > > + struct rq___old *rq_old = (void *)rq; > > > > if (rq == NULL) > > break; > > -- > > 2.40.1.495.gc816e09b53d-goog > >
diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c index 8911e2a077d8..30c193078bdb 100644 --- a/tools/perf/util/bpf_skel/lock_contention.bpf.c +++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c @@ -418,11 +418,11 @@ int contention_end(u64 *ctx) extern struct rq runqueues __ksym; -struct rq__old { +struct rq___old { raw_spinlock_t lock; } __attribute__((preserve_access_index)); -struct rq__new { +struct rq___new { raw_spinlock_t __lock; } __attribute__((preserve_access_index)); @@ -434,8 +434,8 @@ int BPF_PROG(collect_lock_syms) for (int i = 0; i < MAX_CPUS; i++) { struct rq *rq = bpf_per_cpu_ptr(&runqueues, i); - struct rq__new *rq_new = (void *)rq; - struct rq__old *rq_old = (void *)rq; + struct rq___new *rq_new = (void *)rq; + struct rq___old *rq_old = (void *)rq; if (rq == NULL) break;