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:   Sat, 8 Aug 2020 12:22:08 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Rob Herring <robh@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>
Subject: Re: [RFC] libperf: Add support for user space counter access

On Fri, Aug 07, 2020 at 05:05:17PM -0600, Rob Herring wrote:
> x86 and arm64 can both support direct access of event counters in
> userspace. The access sequence is less than trivial and currently exists
> in perf test code (tools/perf/arch/x86/tests/rdpmc.c) with copies in
> projects such as PAPI and libpfm4.
> 
> Patches to add arm64 userspace support are pending[1].
> 
> For this RFC, looking for a yes, seems like a good idea, or no, go away we
> don't want this in libperf.

hi,
looks great!

I wanted to add this for very long time.. so yes, we want this ;-)

> 
> TODO:
> - Handle userspace access not enabled.
> - Handle pmc_width and cap_user_time_short in read loop.
> - Move existing rdpmc test to libperf based test?
> - Abstract out rdtsc/rdpmc (currently only builds on x86 and need to add
>   Arm versions)

all of them seem good, also please add test for perf_mmap__read_self
itself and update the doc/man

SNIP

> +{
> +	struct perf_event_mmap_page *pc = map->base;
> +	u32 seq, idx, time_mult = 0, time_shift = 0;
> +	u64 count, cyc = 0, time_offset = 0, enabled, running, delta;
> +
> +	/*
> +	 * Check if event was unmapped due to a POLLHUP/POLLERR.
> +	 */
> +	if (!refcount_read(&map->refcnt))
> +		return ~0;
> +
> +	do {
> +		seq = pc->lock;
> +		barrier();
> +
> +		enabled = pc->time_enabled;
> +		running = pc->time_running;
> +
> +		if (enabled != running) {

should you check pc->cap_usr_time in here?

> +			cyc = rdtsc();
> +			time_mult = pc->time_mult;
> +			time_shift = pc->time_shift;
> +			time_offset = pc->time_offset;
> +		}
> +
> +		idx = pc->index;
> +		count = pc->offset;
> +		if (idx)

and pc->cap_user_rdpmc in here?

ok, it's probably in the TODO

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ