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:	Tue, 21 Jul 2015 12:29:55 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Adrian Hunter <adrian.hunter@...el.com>
Cc:	Andi Kleen <ak@...ux.intel.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	Jiri Olsa <jolsa@...hat.com>,
	Stephane Eranian <eranian@...gle.com>,
	mathieu.poirier@...aro.org, Pawel Moll <pawel.moll@....com>
Subject: Re: [PATCH V4 1/5] perf: Add PERF_RECORD_SWITCH to indicate context
 switches

On Tue, Jul 21, 2015 at 12:44:02PM +0300, Adrian Hunter wrote:
> There are already two events for context switches, namely
> the tracepoint sched:sched_switch and the software event
> context_switches. Unfortunately neither are suitable for
> use by non-privileged users for the purpose of synchronizing
> hardware trace data (e.g. Intel PT) to the context switch.
> 
> Tracepoints are no good at all for non-privileged users
> because they need either CAP_SYS_ADMIN or
> /proc/sys/kernel/perf_event_paranoid <= -1.
> 
> On the other hand, kernel software events need either
> CAP_SYS_ADMIN or /proc/sys/kernel/perf_event_paranoid <= 1.
> 
> Now many distributions do default perf_event_paranoid to 1
> making context_switches a contender, except it has another
> problem (which is also shared with sched:sched_switch)
> which is that it happens before perf schedules events out
> instead of after perf schedules events in. Whereas a
> privileged user can see all the events anyway, a
> non-privileged user only sees events for their own processes,
> in other words they see when their process was scheduled out
> not when it was scheduled in. That presents two problems to
> use the event: 1. the information comes too late, so tools
> have to look ahead in the event stream to find out what the
> current state is 2. if they are unlucky tracing might have
> stopped before the context-switches event is recorded.
> 
> This new PERF_RECORD_SWITCH event does not have those problems
> and it also has a couple of other small advantages. It is
> easier to use because it is an auxiliary event (like mmap,
> comm and task events) which can be enabled by setting a single
> bit. It is smaller than sched:sched_switch and easier to parse.
> 
> To make the event useful for privileged users also, if the
> context is cpu-wide then the event record will be
> PERF_RECORD_SWITCH_CPU_WIDE which is the same as
> PERF_RECORD_SWITCH except it also provides the next or
> previous pid/tid.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>

Acme, if you agree with the tools part, feel free to take the lot.

Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ