Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2180903pxa; Fri, 7 Aug 2020 05:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjYWXRf6HHu0zIcBePP/UKZiv8sCDEX1Fw5YgzJV0GuPD3+ZGRe+njbzlVlwh5j23LRf22 X-Received: by 2002:aa7:df8a:: with SMTP id b10mr8287319edy.62.1596802698100; Fri, 07 Aug 2020 05:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596802698; cv=none; d=google.com; s=arc-20160816; b=dGaQ8Za1zok+cD9JvXaLN55NdWHCtE/z5sarISWVEYYLmbVyt7yHK1C+0/HmvT6E73 ULuRa155Z/SwBykilHmDjlRmAegSQaa+TAHhvA43QbSMz82rGABDNOg123QNTJbPxY20 /+95T20LOZJ0Yp7kjIkBVDyfr+7mOYkamlKW5+CtLWykXjuiWijKsMBBHZC7uZylDM7F ajvUwb3C/ELb9G9ea63ove3n0ZyDcbqDtODC4IEDTjEioVTlPP0XrwN6i23Qxtl6EkXq ieBtcdZGNO55tPhVQFxK1QGQDMH6J18VNqs5QrhI5MlaDmI9Bt9pwhgxToTOsbpSjqIB 9vdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ObJ7g+Vw7OXCA52l3m9Z9gsvDxegRuRdTRZTWvSolCg=; b=r4yjknPUmBZ1rnrGb4P6KGi2Bd8h5ZojHXxuy85iKMzyu0DPnJ6xWAhMEVQ3EWO5u/ NuPIpJtVpvklA5nOXKAIAr1HlnfQlzZXyZXQV5h9nbN3hAeTJAHTd1WwPfJjBQnMJLNy sjFRXB88QcB+amG5e+R3xOrryXqKF2H5SrnK2U3VTx9uS/h9STHSafIElT161t5OITHS OB8bAV/Wsta1p0eXLlg6npECLTv5ff4Zq2opXfx9d02PgXRpZinnrH9o/XkyNqL6SgCJ ByPTQ5IGoGZ53048ELswpfUztW4HyfzcZLrunSCx+PZMOYnyTH9w2NQtpEnGBPxxjjqk nkuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J9ojc9Xw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si5495535ejx.388.2020.08.07.05.17.54; Fri, 07 Aug 2020 05:18:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J9ojc9Xw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728320AbgHGMQe (ORCPT + 99 others); Fri, 7 Aug 2020 08:16:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:51528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbgHGMQc (ORCPT ); Fri, 7 Aug 2020 08:16:32 -0400 Received: from quaco.ghostprotocols.net (unknown [186.208.79.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BE8B221E2; Fri, 7 Aug 2020 12:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596802591; bh=VYEQ6WbWp7BWKAKdBuMp0fHupy9LP5Uskf1aDWDspJU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J9ojc9Xwc9LhaKgi/lis0C7R9NnWxLg2fxKOzZV+9nNhiEnMOQi+x/Vw4sMH0U2ub IgEpYdRWbCv8EDCwKd8040b40Bx2Z9XAZvctueFZkhecCuo615KVgtjBg8G+F1azrq tNyLEkUCnQ3yz4dHwNe/xyPpSEv5XE46IoaY+Uj8= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 2F53340481; Fri, 7 Aug 2020 09:16:29 -0300 (-03) Date: Fri, 7 Aug 2020 09:16:29 -0300 From: Arnaldo Carvalho de Melo To: Jin Yao Cc: Jiri Olsa , 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 Message-ID: <20200807121629.GC2456573@kernel.org> References: <20200805022937.29184-1-yao.jin@linux.intel.com> <20200806194357.GA539212@krava> <20200807120824.GA2456573@kernel.org> <20200807120956.GB2456573@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807120956.GB2456573@kernel.org> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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=, 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=) 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 > > > > 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 [] [] or: perf record [] -- [] --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) {