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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140929153257.GM4140@worktop.programming.kicks-ass.net>
Date:	Mon, 29 Sep 2014 17:32:57 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Pawel Moll <pawel.moll@....com>
Cc:	Richard Cochran <richardcochran@...il.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...hat.com>,
	Paul Mackerras <paulus@...ba.org>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	John Stultz <john.stultz@...aro.org>,
	linux-kernel@...r.kernel.org, linux-api@...r.kernel.org
Subject: Re: [PATCH 2/2] perf: Userspace software event and ioctl

On Thu, Sep 18, 2014 at 03:34:33PM +0100, Pawel Moll wrote:
> This patch adds a PERF_COUNT_SW_USERSPACE_EVENT type,
> which can be generated by user with PERF_EVENT_IOC_ENTRY
> ioctl command, which injects an event of said type into
> the perf buffer.
> 
> The ioctl takes a pointer to struct perf_event_userspace
> as an argument. The structure begins with a 64-bit
> integer type value, which determines meaning of the
> following content (size/data pair). Type 0 are defined
> as zero-terminated strings, other types are defined by
> userspace (the perf tool will contain a list of
> known values with reference implementation of data
> content parsers).
> 
> Possible use cases for this feature:
> 
> - "perf_printf" like mechanism to add logging messages
>   to one's perf session; an example implementation:
> 
> 	int perf_printf(int perf_fd, const char *fmt, ...)
> 	{
> 	        struct perf_event_userspace *event;
> 	        int size;
> 	        va_list ap;
> 	        int err;
> 
> 	        va_start(ap, fmt);
> 
> 	        size = vsnprintf(NULL, 0, fmt, ap) + 1;
> 	        event = malloc(sizeof(*event) + size);
> 	        if (!event) {
> 	                va_end(ap);
> 	                return -1;
> 	        }
> 
> 	        event->type = 0;
> 	        event->size = size;
> 	        vsnprintf(event->data, size, fmt, ap);
> 
> 	        va_end(ap);
> 
> 	        err = ioctl(perf_fd, PERF_EVENT_IOC_USERSPACE, event);
> 
> 	        free(event);
> 
> 	        return err < 0 ? err : size - 1;
> 	}
> 
> - "perf_printf" used by for perf trace tool,
>   where certain traced process' calls are intercepted
>   (eg. using LD_PRELOAD) and treated as logging
>   requests, with it output redirected into the
>   perf buffer
> 
> - synchronisation of performance data generated in
>   user space with the perf stream coming from the kernel.
>   For example, the marker can be inserted by a JIT engine
>   after it generated portion of the code, but before the
>   code is executed for the first time, allowing the
>   post-processor to pick the correct debugging
>   information.
> 
> - other example is a system profiling tool taking data
>   from other sources than just perf, which generates a marker
>   at the beginning at at the end of the session
>   (also possibly periodically during the session) to
>   synchronise kernel timestamps with clock values
>   obtained in userspace (gtod or raw_monotonic).


Feel free to use up to 70 chars wide text in Changelogs. Most editors
have support for reflowing text. No need to keep it this narrow.

Also none of the many words above describe
PERF_SAMPLE_USERSPACE_EVENT(), wth is that about?

--
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