All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: eranian@gmail.com
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	mingo@elte.hu, x86@kernel.org, sfr@canb.auug.org.au
Subject: Re: [patch 23/24] perfmon: kernel documentation
Date: Wed, 26 Nov 2008 21:56:19 +0100	[thread overview]
Message-ID: <20081126205619.GD6703@one.firstfloor.org> (raw)
In-Reply-To: <7c86c4470811261224k20ae2554m32af5504488664cf@mail.gmail.com>

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

  reply	other threads:[~2008-11-26 20:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-26  8:43 [patch 23/24] perfmon: kernel documentation eranian
2008-11-26 12:21 ` Andi Kleen
2008-11-26 16:41   ` Randy Dunlap
2008-11-26 17:00     ` Andi Kleen
2008-11-26 18:21   ` stephane eranian
2008-11-26 19:34     ` Andi Kleen
2008-11-26 20:24       ` stephane eranian
2008-11-26 20:56         ` Andi Kleen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-11-25 21:36 eranian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081126205619.GD6703@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=akpm@linux-foundation.org \
    --cc=eranian@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sfr@canb.auug.org.au \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.