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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101005145155.GD173@escobedo.osrc.amd.com>
Date:	Tue, 5 Oct 2010 16:51:55 +0200
From:	Hans Rosenfeld <hans.rosenfeld@....com>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	<robert.richter@....com>, LKML <linux-kernel@...r.kernel.org>,
	"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
	"Herrmann3, Andreas" <Andreas.Herrmann3@....com>,
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [RFC 0/3] Basic support for LWP

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

> 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


-- 
%SYSTEM-F-ANARCHISM, The operating system has been overthrown

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