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]
Date:   Thu, 28 Apr 2022 16:50:07 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>, Ian Rogers <irogers@...gle.com>,
        Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
        Leo Yan <leo.yan@...aro.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC 02/21] libperf evsel: Add perf_evsel__enable_thread()

On Wed, Apr 27, 2022 at 9:15 PM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> On 28/04/22 00:48, Namhyung Kim wrote:
> > Hi Adrian,
> >
> > On Fri, Apr 22, 2022 at 9:24 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
> >>
> >> Add perf_evsel__enable_thread() as a counterpart to
> >> perf_evsel__enable_cpu(), to enable all events for a thread.
> >>
> >> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> >> ---
> >>  tools/lib/perf/evsel.c              | 10 ++++++++++
> >>  tools/lib/perf/include/perf/evsel.h |  1 +
> >>  2 files changed, 11 insertions(+)
> >>
> >> diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c
> >> index 20ae9f5f8b30..2a1f07f877be 100644
> >> --- a/tools/lib/perf/evsel.c
> >> +++ b/tools/lib/perf/evsel.c
> >> @@ -360,6 +360,16 @@ int perf_evsel__enable_cpu(struct perf_evsel *evsel, int cpu_map_idx)
> >>         return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, NULL, cpu_map_idx);
> >>  }
> >>
> >> +int perf_evsel__enable_thread(struct perf_evsel *evsel, int thread)
> >> +{
> >> +       int err = 0;
> >> +       int i;
> >> +
> >> +       for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++)
> >> +               err = perf_evsel__ioctl(evsel, PERF_EVENT_IOC_ENABLE, NULL, i, thread);
> >
> > You might want to break the loop when it fails.
>
> Thanks for looking at this.  It should break because of " && !err".

Oh, I missed that part, sorry!

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ