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>] [day] [month] [year] [list]
Message-Id: <20190418140437.16986-1-jolsa@kernel.org>
Date:   Thu, 18 Apr 2019 16:04:37 +0200
From:   Jiri Olsa <jolsa@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: [PATCH] perf trace: Fix events draining

The event handler has currently events->disable check,
that prevents processing in case we disable the event.

It was used to bypass event display when we reach the
configured maximum via --max-events or 'nr' term. But
it collides with draining, which disables events and
processes whatever left in the buffer.

  # cat ex.c
  int main(void)
  {
          return 0;
  }

  # perf probe -x  ./ex main
  Added new event:
    probe_ex:main        (on main in /home/jolsa/kernel/linux-perf/tools/perf/ex)

  You can now use it in all perf tools, such as:

          perf record -e probe_ex:main -aR sleep 1

Before:
  # perf trace -e probe_ex:main ./ex
  #

After:
  # perf trace -e probe_ex:main ./ex
     0.000 ex/16341 probe_ex:main:(401106)
  #

Checking on nr_events_printed value instead.

Fixes: a9c5e6c1e9bf ("perf trace: Introduce per-event maximum number of events property")
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
 tools/perf/builtin-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f5b3a1e9c1dd..729d3b82558b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2251,7 +2251,7 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel,
 	 * from the ring buffer that we should discard, since the max events
 	 * have already been considered/printed.
 	 */
-	if (evsel->disabled)
+	if (evsel->nr_events_printed == evsel->max_events)
 		return 0;
 
 	thread = machine__findnew_thread(trace->host, sample->pid, sample->tid);
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ