lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <A6A3FBA3-4E1C-4E62-BBDC-308BDA8D9962@fb.com>
Date:   Sun, 25 Apr 2021 21:45:56 +0000
From:   Song Liu <songliubraving@...com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Song Liu <song@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Kernel Team <Kernel-team@...com>,
        "acme@...hat.com" <acme@...hat.com>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "jolsa@...nel.org" <jolsa@...nel.org>
Subject: Re: [PATCH v4 3/4] perf-stat: introduce config
 stat.bpf-counter-events



> On Apr 25, 2021, at 12:09 PM, Song Liu <songliubraving@...com> wrote:
> 
> 
> 
>> On Apr 25, 2021, at 8:16 AM, Jiri Olsa <jolsa@...hat.com> wrote:
>> 
>> On Sun, Apr 25, 2021 at 11:38:43AM -0300, Arnaldo Carvalho de Melo wrote:
>>> 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 <jolsa@...hat.com> 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?
>> 
>> there's still the matter of disable callback:
>> https://lore.kernel.org/lkml/YH8Pw4m0w6DuuEXo@krava/
>> 
>> it looks like now it could wrong value if we don't disable it
> 
> Sorry for the delay. I will add the disable part and send v5 soon. 

I just sent v5 with the disable() callback, and a minor fix in 3/5. I haven't
figured out the best fallback mechanism. Will work on that in the coming week. 

Thanks,
Song

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ