Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp564228ybz; Fri, 1 May 2020 04:30:00 -0700 (PDT) X-Google-Smtp-Source: APiQypJ2DumvpJqx+bqHgpKQnwpfwtxYqm/6VSkMnGex3lqA88mlMIuFvxgJEQQe9etmACmMJCVU X-Received: by 2002:a50:a2e5:: with SMTP id 92mr3154108edm.139.1588332600222; Fri, 01 May 2020 04:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588332600; cv=none; d=google.com; s=arc-20160816; b=I2iB5dZQ/mf48nsGt215XzkO6KvScUWlUhqbxO6b2hqvkOcuGRNA0036iTeDBCECbV E1QVP4TZiIvRyV9RexaPL+grJZCvfl0TUTcgkBdO/5+JA/SoZt//3Ih/FqzSKdXJG3wP Y8rCq/f3kg+hVO6Wa/Sh2+lqwpSxMlSAUR7oyvjw4EhRQaVkHlyZqWLbR73DW5IEO9VG bXGhio4Jg5K29uGoGnYG6xrKbyhaPuXEW1m8zNHxWr+KGHhLL/Pnoler3+zInsKbg2oi CDeJWLgW9fZzs7lC+C0S7hIbyLJIzA31lmuI9Ovm6FXcB84GccRGH8M3074gZ9nPGIcI y0dA== 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=l3RHNYGjb1a5HNCgNnXjPkumXM1n3FPkYqlluDFBk0o=; b=P+t+CLkzDKr+I3gFzf2ZsZkEFh9k6WcGiB46fZyuQWDtPD/b0xj3C3i2Y2mYt2xS9T ayTA/OV4lcfj2EaySUUKfZXT1TPuahzo3a2hBIapQHvHsusk0+N9mR8YYLFLvsaM8koj GrYZBM8pk9qsTPSB9AQV3Neo2mwYANZ48tIfxn3O+4eWin1u9EOh3/xiRBfDX1zGBnbl 6nOwAjCHiPhMWK0w2J4adlioKB8GmpXBXHxPP748RkMDZJ9K5VxAwp28xFPr+7ympsh3 cAn0RBH1A1FqgCK046NReeqMbTPJQmnvp6RO46B3QPoI+NRDG2GxT9QWNT3OZoNgfNRL eepw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YeT1YTWc; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rl12si1539257ejb.199.2020.05.01.04.29.36; Fri, 01 May 2020 04:30:00 -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=@redhat.com header.s=mimecast20190719 header.b=YeT1YTWc; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728687AbgEAL0H (ORCPT + 99 others); Fri, 1 May 2020 07:26:07 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34705 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728588AbgEAL0H (ORCPT ); Fri, 1 May 2020 07:26:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588332365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l3RHNYGjb1a5HNCgNnXjPkumXM1n3FPkYqlluDFBk0o=; b=YeT1YTWcp08YIDfx1y5AowVGOyyAbEW+iaQQrD7cs8/tw7AMIsO+aTrLcOd/jyY8wzyqVs Sk69q6s6yNqnJ7fXKk8wEUWzOTTCvEdP07/Gcfn+qrGrKDAzEc3RqJ23aVEXuZ4eTJw9cj zUa3uEpzCPYTbrrjGB4DZsrUoxKKZZQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-143-WZ8oG6IAPiO3enbg9DlwwA-1; Fri, 01 May 2020 07:25:59 -0400 X-MC-Unique: WZ8oG6IAPiO3enbg9DlwwA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AFA6107B7C3; Fri, 1 May 2020 11:25:57 +0000 (UTC) Received: from krava (unknown [10.40.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF3DC5C1B0; Fri, 1 May 2020 11:25:54 +0000 (UTC) Date: Fri, 1 May 2020 13:25:52 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ingo Molnar , Thomas Gleixner , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , Song Liu Subject: Re: [PATCH 5/8] perf evlist: Allow reusing the side band thread for more purposes Message-ID: <20200501112552.GC1789042@krava> References: <20200429131106.27974-1-acme@kernel.org> <20200429131106.27974-6-acme@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200429131106.27974-6-acme@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 10:11:03AM -0300, Arnaldo Carvalho de Melo wrote: > From: Arnaldo Carvalho de Melo > > I.e. so far we had just one event in that side band thread, a dummy one > with attr.bpf_event set, so that 'perf record' can go ahead and ask the > kernel for further information about BPF programs being loaded. > > Allow for more than one event to be there, so that we can use it as > well for the upcoming --switch-output-event feature. > > Cc: Adrian Hunter > Cc: Jiri Olsa > Cc: Namhyung Kim > Cc: Song Liu > Link: http://lore.kernel.org/lkml/20200427211935.25789-7-acme@kernel.org > Signed-off-by: Arnaldo Carvalho de Melo > --- > tools/perf/util/evlist.c | 22 ++++++++++++++++++++++ > tools/perf/util/evlist.h | 1 + > 2 files changed, 23 insertions(+) > > diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c > index 1d0d36da223b..849058766757 100644 > --- a/tools/perf/util/evlist.c > +++ b/tools/perf/util/evlist.c > @@ -1777,6 +1777,19 @@ static void *perf_evlist__poll_thread(void *arg) > return NULL; > } > > +void evlist__set_cb(struct evlist *evlist, perf_evsel__sb_cb_t cb, void *data) > +{ > + struct evsel *evsel; > + > + evlist__for_each_entry(evlist, evsel) { > + evsel->core.attr.sample_id_all = 1; > + evsel->core.attr.watermark = 1; > + evsel->core.attr.wakeup_watermark = 1; > + evsel->side_band.cb = cb; > + evsel->side_band.data = data; > + } > +} > + > int perf_evlist__start_sb_thread(struct evlist *evlist, > struct target *target) > { > @@ -1788,6 +1801,15 @@ int perf_evlist__start_sb_thread(struct evlist *evlist, > if (perf_evlist__create_maps(evlist, target)) > goto out_delete_evlist; > > + if (evlist->core.nr_entries > 1) { > + bool can_sample_identifier = perf_can_sample_identifier(); I just found this breaks python, because perf_can_sample_identifier is defined in util/record.c 19: 'import perf' in python : --- start --- test child forked, pid 1808205 Traceback (most recent call last): File "", line 1, in ImportError: python/perf.so: undefined symbol: perf_can_sample_identifier test child finished with -1 ---- end ---- 'import perf' in python: FAILED! jirka