lkml.org 
[lkml]   [2008]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 23/24] perfmon: kernel documentation
On Wed, Nov 26, 2008 at 09:24:59PM +0100, stephane eranian wrote:
>
> >> I have never played with that myself, even with regular file
> >> descriptors. But I can only
> >> assume passing a file descriptor increments its refcount. Thus you
> >> simply get another
> >> controlling process. There is enough context locking in place in the
> >> kernel to make this
> >> work.
> >
> > Ok as long as it isn't a root hole or similar.
> >
> I need to figure out how you actually pass a fd form one process to another.
> I seem to remember you need a pipe or socket + some ioctl().

Unix sockets and the SCM_RIGHTS auxilliary message. See man 7 unix

> But then, there is one issue with RDPMC which is not clearly stated in the SDM
> if I recall. Take Core 2, counters are 40 bits, thus RDPMC returns 40-bit worth
> of data. But wrmsrl() can only set the bottom 32 bits. Bits 32-39 are
> sign extension

For this usecase wrmsrl is not really needed, it would be just a free
running counter like the TSC.

> of bit 31. Thus, you may need some masking in case the counter is high. On
> Intel processors, perfmon considers that all counters are actually 31-bit wide
> (bits 32 and up are always set) and they are all virtualized to 64-bit via the
> overflow interrupt. The issue with RDPMC vs. wrmsrl() is important in per-thread
> mode because on context switch we may have to restore the counter.

Ok is there a simple way currently to just enable the counter?

> If we all agree on this, I can have the kernel adjust the limit based
> on the number
> of registers. We would not necessarily need to expose that limit in
> /sys, if we assume
> that tools will never try to pass vector with more entries than there
> are registers. And if
> they do, the call will fail.

I would suggest to just hardcode PAGE_SIZE and only worry about
it again if really some driver exceeds it.

-Andi

--
ak@linux.intel.com


\
 
 \ /
  Last update: 2008-11-26 21:49    [W:0.054 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site