Thread (19 messages) flat view 19 messages, 5 authors, 2014-09-16

Re: [RFC 2/2] perf: Marker software event and ioctl

From: Arnaldo Carvalho de Melo <hidden>
Date: 2014-09-12 13:49:16
Also in: lkml

Em Fri, Sep 12, 2014 at 01:57:52PM +0100, Pawel Moll escreveu:
On Fri, 2014-09-12 at 13:43 +0100, Christopher Covington wrote:
quoted
Just to ask the dumb questions in case the answers I've come up with are
wrong: What is PAGE_SIZE on an arm64 kernel? 
 
It's either 4 or 64k, depending on CONFIG_ARM64_64K_PAGES.
 
quoted
How does userspace know?
#include <unistd.h>
#include <stdio.h>
 
int main(void)
{
	printf("%ld\n", sysconf(_SC_PAGESIZE));
	return 0;
}
 
Now a word of explanation. The PAGE_SIZE limitation was shamelessly
stolen from perf_event_set_filter() (so PERF_EVENT_IOC_SET_FILTER) as an
attempt to address a problem of passing a zero-terminated string from
userspace. Simply speaking - there must be some limitation, and a page
size seem as good as any other. I have strong doubts about this myself,
so all alternative ideas are more than welcome.
 
As I mentioned in the cover letter, maybe this simply shouldn't be a
string? I made it like this to mimic trace_marker, but maybe an integer
value + some kind of a dictionary in userspace is a better approach? I
belive that ftrace's maker is taking a string, because it's: 1. natural
for its interface and 2. anyone (sort of) can write to it, so it's hard
to assume anything. In this case the user "owns" the perf data, so he
could handle int<->whatever-else relation table...
Perhaps both? I.e. an u64 followed from a string, if the u64 is zero,
then there is a string right after it?

- Arnaldo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help