linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: RAJESH DASARI <raajeshdasari@gmail.com>
To: linux-perf-users@vger.kernel.org
Subject: perf record is crashing on system with bpf progs are running
Date: Thu, 23 Feb 2023 10:02:11 +0200	[thread overview]
Message-ID: <CAPXMrf9hCmTKjUJJ_cymxqw696FdDvgV0xuDjwGeQTkoDpi=KQ@mail.gmail.com> (raw)

Hi ,

perf record is crashing on systems with bpf programs are running.

We are running on the 4.18 host kernel and we launch a container ,
inside the container we run perf record command, (bpf program is
running). Perf is built on top of the 5.4.228 kernel.

(gdb) bt
#0  0x000000000055becf in perf_event__synthesize_one_bpf_prog
(opts=0x94def8 <record+280>, event=0xabd910, fd=132, machine=0xaf6208,
process=0x421260 <process_synthesized_event>,
    session=0xaf6090) at util/bpf-event.c:242
#1  perf_event__synthesize_bpf_events (session=session@entry=0xaf6090,
process=process@entry=0x421260 <process_synthesized_event>,
machine=machine@entry=0xaf6208,
    opts=opts@entry=0x94def8 <record+280>) at util/bpf-event.c:333
#2  0x000000000041ff5c in record__synthesize (tail=tail@entry=false,
rec=0x94dde0 <record>) at builtin-record.c:1323
#3  0x0000000000422bc4 in __cmd_record (rec=0x94dde0 <record>,
argv=<optimized out>, argc=<optimized out>) at builtin-record.c:1465
#4  cmd_record (argc=<optimized out>, argv=<optimized out>) at
builtin-record.c:2474
#5  0x0000000000490769 in run_builtin (p=p@entry=0x9574b8
<commands+216>, argc=argc@entry=1, argv=argv@entry=0x7fffffffc120) at
perf.c:312
#6  0x000000000040c05a in handle_internal_command
(argv=0x7fffffffc120, argc=1) at perf.c:364
#7  run_argv (argv=<synthetic pointer>, argcp=<synthetic pointer>) at perf.c:408
#8  main (argc=1, argv=0x7fffffffc120) at perf.c:538

We tried running perf record --no-bpf-event but crash is still seen so
we added the below patch to skip processing bpf events when
no-bpf-event options is provided , but not sure if this is the actual
solution, please provide your inputs.

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 454e275..78e96ad 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1320,11 +1320,12 @@ static int record__synthesize(struct record
*rec, bool tail)
                return err;
        }

-       err = perf_event__synthesize_bpf_events(session,
process_synthesized_event,
-                                               machine, opts);
-       if (err < 0)
-               pr_warning("Couldn't synthesize bpf events.\n");
-
+        if (!opts->no_bpf_event) {
+                err = perf_event__synthesize_bpf_events(session,
process_synthesized_event,
+                                                       machine, opts);
+               if (err < 0)
+                       pr_warning("Couldn't synthesize bpf events.\n");
+        }


Thanks,
Rajesh Dasari.

             reply	other threads:[~2023-02-23  8:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23  8:02 RAJESH DASARI [this message]
2023-02-24  3:45 ` perf record is crashing on system with bpf progs are running Ian Rogers
2023-03-06 15:25   ` RAJESH DASARI
2023-03-06 17:33     ` Ian Rogers

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='CAPXMrf9hCmTKjUJJ_cymxqw696FdDvgV0xuDjwGeQTkoDpi=KQ@mail.gmail.com' \
    --to=raajeshdasari@gmail.com \
    --cc=linux-perf-users@vger.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).