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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0D527E3F-7390-4D54-8E6B-FCCD09BA8901@fb.com>
Date:   Tue, 29 Dec 2020 17:59:14 +0000
From:   Song Liu <songliubraving@...com>
To:     Namhyung Kim <namhyung@...nel.org>
CC:     linux-kernel <linux-kernel@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Mark Rutland <mark.rutland@....com>,
        Jiri Olsa <jolsa@...hat.com>,
        "Kernel Team" <Kernel-team@...com>
Subject: Re: [PATCH v6 3/4] perf-stat: enable counting events for BPF programs



> On Dec 29, 2020, at 9:46 AM, Song Liu <songliubraving@...com> wrote:
> 
>>> 

[...]

> 
> [...]
> 
>>> +static inline bool target__has_bpf(struct target *target)
>>> +{
>>> +       return target->bpf_str;
>>> +}
>>> +
>>> static inline bool target__none(struct target *target)
>>> {
>>>       return !target__has_task(target) && !target__has_cpu(target);
>> 
>> Shouldn't it have && !target__has_bpf() too?

Actually, we don't need target__has_bpf() here. As -b requires setting up counters
system wide (in setup_system_wide()). If we add target__has_bpf() here, we will
need something like below, which I think it not necessary. 

diff --git i/tools/perf/builtin-stat.c w/tools/perf/builtin-stat.c
index 09bffb3fbcdd4..853cec040191b 100644
--- i/tools/perf/builtin-stat.c
+++ w/tools/perf/builtin-stat.c
@@ -2081,7 +2081,7 @@ static void setup_system_wide(int forks)
         *   - there is workload specified but all requested
         *     events are system wide events
         */
-       if (!target__none(&target))
+       if (!target__none(&target) && !target__has_bpf(&target))
                return;

        if (!forks)
diff --git i/tools/perf/util/target.h w/tools/perf/util/target.h
index f132c6c2eef81..295fb11f4daff 100644
--- i/tools/perf/util/target.h
+++ w/tools/perf/util/target.h
@@ -71,7 +71,8 @@ static inline bool target__has_bpf(struct target *target)

 static inline bool target__none(struct target *target)
 {
-       return !target__has_task(target) && !target__has_cpu(target);
+       return !target__has_task(target) && !target__has_cpu(target) &&
+               !target__has_bpf(target);
 }

 static inline bool target__has_per_thread(struct target *target)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ