Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp2900459pxy; Sun, 25 Apr 2021 07:39:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWpIPp22j8PT/AkFuZgzxtjQ/qnyO7xR2J3xL587vCZ9wHwto5Dc9emkIm7qMNSRmNQzRF X-Received: by 2002:a62:bd13:0:b029:25c:5ec4:c2f3 with SMTP id a19-20020a62bd130000b029025c5ec4c2f3mr12993182pff.35.1619361574021; Sun, 25 Apr 2021 07:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619361574; cv=none; d=google.com; s=arc-20160816; b=uxwz5w5ihfWFk5NmQbRQbMUHeqGTgHaL0dj921k8p877MQ+YR0MmDp7+uzNc+0+Mmy 42Z25mbHttjd9LUtYS60zcDSI3pcTz73FeStFba0/Dcx3eQ0e7MDpg1XtA44PFTAmRWz ZF+5RqdPXsUKa/Hga8D5fEYnqr4w9Sj7r0K4t18wR65mttjEoLG1ZXw0bseBYF8+w88k Yg1XU4kw6D1b+l0y5+PV295vFCvw9t5vtG990m1sZewWiooZzSatzwJ8nzlrx9UrI3Nt ExELp98uub3TsJymoPblpyen97TvYtcC4BqcYrbPzkZttnQLCIq60ZHYh9rJSxGR0p1r CUqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=se528gViqCfXTqAcauFciFdjR5A1/UnDiNmTNRVZRqo=; b=iQKj2OWLUIEXzFS3EbHYsEIInr/raFkqpBWzpY8k+vYl6qhmzoy2VKgQSrfVZCKiph uh1TdqkxEKX5OEIIAPU89uPHS96E3TcJVX7/6JmdpJHoNiLCS9NeRUMSGNmTu18XYL2X rhGBXFPJuPUixhiRJcMbNSmCayQOPRK40D5DXztN0Y9CwueIBIdifNCS6IQf+5Fh/xRj +FLsDnKLxTn8NUdyuyae/zBZpfw3Ce+yXkzfdVaccYnZFWDyBE2Fu9BIqOjb8aP0sDTN Cs+lSUSl5bKu9qUQeefLlRwXA8rKo574fjE+cC2uWbcv4C7C62IkmlH1w4s8eHilI2np 3vrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dc+TWyJF; 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 a1si18082225pjo.167.2021.04.25.07.39.20; Sun, 25 Apr 2021 07:39:34 -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=k20201202 header.b=Dc+TWyJF; 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 S230288AbhDYOj0 (ORCPT + 99 others); Sun, 25 Apr 2021 10:39:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:42622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbhDYOjZ (ORCPT ); Sun, 25 Apr 2021 10:39:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 99DC461153; Sun, 25 Apr 2021 14:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619361525; bh=GMPOZDqHnLjKWBasZvrjvGDu00VMeOq3W3hlYB1Odcs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Dc+TWyJFIsjOImgKaw2/Kv4fm2wVeE86oyH7W/N0IxjsY7HB9QRBd7rYNxm7yIhcM Zb/wPZRfIUJNhV8+/gpCYc+UEtFpeFRP0h/oniE7C4/MjH0OTs28sJLrcMlRIfa7VZ C5YBN/ktG2DBYc+ZxAeuYySPB67aiqXfHgI5ijax9QvpV75yfPLkRLs8QYJD49gmBa lh7CPLbE/dazgpLW6aDncnGx8ZMjmdhH8zwCE+SuKY1/rLMMsw3/VulMFj31JCo3zy K9ByXmO07R+ui/j/XKlTyEEXharXQs+mcbYjgt2jZPv1TN6vXyUnNQTpaWq7ulACyE NTwGNZmsk/ttA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 3257240647; Sun, 25 Apr 2021 11:38:43 -0300 (-03) Date: Sun, 25 Apr 2021 11:38:43 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Song Liu , Song Liu , "linux-kernel@vger.kernel.org" , Kernel Team , "acme@redhat.com" , "namhyung@kernel.org" , "jolsa@kernel.org" Subject: Re: [PATCH v4 3/4] perf-stat: introduce config stat.bpf-counter-events Message-ID: References: <20210419203649.164121-1-song@kernel.org> <20210419203649.164121-4-song@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Apr 21, 2021 at 12:18:23PM +0200, Jiri Olsa escreveu: > On Tue, Apr 20, 2021 at 09:21:32PM +0000, Song Liu wrote: > > > > > > > On Apr 20, 2021, at 10:31 AM, Jiri Olsa wrote: > > > > > > On Mon, Apr 19, 2021 at 01:36:48PM -0700, Song Liu wrote: > > > > > > SNIP > > > > > >> if (stat_config.initial_delay < 0) { > > >> @@ -784,11 +790,11 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) > > >> if (affinity__setup(&affinity) < 0) > > >> return -1; > > >> > > >> - if (target__has_bpf(&target)) { > > >> - evlist__for_each_entry(evsel_list, counter) { > > >> - if (bpf_counter__load(counter, &target)) > > >> - return -1; > > >> - } > > >> + evlist__for_each_entry(evsel_list, counter) { > > >> + if (bpf_counter__load(counter, &target)) > > >> + return -1; > > >> + if (!evsel__is_bpf(counter)) > > >> + all_counters_use_bpf = false; > > > > > > could be done in bpf_counter__load, check below: > > > > > >> } > > >> > > >> evlist__for_each_cpu (evsel_list, i, cpu) { > > >> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c > > >> index 5de991ab46af9..33b1888103dfa 100644 > > >> --- a/tools/perf/util/bpf_counter.c > > >> +++ b/tools/perf/util/bpf_counter.c > > >> @@ -790,7 +790,8 @@ int bpf_counter__load(struct evsel *evsel, struct target *target) > > >> { > > >> if (target->bpf_str) > > >> evsel->bpf_counter_ops = &bpf_program_profiler_ops; > > >> - else if (target->use_bpf) > > >> + else if (target->use_bpf || > > >> + evsel__match_bpf_counter_events(evsel->name)) > > >> evsel->bpf_counter_ops = &bperf_ops; > > > > > > with: > > > else > > > all_counters_use_bpf = false; > > > > > > I was also thinking of oving it to evlist, but it's sat specific, > > > so I think it's good as static.. thanks for changing the implementation > > > > Hmm... then we need to somehow make all_counters_use_bpf visible in > > bpf_counter.c, which won't be very clean. Also, since this is stat > > specific, I guess it is better to keep it inside builtin-stat.c? > > The runtime overhead should be minimal. > > ah it's different file :) then it's better as it is, sorry Is this a Reviewed-by? - Arnaldo > jirka > > > > > Thanks, > > Song > > > -- - Arnaldo