public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Hans Rosenfeld <hans.rosenfeld@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	robert.richter@amd.com, LKML <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	"Herrmann3, Andreas" <Andreas.Herrmann3@amd.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC 0/3] Basic support for LWP
Date: Tue, 05 Oct 2010 14:43:40 -0400	[thread overview]
Message-ID: <1286304220.2065.0.camel@cowboy> (raw)
In-Reply-To: <20101005145155.GD173@escobedo.osrc.amd.com>

On Tue, 2010-10-05 at 16:51 +0200, Hans Rosenfeld wrote:
> [ adding Robert ]
> 
> On Mon, Oct 04, 2010 at 06:13:46PM -0400, Thomas Gleixner wrote:
> > > LWP (Light-Weight Profiling) is a new profiling mechanism that allows
> > > user mode processes to gather performance data about themselves with
> > > very low overhead. The specification can be found here:
> > >         http://developer.amd.com/cpu/LWP/Pages/default.aspx
> > 
> > All I can see there is marketing blurb. The spec pdf does not tell me
> > either how the end result of your patches will look like.
> 
> Well, you should get a basic understanding of how LWP works from the
> spec. I'm pretty sure there is more than that blurb in there.
> 
> What I sent _is_ the end result. Supporting LWP in the task switching
> code is the only thing necessary to use the LWP instructions in user
> space. And that is also what I'd like to get some comments on.
> 
> > > This code adds basic support for LWP to the context switch code, which
> > > is the minimum needed to use LWP. Support for other LWP features like
> > > interrupts will be added later.
> > 
> > Oh no. We are not going to merge that and give you a card blanche to
> > come up with another profiling/performance monitoring facility which
> > is completely disconnected to everything else.
> 
> I think you got something wrong here, probably because I wasn't clear
> enough :)
> 
> What I sent was just the basic kernel support, which means
> saving/restoring the LWP state in task switches. Technically no other
> kernel changes are necessary to use LWP in user space programs. No
> kernel framework of any kind is necessary to use LWP. Additionally,
> Robert is checking whether and how LWP support could be integrated
> into perf. This of course depends on having basic LWP task switching
> support in the kernel.

That would be the way to go, I don't think anyone wants yet another
profiling userspace tool.
> 
> > Please provide either the full patch of this facility or at least a
> > reasonable explanation how it will look like when your code is
> > ready. What's the user space interface, how does it hook into perf,
> > etc ...
> 
> The basic principle of LWP is that a user program reserves some memory
> for a LWP control block and a ring buffer, writes the ring buffer
> address and some setup bits into the control block, and executes the
> LLWPCB instruction to load the control block into the CPU. While the
> program runs it can periodically read the samples from the ring buffer
> and do something useful with them. The program being profiled needs to
> include support for LWP to do that. In case you can't or don't want to
> modify the program being profiled, a small LWP library would have to
> be written that would have to be LD_PRELOADed. I don't really know
> what it will look like in the end and how it will be integrated into
> perf. The tool/library developers will probably know best how to make
> use of LWP.
> 
> The point is that LWP is supposed to be controlled and used from user
> space without any kernel interaction, provided that the kernel
> saves/restores the LWP context. That's also how I tested it, using a
> small test program that just uses the LWP instructions.
> 
> Technically LWP is quite similar to the FPU, it even uses the same
> facilities for OS support. Just like FPU support, the kernel doesn't
> have to care at all about what user space is going to do with it. It
> just has to make sure state is saved and restored when necessary.
> 
> 
> Hans
> 
> 



  parent reply	other threads:[~2010-10-05 18:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1286212172-654419-1-git-send-email-hans.rosenfeld@amd.com>
2010-10-04 22:13 ` [RFC 0/3] Basic support for LWP Thomas Gleixner
2010-10-05 14:51   ` Hans Rosenfeld
2010-10-05 15:34     ` Thomas Gleixner
2010-10-05 18:27       ` Hans Rosenfeld
2010-10-05 18:30         ` Hans Rosenfeld
2010-10-05 18:30         ` [RFC 1/3] Cleanup xsave/xrstor support Hans Rosenfeld
2010-10-05 18:30         ` [RFC 2/3] Allow saving of individual states in fpu_xsave() Hans Rosenfeld
2010-10-05 18:30         ` [RFC 3/3] Save/restore LWP state in context switches Hans Rosenfeld
2010-10-06 11:12           ` Brian Gerst
2010-10-07 14:58             ` Hans Rosenfeld
2010-11-23 20:41             ` [RFC 0/2] FPU/xsave rework in preparation for LWP Hans Rosenfeld
2010-11-23 20:41             ` [RFC 1/2] x86, xsave: cleanup xsave/xrstor support Hans Rosenfeld
2010-11-23 20:41             ` [RFC 2/2] x86, xsave: rework xsave support Hans Rosenfeld
2010-11-25  0:36               ` Brian Gerst
2010-10-05 19:05         ` [RFC 0/3] Basic support for LWP Ingo Molnar
2010-10-06  7:35           ` Robert Richter
     [not found]             ` <AANLkTi=T0QmcKeZcgcR+GKk-9OwQUB_x8XdHiNuU7tE_@mail.gmail.com>
2010-10-07 10:46               ` Stephane Eranian
2010-10-07 13:59                 ` H. Peter Anvin
2010-10-07 14:11                   ` Stephane Eranian
2010-10-07 14:20                     ` Hans Rosenfeld
2010-10-07 14:20                     ` H. Peter Anvin
2010-10-07 14:25                       ` Stephane Eranian
2010-10-07 14:47                         ` H. Peter Anvin
2010-10-07 15:12                   ` Stephane Eranian
2010-10-05 18:43     ` Davidlohr Bueso [this message]
2010-10-06 10:26       ` Andi Kleen

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=1286304220.2065.0.camel@cowboy \
    --to=dave@gnu.org \
    --cc=Andreas.Herrmann3@amd.com \
    --cc=hans.rosenfeld@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox