linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
	jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH] perf record: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
Date: Fri, 7 Aug 2020 09:16:29 -0300	[thread overview]
Message-ID: <20200807121629.GC2456573@kernel.org> (raw)
In-Reply-To: <20200807120956.GB2456573@kernel.org>

Em Fri, Aug 07, 2020 at 09:09:56AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Aug 07, 2020 at 09:08:24AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Thu, Aug 06, 2020 at 09:43:57PM +0200, Jiri Olsa escreveu:
> > > On Wed, Aug 05, 2020 at 10:29:37AM +0800, Jin Yao wrote:
> > > > We received an error report that perf-record caused 'Segmentation fault'
> > > > on a newly system (e.g. on the new installed ubuntu).
> > > > 
> > > >  (gdb) backtrace
> > > >  #0  __read_once_size (size=4, res=<synthetic pointer>, p=0x14) at /root/0-jinyao/acme/tools/include/linux/compiler.h:139
> > > >  #1  atomic_read (v=0x14) at /root/0-jinyao/acme/tools/include/asm/../../arch/x86/include/asm/atomic.h:28
> > > >  #2  refcount_read (r=0x14) at /root/0-jinyao/acme/tools/include/linux/refcount.h:65
> > > >  #3  perf_mmap__read_init (map=map@entry=0x0) at mmap.c:177
> > > >  #4  0x0000561ce5c0de39 in perf_evlist__poll_thread (arg=0x561ce68584d0) at util/sideband_evlist.c:62
> > > >  #5  0x00007fad78491609 in start_thread (arg=<optimized out>) at pthread_create.c:477
> > > >  #6  0x00007fad7823c103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
> > > 
> > > hum, I recall discussing the same issue,
> > > I thought it was already fixed :-\ in any case:
> > > 
> > > Acked-by: Jiri Olsa <jolsa@redhat.com>
> > 
> > I added this:
> > 
> > Fixes: 23cbb41c939a ("perf record: Move side band evlist setup to separate routine")
> > 
> > To help this fixe go back to a few stable kernels. Technically the
> > problem was introduced much earlier, when the side band thread was
> > added, but then this would require more cherry-picking of patches and
> > since we have a workaround, i.e. build with libbpf, I think this is
> > enough.
> 
> I backtrack on that, as the sideband event is not just for BPF... The
> switch-output-event code uses it as well, so it can't be dependent on
> LIBBPF being built...
> 
> I'll see what I can do

So this is the change I made, the side band thread is may have been
already created by 

[acme@quaco ~]$ perf record -h switch-output-event

 Usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

        --switch-output-event <switch output event>
                          switch output event selector. use 'perf list' to list available events

[acme@quaco ~]$

I'm doing some extra checking now on your report, and the patch below
has skews because it clashed with the clockid patches by Jiri so I had
to resolve its merge.

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 7d97c8e9f7f9..c12b5b072519 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1511,6 +1511,7 @@ static int record__synthesize(struct record *rec, bool tail)
 	return err;
 }
 
+#ifdef HAVE_LIBBPF_SUPPORT
 static int record__process_signal_event(union perf_event *event __maybe_unused, void *data)
 {
 	struct record *rec = data;
@@ -1592,6 +1593,12 @@ static int record__init_clock(struct record *rec)
 	session->header.env.clock.clockid_ns = ref;
 	return 0;
 }
+#else
+static int record__setup_sb_evlist(struct record *rec __maybe_unused)
+{
+	return 0;
+}
+#endif
 
 static int __cmd_record(struct record *rec, int argc, const char **argv)
 {

  reply	other threads:[~2020-08-07 12:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05  2:29 [PATCH] perf record: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set Jin Yao
2020-08-06 19:43 ` Jiri Olsa
2020-08-07  6:26   ` Jin, Yao
2020-08-07 12:08   ` Arnaldo Carvalho de Melo
2020-08-07 12:09     ` Arnaldo Carvalho de Melo
2020-08-07 12:16       ` Arnaldo Carvalho de Melo [this message]
2020-08-07 12:28         ` Arnaldo Carvalho de Melo
2020-08-10  0:35           ` Jin, Yao

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=20200807121629.GC2456573@kernel.org \
    --to=acme@kernel.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.com \
    /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).