linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: perf probe: Trying to read a 'ctx' named local variable
Date: Thu, 20 Jul 2023 11:40:42 -0300	[thread overview]
Message-ID: <ZLlHagQuZGAhOk50@kernel.org> (raw)
In-Reply-To: <20230718085451.f6e099de7d34f2ae3dc4b7fe@kernel.org>

Em Tue, Jul 18, 2023 at 08:54:51AM +0900, Masami Hiramatsu escreveu:
> On Mon, 17 Jul 2023 15:06:10 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Hi Masami,
> > 
> > 	Trying to use perf to debug perf I stumbled on this:
> > 
> > [root@quaco ~]# perf probe -x ~/bin/perf -L sigtrap_handler
> > <sigtrap_handler@/home/acme/git/perf-tools/tools/perf/tests/sigtrap.c:0>
> >       0  sigtrap_handler(int signum __maybe_unused, siginfo_t *info, void *ucontext __maybe_unused)
> >          {
> >                 if (!__atomic_fetch_add(&ctx.signal_count, 1, __ATOMIC_RELAXED))
> >       3                 ctx.first_siginfo = *info;
> >       4         __atomic_fetch_sub(&ctx.tids_want_signal, syscall(SYS_gettid), __ATOMIC_RELAXED);
> >          }
> > 
> >          static void *test_thread(void *arg)
> > 
> > [root@quaco ~]# perf probe -x ~/bin/perf sigtrap_handler:4 "ctx.signal_count"
> > Failed to write event: Invalid argument
> > Please upgrade your kernel to at least 3.14 to have access to feature @ctx
> >   Error: Failed to add events.
> > [root@quaco ~]#
> 
> Ah, this is a wrong usage (I'm also trapped the same thing). Correctly, it should
> pass it as a single parameter.
> 
> perf probe -x ~/bin/perf "sigtrap_handler:4 ctx.signal_count"

[root@five ~]# perf probe -x ~/bin/perf "sigtrap_handler:4 ctx.signal_count"
Failed to write event: Invalid argument
Please upgrade your kernel to at least 3.14 to have access to feature @ctx
  Error: Failed to add events.
[root@five ~]#

Didn't work?

- Arnaldo
 
> This is for adding several events at the same time. But now it becomes just a trap.
> Can I change the syntax from
> 
> perf probe [OPTIONS] <PROBE-DEFINITION> [PROBE-DEFINITION...]
> 
> To,
> 
> perf probe [OPTIONS] <PROBE-POINT> [ARGS...]
> 
> ?
> 
> We can keep --add having optional parameter as below.
> 
> perf probe [OPTIONS] --add <PROBE-DEFINITION>
> 
> Thank you,
> 
> > 
> > [root@quaco ~]# uname -a
> > Linux quaco 6.3.8-100.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 15 01:51:54 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
> > [root@quaco ~]# rpm -qa | grep kernel-debuginfo
> > kernel-debuginfo-common-x86_64-6.3.8-100.fc37.x86_64
> > kernel-debuginfo-6.3.8-100.fc37.x86_64
> > [root@quaco ~]#
> > 
> > -- 
> > 
> > - Arnaldo
> 
> 
> -- 
> Masami Hiramatsu (Google) <mhiramat@kernel.org>

-- 

- Arnaldo

  reply	other threads:[~2023-07-20 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 18:06 perf probe: Trying to read a 'ctx' named local variable Arnaldo Carvalho de Melo
2023-07-17 23:54 ` Masami Hiramatsu
2023-07-20 14:40   ` Arnaldo Carvalho de Melo [this message]
2023-07-21  0:38     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLlHagQuZGAhOk50@kernel.org \
    --to=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).