* Re: perfmon2 merge news
@ 2007-11-17 17:19 Patrick DEMICHEL
2007-11-18 0:35 ` David Miller
0 siblings, 1 reply; 19+ messages in thread
From: Patrick DEMICHEL @ 2007-11-17 17:19 UTC (permalink / raw)
To: linux-kernel; +Cc: dmlpat
Yet another noisy linux HPC user
I hope to convince you, lkml developers, to pay more attention to our
HPC performance problems.
I will not try to convince you that our problems are also the problems
of many others users, I hope they will do it directly.
Imagine my company bought an expensive complex multi nodes, multi
sockets, multi cores machine.
This is cheap today, around 10M$
My company made the strange decision to go for linux, in fact we had
no choice : OOPS
This machine will be used to solve many fundamental problems like
meteorology, life&sciences, nanotechnologies, technologies, maths,
climatology, ...
Many of our scientists and developers will try to exploit the
potential of this machine to make some radically new sciences and make
breakthroughs in their domains. Some of those results could have a
major impact on everybody's life.
Then you see this is not just the problem of a bunch of desperate HPC users.
Moore's Law gave us the opportunity to solve many fundamental problems
by offering tons of cheap transistors,
but we all have 1 major problem : how to optimize our codes in that
context of massive parallelism?
Any idea what is massive?
Maybe you start to be familiar with tuning 4 cores.
We target shortly tuning millions of heterogeneous cores.
Good news for you, this is not the only problem we need to solve, but
this one is very serious.
And we know this is just an intermediate step towards somethings
continuously more complex and challenging.
There are tons of papers in the WEB written by many talented and
motivated people.
You need to be motivated to stay in this business :-)
Developing the complete software stack required to manage and use such
machines will require that a large number of different actors succeed
in going in the same direction and share the burden.
Nobody and no company can sustain all the required developments at
reasonable cost.
No company has the time and complete expertise to do it alone.
I hope collectively we can do it. This is not even sure as I can see today.
Following your logic, you can claim "why such useless hardware
complexity? Do something simpler."
Here we have a problem, we cannot change the constants and laws of
physics, then we face the inevitable choice of massive parallelism,
complex memory hierarchies, complex micro architectures, complex
interconnects, variable elements, failing elements, ...
Quite some fun ahead in fact.
And I can promise you, the hardware designers are not lazy or short of
inspiration and they also have a growing infinitude of challenges.
Some people argue that some magic tools will decompose and tune the
programs automatically, then why you need performance tools in fact?
First this is will be done at the price of loosing an enormous part of
the potential, secondly the compilers will probably require extensive
support from the hardware counters to be somewhat effective. Most of
us target reasonable scalability, cannot afford to reach only 20% of
peak of anything.
A dream without some breakthrough on the tools side.
This is where we need advanced performance tools, tools that permit to
the largest amount of developers,
to understand how the architectures really work. Not how naively we
think they should work, but like they really work.
Theory and reality are not good friends, it's rare to meet them together.
We cannot afford that only some too rare specialists can do an always
partial tuning, I am sure they also have some limits at least time.
I am sure as soon the advanced tools will expose in the right form the
real problems to the developers, they will find innovative solutions.
Can you imagine a modern medicine without scanners ,radios, all the
sources of information on your body?
For us this is exactly the same thing, we desperately need advanced
performance tools, not one but many to attack the problems from
different angles.
An the tools should be easy to use, reliable, flexible, predictable,
ready to use when I need them, standard, installed everywhere and in
particular on the new platforms as soon they appear, ...
The tools need to hide the complexity when I need it, and expose it if required.
The tools will always be behind the requirements but I hope not too far.
I prefer tools that adapt to me than the opposite.
But I am realistic, I don't need perfect tools, I need tools I can
invest in learning and progressing a long time with them.
That's why also meanwhile the cost of development, many developers
ended up developing their own performance tools.
This is my case, spending more time to develop the tools I need than
using them, I have no choice today, but this is unsustainable now.
The current state of what is available is not what is required, not
even close to minimal of what I needed 5 years ago.
What Stephane is developing, is layer 1 of what we need, something
that hides most of the complexity of the hardware counters, and this
is not the fault of Stephane if this is very complex. This is not even
the fault of the hardware designers. In fact we ask them for more
complexity, to at least better support the virtualization and multi
users multi usages environments and ...
Naturally complexity should be managed and controlled, and I am an
ardent defender of simplification, but not to the point of suppressing
the functionalities even if they target today some rare advanced
users, tomorrow this could be common case.
The people developing the layers 2,3,4,.. of the performance tools,
all expect the under layers to be simple, flexible, stable, robust and
offer what they require.
Simple does not mean trivial, whatever the complexity of the API of
perfmon2, it will be 1 or 2 order of magnitude simpler than if we had
to program those hardware counters directly in our programs. And stop
claiming counting or RDTSC is sufficient.
In fact most users will never see the perform2 API, just some tools
developers or advanced users pushing the limits of the technologies.
The guys that understand the hardware counters intricacies will find
the perform2 API trivially simple.
The performance tools need to offer to a large variety of different
users with a large variety of different expertises and a large variety
of different situations the best chance to approach some reasonable
optimal level at the cost they decide is justified by them.
There is room for lot of tools as soon they have some common ground
and preferably interoperability.
Then please consider helping Stephane to deliver a viable, supported
perform2 in all standard linux releases.
This is not only important for the performance, but this is also
important for many others reasons:
1: power consumption optimization, probably the companies you work for
are interested in this.
2: debugging and diagnosing those enormous machines.
In fact those 2 problems become even more important than pure code
tuning in some cases.
The hardware counters and tools also offer good opportunities to
progress on those topics.
Now what we need:
I definitively don't want to instrument my codes, I am sure I will
continue, I hope this will just be rare justified cases.
You will say I am lazy, maybe, but I have some obligation of productivity.
Then if with sampling I can obtain informations in minutes, why I
would need to instrument, recompile, and rerun my code?
By the way, sometimes you need to tune some codes you don't know and
or don't access the source code.
Yes some people work with codes without the sources and can do
important tunings that can do significant productivity gains.
How many iterations or time you need?
With sampling in 1 run if I can attach/detach and or use system wide,
then I can capture and correlate lot of set of counters.
Sometimes they can be measured independently, sometimes you need high
frequency multiplexing, sometimes I am obliged to tune and monitor the
system for a code I cannot instrument, sometimes the run is so long
than I have only 1 chance to run the program,
sometimes I need at same time to do system wide and process monitoring.
And I can probably give tens of very different scenarios where
counting is ridiculously insufficient, where instrumentation is
impossible.
And whatever perform2 offers, it will stay a hard problem for me to
correlate all the sources of measures and get the useful and valid
informations in that ocean of numbers. And I promise, I like numbers,
but graphics would be better.
Without perform2 things are much simpler, I can globally do nothing
because I am not expert in crystal ball analysis.
We can spend hours and hours convincing you this is required but I
think you need to look the problem differently.
Imagine, I spend hours and hundreds of mails discussing why you have
implement such a complex linux OS,
why are you using so much different structures in place of 1? ,... blah blah,...
I imagine you will make the comments that I am not a linux kernel
expert, and you are right.
And meanwhile I worked since 25 years on many others kernels, you are
still right.
My obsolete expertise is useless to you and lkml and even that does
not qualify me because
I have not spent the hundreds of hours required to just start to be
serious on lkml.
But as linux kernel experts, you have no idea what means tuning a
massive SMP machine,
what means programming and tuning a MPI job of 1000+ nodes and
programming and tuning a PS3 processor,
and programming and tuning a MPI cluster of OpenMP nodes using some
accelerators to achieve 1Pflops sustained.
All those machines run or will run linux, then why you don't care?
Because you have not have one at home?
Buy a PS3 and try to do a 200Mflops FFT on it.
Can you explain to me what qualify you to pretend you can understand
what is useful and not useful for us?
How you will judge?
Number of M$?, Number of desperate developers?,something useful or fun?
I return the problem: can you do it or not?
If not, what would be required to do it rapidly?
Some funding,collaboration,trainings,coordination,...?
Be open, we will help you, but implement the thing rapidly, this is so
crucial to us..
Stephane is exposed to many of the people that are confronted to the
challenges I just described above.
He had the exceptional chance to meet many of the best experts in
performance in most of the major companies that probably cover all the
businesses.
He had the chance and pain to be obliged to work with many very
different processors and architectures.
He had the talent and the multi years patience and perseverance to
work and fight for us, not for him, even if he probably likes his
baby.
I can assure you, he is not lazy as some of you claimed imprudently.
I can assure you this domain is horribly large and subtle, far beyond
you can think.
I probably underestimate the challenges your group face, like exactly
you underestimate ours.
But I will never underestimate your efforts and exceptional talents.
And I should thank warmly your group to have offered us this
opportunity of the road to Eflops machines.
Clearly without linux we would not be there.
You are a key contributor to that vision, this is more important for
the humanity that you could understand.
Is not it important to predict the storms, hurricanes, tsunami,...?
Is not it important to discover many new drugs to prepare to fight H5N1?
Is not it important to have Google?
Is not it important to have automatic real time translation, to be
able to speak one day all together?
Is it not important to understand Global Warming?
If you think you can do that with a PC? You are welcome to show us.
No, for some problems you need 1Pflops ,1 Eflops or more
No, you need hundreds of thousands of the best scientists on the
planet trying to push the limits, there are thousands of problems to
solve.
Never heard about ITER,SKA,CERN,...?
In all cases you need tuned machines, because you cannot afford
wasting the electricity, or waiting 10 more years.
Then your role today is to offer us a way to continue our progression,
please don't stall us.
This will be very hard for you, I have no doubt, and for us, and for
the many people involved from close to far.
But many of the key problems of our society can only be solved with
those HPC machines, sorry
LOOK AT THE BIG PICTURE
I will encourage all people depending on performance tools and
suffering of lack of generally available high performance
profilers to manifest their desire for better linux support for
performance tools.
Please encourage Stephane, to continue the hard work, and help him to
succeed for us in integrating perform2.
Stephane is very open to major rewriting, if required for any valid
reason, but stop to ask for extreme truncation of functionalities.
The state of the code is not an accident, this is the result of a long
and progressive maturation shared with many people.
To be a little productive in this mail I want to give an example of
something that would be interesting to have.
This is naturally a trivial example, in fact I will not explain what
the counters means in detail and how t interpret, this is not useful
here.
Just understand this is the result of sampling and multiplexing, I
report 6 different counters with different frequencies of sampling.
Why different sampling frequencies? Because some events are very
frequent and others rares.
Some rare events can have a huge impact on efficiency, I need to
quantify their impact then get optimal resolution.
I need to capture the maximum of information in 1 run because I cannot
repeat the experiment.
I want to understand how my loops behave, one by one, because I will
tune one by one, from the most promising to least.
I will naturally collect the clock,caches,tlb,stall rate,bus
activities,flops,exceptions,... the maximum I can do in one complete
or partial run.
I want to take 1 hour sample at different moments of the life of the
program to study how the counters evolve in time.
I need to be normal user and my administrator need some counters to
monitor the global system, also done by multiplexing.
By the way the nodes need careful intrusion control and
synchronization to minimize the pollution on my MPI sensitive code.
This is not exact counting for sure,because of sampling and low
frequency I use to reduce the pollution, but this turn out to be
extremely productive in capturing all performance problems and
offering clear understanding of very subtle problems that where
previously undetectable.
I can expose percentage time spent in the loop, instruction rate, the
stall rate of the loop, and the correlation with others counters will
trigger a large variety of situations/improvements.
If I tune a loop that is 20% in middle of something very large, I can
precisely measure the benefit or degradation of any transformation
The key of success : multiplexing the largest number of valid
counters. Valid means , experience proved sometimes useful by a large
range of users.
I will try for sure to reduce the set of counters and increase the
frequency of sampling while maintaining the level of intrusion, but
generally the first pass is sufficient in most situations because it
is more important to have lot of counters to correlate that few
counters at ultra high frequency, I said generally.
In fact what I would like to obtain is some systematization of that
mechanism for regression analysis.
Imagine,I have something consuming less than 1 percent and reporting
tens of counters of any runs of my large programs.
I would be delighted to have some tool to collect and post analyze all
the variations.
One day my code is 20% slower , it is clear some of those columns will
expose precisely why.
Observe I coded no lines to achieve that dream.
This is critical because I will not be obliged to do 20 runs to
reproduce again.
I will not fix 100% of all problems, but my success rate is improved
by an enormous factor and that whatever the code is doing.
Imagine you have hundreds of nodes, you think they are all identical
mathematical objects? NO
The temporal and spatial variations could be crucial information to
collect and exploit.
You can observe that 1 or 2 nodes are systematically 5% slower,
probably interesting to fix that.
And you think this interest ONLY the HPC guys?
I am sure this will help you to anticipate many hardware problems,
most problems have subtle performance symptoms
that it would be interesting to capture to avoid the crash.
We need some software infrastructure, this can only be built above
some rich and standard low level API to capture the best of the
counters, whatever they are or will become, we will push the hardware
designer to add more, much more. But why would they spend energy to
add something that nobody use?
The sooner we have it, the better. There is lot of work to add above
permon2 or PAPI or others layers, and the processors, chipsets, ...
---------------------------------------------------------------------------------------------------------------
One example of capture with few counters to expose the concept:
column 1 is address
column 2 is cycles
column 3 is cycles : hardwired in core2
column 4 is instructions rate
column 5 is memory bus cycles
column 6 is cache miss rate
column 7 stall rate information
--------------------------------------------------------------------------------------------------------------
_ 423d54 14979 19282 20482 158 9187 282 mov
(%r9,%r15,1),%r10d
_ 423d58 23124 109815 114371 265 54809 3259 mov
0x4(%r9,%r15,1),%r11d
_ 423d5d 7135 8379 8888 40 4151 116
movss (%rdi,%r14,1),%xmm1
_ 423d63 15501 40062 41924 78 19540 977 mulss
%xmm0,%xmm1
_ 423d67 49814 48065 50873 330 21451 509 movss
%xmm1,(%rdi,%rax,1)
_ 423d6c 47365 58046 60958 159 29862 1036 mov
%r10d,(%r9,%rdx,1)
_ 423d70 3765 5132 5386 15 3052 103 mov
(%rdi,%r13,1),%r10d
_ 423d74 75911 130227 136796 318 62672 2538 mov
%r11d,0x4(%r9,%rdx,1)
_ 423d79 6623 9732 10444 32 5203 148 add $0x8,%r9
_ 423d7d 10575 8214 8663 36 3681 88 mov
%r10d,0x67a500(%rdi)
_ 423d84 16072 23604 24715 42 11284 371 mov
(%rdi,%r12,1),%r10d
_ 423d88 5343 33126 34584 185 16226 938 mov
%r10d,0x684140(%rdi)
_ 423d8f 14227 22018 23249 80 10950 370 mov
(%rdi,%rbx,1),%r10d
_ 423d93 10917 34384 35815 168 17132 924 mov
%r10d,0x68dd80(%rdi)
_ 423d9a 9991 13744 14676 96 7077 202 add $0x4,%rdi
_ 423d9e 0 8 9 0 0 0
cmp %rcx,%rdi
_ 423da1 951 2611 2677 24 14 11 jl 423d54
--------------------------------------------------------------------------------------------------------------
Then please help Stephane to integrate the complete perfmon2 feature
set in standard linux kernels
Patrick DEMICHEL
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-17 17:19 perfmon2 merge news Patrick DEMICHEL
@ 2007-11-18 0:35 ` David Miller
0 siblings, 0 replies; 19+ messages in thread
From: David Miller @ 2007-11-18 0:35 UTC (permalink / raw)
To: dmlpat; +Cc: linux-kernel
From: "Patrick DEMICHEL" <dmlpat@gmail.com>
Date: Sat, 17 Nov 2007 18:19:25 +0100
> Yet another noisy linux HPC user
Nobody on this list is interested in discussing this.
Really, the on-topic discussion here is the code and
the technical issues. And we will work on those to
get perfmon2 into shape in due time.
I guarentee you that %99 of the kernel developers didn't
wade through your description at all, myself included.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
[not found] ` <1d7226b10711161748n39b7f195q796d85282ef66134@mail.gmail.com>
@ 2007-11-17 2:13 ` Greg KH
0 siblings, 0 replies; 19+ messages in thread
From: Greg KH @ 2007-11-17 2:13 UTC (permalink / raw)
To: Patrick DEMICHEL
Cc: linux-kernel, Philip Mucci, Andrew Morton, Stephane Eranian,
William Cohen, Robert Richter, papi list, Andi Kleen
On Sat, Nov 17, 2007 at 02:48:45AM +0100, Patrick DEMICHEL wrote:
> Thanks Greg,
>
> but for external people it seems there is lot of people with opposite
> opinions, for sure some are valid and they can be focused on different
> things. But for example this critical topic seems quite not under control.
> And we don't like that.
> At least not under the control of Stephane, whatever the efforts if could
> generate, we have the feeling we will never have something serious to us.
> Also I never see a clear statement after long exchanges on what is the
> accepted final common view of some topic like that
> Maybe there is never definitive position, but a resume could be
> interesting to make some reference point
>
> What I would like to see is:
<snip>
Heh, no, code is our currency here, it's the center of everything that
we do and work with. Agreements, deadlines and plans are just not
relevant at all here, sorry.
So again, post the code, in reviewable patches, and then let's talk. A
number of developers have expressed a concrete interest in getting this
kind of feature into the kernel tree, so show us the code so that we can
move forward.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
[not found] ` <1d7226b10711161713j675341b7wdb4f050c59a8be0a@mail.gmail.com>
@ 2007-11-17 1:25 ` Greg KH
[not found] ` <1d7226b10711161748n39b7f195q796d85282ef66134@mail.gmail.com>
0 siblings, 1 reply; 19+ messages in thread
From: Greg KH @ 2007-11-17 1:25 UTC (permalink / raw)
To: Patrick DEMICHEL
Cc: linux-kernel, Philip Mucci, Andrew Morton, Stephane Eranian,
William Cohen, Robert Richter, papi list, Andi Kleen
On Sat, Nov 17, 2007 at 02:13:13AM +0100, Patrick DEMICHEL wrote:
> Yet another noisy linux HPC user
>
> I hope to convince you, lkml developers, to pay more attention to our HPC
> performance problems.
We do pay attention, and want to help out, we just need either bug
reports of problems that we can work to address, or patches in a
reviewable state whereby we are able to review, work with, and apply to
our trees.
Please do not think we are ignoring you at all, we are glad to work with
anyone who uses the Linux kernel on whatever platform as we well know
this allows us to create a kernel that works even better for everyone.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-17 0:29 ` David Miller
@ 2007-11-17 1:07 ` Greg KH
0 siblings, 0 replies; 19+ messages in thread
From: Greg KH @ 2007-11-17 1:07 UTC (permalink / raw)
To: David Miller
Cc: dean, andi, mucci, akpm, eranian, wcohen, robert.richter,
linux-kernel, ptools-perfapi
On Fri, Nov 16, 2007 at 04:29:05PM -0800, David Miller wrote:
> From: dean gaudet <dean@arctic.org>
> Date: Fri, 16 Nov 2007 09:51:08 -0800 (PST)
>
> > On Fri, 16 Nov 2007, Andi Kleen wrote:
> >
> > > I didn't see a clear list.
> >
> > - cross platform extensible API for configuring perf counters
> > - support for multiplexed counters
> > - support for virtualized 64-bit counters
> > - support for PC and call graph sampling at specific intervals
> > - support for reading counters not necessarily with sampling
> > - taskswitch support for counters
> > - API available from userland
> > - ability to self-monitor: need select/poll/etc interface
> > - support for PEBS, IBS and whatever other new perf monitoring
> > infrastructure the vendors through at us in the future
> > - low overhead: must minimize the "probe effect" of monitoring
> > - low noise in measurements: cannot achieve this in userland
> >
> > permon2 has all of this and more i've probably neglected...
>
> I want to state that even though I've been a stickler on the system
> call stuff, in general I want to see perfmon2 go into tree and I agree
> with how most of the infrastructure is implemented and the features it
> provides.
Now if we only had a series of patches that we could actually review and
apply to the -mm tree so that people can try them out... :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 17:51 ` dean gaudet
@ 2007-11-17 0:29 ` David Miller
2007-11-17 1:07 ` Greg KH
0 siblings, 1 reply; 19+ messages in thread
From: David Miller @ 2007-11-17 0:29 UTC (permalink / raw)
To: dean
Cc: andi, mucci, akpm, gregkh, eranian, wcohen, robert.richter,
linux-kernel, ptools-perfapi
From: dean gaudet <dean@arctic.org>
Date: Fri, 16 Nov 2007 09:51:08 -0800 (PST)
> On Fri, 16 Nov 2007, Andi Kleen wrote:
>
> > I didn't see a clear list.
>
> - cross platform extensible API for configuring perf counters
> - support for multiplexed counters
> - support for virtualized 64-bit counters
> - support for PC and call graph sampling at specific intervals
> - support for reading counters not necessarily with sampling
> - taskswitch support for counters
> - API available from userland
> - ability to self-monitor: need select/poll/etc interface
> - support for PEBS, IBS and whatever other new perf monitoring
> infrastructure the vendors through at us in the future
> - low overhead: must minimize the "probe effect" of monitoring
> - low noise in measurements: cannot achieve this in userland
>
> permon2 has all of this and more i've probably neglected...
I want to state that even though I've been a stickler on the system
call stuff, in general I want to see perfmon2 go into tree and I agree
with how most of the infrastructure is implemented and the features it
provides.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 15:15 ` Andi Kleen
` (2 preceding siblings ...)
2007-11-16 20:16 ` Philip Mucci
@ 2007-11-17 0:15 ` David Miller
[not found] ` <1d7226b10711161713j675341b7wdb4f050c59a8be0a@mail.gmail.com>
4 siblings, 0 replies; 19+ messages in thread
From: David Miller @ 2007-11-17 0:15 UTC (permalink / raw)
To: andi
Cc: mucci, akpm, gregkh, eranian, wcohen, robert.richter,
linux-kernel, ptools-perfapi
From: Andi Kleen <andi@firstfloor.org>
Date: Fri, 16 Nov 2007 16:15:56 +0100
> Philip Mucci <mucci@cs.utk.edu> writes:
> > - A feature which was dropped earlier by Stefane (only to satiate
> > LKML), we consider
> > very important. Allowing one tomapping of the kernels view of the
> > PMD's, allowing
> > user-space access to full 64-bit counts, if the architecture
> > supports a user-level read instruction.
>
> You mean returning the register number for RDPMC or equivalent
> and a way to enable it for ring 3 access?
>
> I'm considering that an essential feature too. I wasn't aware
> it was dropped.
>
> > Getting the counts in a
> > couple of dozen cycles
> > is ALWAYS a win for us.
>
> Yes it is for everybody. I've been rather questioning if the slow
> ways (complicated syscalls) to get the counter information are really
> needed.
I would like to add sparc64 support to perfmon2 as well
and therefore I've been considering this angle of the
API issues as well.
The counters on sparc64 can be configured to be readable by userspace,
so for the self-monitoring cases I really would like to make sure the
perfmon2 library interface could use direct reads for sampling instead
of system calls or specialized traps.
If I get some spare time I'll look at the current perfmon2 patches
and see if I can toss together sparc64 support to get a feel for
how things stand currently.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 17:13 ` William Cohen
@ 2007-11-16 21:56 ` Stephane Eranian
0 siblings, 0 replies; 19+ messages in thread
From: Stephane Eranian @ 2007-11-16 21:56 UTC (permalink / raw)
To: William Cohen
Cc: Andi Kleen, Philip Mucci, Andrew Morton, Greg KH, Robert Richter,
linux-kernel
Will,
On Fri, Nov 16, 2007 at 12:13:07PM -0500, William Cohen wrote:
> Andi Kleen wrote:
> >On Fri, Nov 16, 2007 at 08:00:56AM -0800, Stephane Eranian wrote:
> >>No, he is talking about something similar to what was in perfctr.
> >>The kernel emulates 64-bit counters in software and that is you
> >>get back when you read the counters. If you read via RDPMC, you
> >>get 40 bits. To reconstruct the full 64-bit value from user land
> >>you need the upper bits. One approach is for the kernel to allow
> >>you to remap a page that has the 64-bit (software) counters. With
> >>that and a bit of mask/shifting you can reconstruct the full value.
> >
> >You mean the page contains the upper [40;63] bits?
> >
> >Sounds reasonable, although I don't remember seeing that when I looked
> >at the perfmon code last.
>
> Upper 32-bit ([32:63]). On many implementations the only lower 32-bit are
> available in the register. the 32:40 bits in several processor
> implementation of x86 processors can not be set to bit outside of sign
> extension of bit 32. On other processor implementations the event counters
> are only 32-bit in width.
>
That is quite true on Intel's. Perfmon2 only considers the bottom 31 bits as
true counter bits, the rest is forced to 1. This is true even on Intel Core 2.
--
-Stephane
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 15:15 ` Andi Kleen
2007-11-16 16:00 ` Stephane Eranian
2007-11-16 17:51 ` dean gaudet
@ 2007-11-16 20:16 ` Philip Mucci
2007-11-17 0:15 ` David Miller
[not found] ` <1d7226b10711161713j675341b7wdb4f050c59a8be0a@mail.gmail.com>
4 siblings, 0 replies; 19+ messages in thread
From: Philip Mucci @ 2007-11-16 20:16 UTC (permalink / raw)
To: Andi Kleen
Cc: Andrew Morton, Greg KH, Stephane Eranian, William Cohen,
Robert Richter, linux-kernel, papi list
> Yes it is for everybody. I've been rather questioning if the slow
> ways (complicated syscalls) to get the counter information are really
> needed.
I suppose by complicated here, your referring to the gather semantics
of the
pfm_read/write_pmds/pmcs calls. Many processors may have 100's of
registers
(IA64, BG/P, SiCortex), some of which have different access times. So a
naive syscall of 'give me all the registers you've got' isn't going
to cut it.
However, any additional simplicity (performance) we can squeeze out
of this
particular primitive is a huge win as it sits in the critical path of
the user
tools (unless one is sampling).
>> referring to the concept of eventsets. Having multiplexing is
>> important.
>
> Why is it important?
>
Performance and noise. See the earlier message about our user-land
implementation versus kernel mode implementations. Any any useful
granularity, you begin to seriously affect the counts with noise as
well as dilate the run-time. But let's punt on this one until after
we get the basics in. It's a non-essential feature at this point.
>> - Custom sample formats would be considered not often used in our
>> community, largely
>> because the tools run on all HPC/Linux architectures. PAPI uses the
>> default sample
>> format which has been sufficient for our needs. However, the lack of
>> custom sample
>> formats preclude the dev of the specialized tools that access the
>> sampling
>> hardware as found on the IA64, PPC64, the Barcelona and the SiCortex
>> node chip.
>> pfmon exports this functionality quite well, and it does get used.
>
> What do you mean with custom sample formats exactly? What information
> do you want in there? And why?
By custom here, I mean the ability to have the kernel take samples
containing
more than just the IP, the PID and a bitmask of which registers
overflowed at this
point. Myself and others have worked hard to get effective address
sampling into the
hardware (there are registers that contain EA's of misses as well as
branch mispredict
data on the PPC, IA64, Barcelona and SiCortex) that are handled
through the use
of a format that gathers up that information at interrupt time for
deposit into
the sample buffer. We are not wedded to Perfmon2's implementation of
these formats, we
are however, wedded to having this information collected at interrupt
time as the data
may change by the time you get back to user-mode. This hardware is
not obscure any more,
it's the norm, as we've learned at thus simple aggregate counters,
even those with precise
interrupt abilities, are not sufficient to satisfy all of our needs.
> e.g. PEBS and so on pretty much fix the in memory sample format in
> hardware,
> so they only way to get a custom format would be to use a separate
> buffer.
>
> I can think of one reason why the kernel should add more information
> in a separate buffer (log the instruction bytes so that it can
> be disassembled and a address histogram be generated using the PEBS
> register values), but it is a relatively obscure one and definitely
> not a essential feature. Unfortunately it is also hard to implement
> completely
> race-free.
>
>> This is kind of comment that makes the Linux/HPC folks 'somber'. What
>> isn't useful, is being dismissive of an entire community that moves a
>> heck of a lot of Linux DVD's.
>
> Sorry, but these kind of non technical BS arguments will just make
> you be ignored in mainline Linux lands. They might work if you pay
> a lot of money to specific Linux companies (do you?), but here
> on linux-kernel you have to convince with purely technical arguments.
I love it when kernel folks refer to their own revenue streams
(and yes, we do, ask your VP of sales) and the needs of a user
community as
"BS non-technical arguments".
But let's get back to basics here. We can sort that out over a beer
sometime.
At this point, let's try and agree on the minimum set of
functionality acceptable for a first round of patches.
- per-CPU (system-wide) and per-thread 64-bit virtualized counters
- dispatch of interrupt on overflow via a signal
- first (self) and third-party (attach) semantics
- extensible to new lines within an architecture without repatching
(By this I mean that through the use of modules that contain PMU
description tables, i.e. patches don't have to be issued for
every new rev
of HW that Intel releases)
To be considered later:
- Sample buffers and formats
- Multiplexing (by event threshold and time slicing)
- fast-read support if the hardware supports it (mmap + user rdpmc)
I think(?) we are all clear now why oprofile is not sufficient, i.e.
simultaneous usage by non-root users, each with different counter
configurations,
lack of read/write access etc. Oprofile is however, a very important
tool
and any initial set of functionality should allow for a very simple
port to
each version of the infrastructure along the way. I'd happily port
incremental versions of PAPI to the patches, so the performance tools
can be
accessible to the LKML community while testing/benchmarking the
patchset on a variety of architectures. If we can agree on the
starting point,
we can move the discussion of the API to the Perfmon2 mailing list
and with your
input, finally 'get it right' in terms of acceptance.
If there's anything we do have in common at the moment, it's momentum.
We (speaking for the HPC community/vendors again) are not in favor of
useless bloat, every
TLB slot, mispredict, miss, timer-tick or pipeline bubble, we care
about, kernel
space or not. It's precisely why this type of infrastructure has
become so
vital to us over the years.
-Phil
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 15:15 ` Andi Kleen
2007-11-16 16:00 ` Stephane Eranian
@ 2007-11-16 17:51 ` dean gaudet
2007-11-17 0:29 ` David Miller
2007-11-16 20:16 ` Philip Mucci
` (2 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: dean gaudet @ 2007-11-16 17:51 UTC (permalink / raw)
To: Andi Kleen
Cc: Philip Mucci, Andrew Morton, Greg KH, Stephane Eranian,
William Cohen, Robert Richter, linux-kernel, papi list
On Fri, 16 Nov 2007, Andi Kleen wrote:
> I didn't see a clear list.
- cross platform extensible API for configuring perf counters
- support for multiplexed counters
- support for virtualized 64-bit counters
- support for PC and call graph sampling at specific intervals
- support for reading counters not necessarily with sampling
- taskswitch support for counters
- API available from userland
- ability to self-monitor: need select/poll/etc interface
- support for PEBS, IBS and whatever other new perf monitoring
infrastructure the vendors through at us in the future
- low overhead: must minimize the "probe effect" of monitoring
- low noise in measurements: cannot achieve this in userland
permon2 has all of this and more i've probably neglected...
-dean
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 16:28 ` Andi Kleen
2007-11-16 17:13 ` William Cohen
@ 2007-11-16 17:36 ` Stephane Eranian
1 sibling, 0 replies; 19+ messages in thread
From: Stephane Eranian @ 2007-11-16 17:36 UTC (permalink / raw)
To: Andi Kleen
Cc: Philip Mucci, Andrew Morton, Greg KH, William Cohen,
Robert Richter, linux-kernel, Stephane Eranian
Andi,
On Fri, Nov 16, 2007 at 05:28:13PM +0100, Andi Kleen wrote:
> On Fri, Nov 16, 2007 at 08:00:56AM -0800, Stephane Eranian wrote:
> > No, he is talking about something similar to what was in perfctr.
> > The kernel emulates 64-bit counters in software and that is you
> > get back when you read the counters. If you read via RDPMC, you
> > get 40 bits. To reconstruct the full 64-bit value from user land
> > you need the upper bits. One approach is for the kernel to allow
> > you to remap a page that has the 64-bit (software) counters. With
> > that and a bit of mask/shifting you can reconstruct the full value.
>
> You mean the page contains the upper [40;63] bits?
>
> Sounds reasonable, although I don't remember seeing that when I looked
> at the perfmon code last.
>
I dropped that quite some time ago.
> >
> > > I'm considering that an essential feature too. I wasn't aware
> > > it was dropped.
> > >
> > What I dropped is the cr4.pce enabled for self-monitoring sessions.
>
> That sounds bad.
That's because you said you were going to enable it system-wide by default.
>
> > Perfmon2 allows you to have an in-kernel sampling buffer. The idea is
>
> ... you also didn't say *why* that is needed.
>
Do you question why Oprofile has one ;->
But I am happy to explain.
With sampling, you want to record information about the execution of a
thread at some interval. The interval could be expressed as time or
number of occurences of an PMU event.
Typically you get a notification. Then you need to collect certain
information about the execution. Typically you record the instruction
pointer (e.g. Oprofile), but you may want to record the value of other
counters, PMU registers or other HW/SW resources. While you're doing
this monitoring is typically stopped so you get a consitent view. After
you're done recording you need to re-arm the sampling period. If you
use event-based sampling, you need to reprogram the counter(s). Then
you resume monitoring. You have to repeat this process for each sample
regardless of whether you are self-monitoring, monitoring another thread,
or monitoring a CPU.
Such sequence of operations is quite expensive, especially in the case
where you are monitoring another thread, because it incurs at least
a couple of context switches per sample in addition to the various
register manipulations and syscalls.
The idea with the kernel sampling buffer is that you amortize the
cost of notification to userland over LOTS of samples. On counter
overflow, the kernel records the samples on your behalf. There is
no context switch, samples are always recorded in the context on
the monitored thread.
Now, you need a bit more information for this to work correctly
because the kernel records on *your behalf*, thus
you need to express:
- what you want to see recorded
- the value to reload into the overflowed counter(s)
so the kernel can re-arm the next period.
Because you have multiple counters, you may use them for sampling
periods, i.e., overlap sampling measurements. That is something
done very frequently.
For instance, the q-syscollect tool that D. Mosberger wrote, is
overlapping elapsed cycles and branch trace buffer (BTB) sampling
to collect, in *one* run, a flat profile and a statistical call graph.
Depending on which counter overflowed, you may one to record
different things. For instance, the flat profile requires
just the instruction pointer. But for the BTB, the buffer
is implemented by PMU registers, thus you need to record
them (16 total). You don't want to record all register possible
in each sample: reading PMU register is costly and you
want to maximize buffer space usage.
As you can see, you need to express per counter:
- what other resources to record when it overflows
- the value to reload into the counter after overflow
In perfmon2 this information is passed by the pfm_write_pmds()
call. You can say:
PMD2.value = -5000; /* initial period */
PMD2.reset = -2000; /* repeat period */
PMD2.smpl_pmds = 0xf0; /* to record PMD4-7 on overlow */
Now, it is important to note that this is not just on Itanium
that we need this kind of flexibility. Given that you mentioned
IBS, I will use it as a non-X86 example. IBS is implemented
using PMU registers, 10 to be precise. There is no need for a
custom sampling format to support that, the default format is
sufficient.
The default sampling format does record more than the instruction
pointer. Each sample has a fixed size header including the instruction
pointer but also PID/TID/CPU. But it also has a variable size body
where the kernel stores the other registers you want to record
in each sample based on which counter overflowed. So for IBS, it
would store the 10 data registers.
> Can you give a concrete use case for something that cannot be done
> without custom buffer formats?
>
PEBS is one. You would have to special this. PEBS includes
the instruction pointer + values of all registers. You'd have
to devise a scheme to allocate the PEBS buffer and then on
PEBS interrupt you'd have to copy the data into the other
buffer. Not counting on the fact that PEBS between P4 and Intel
Core 2 different and that this is an Intel X86 only feature.
I think this is better isolated into X86 specific code and
into a kernel module because it does not work on all models.
> > Using this mechanism, for instance, we were able to connect the
> > Oprofile kernel code to perfmon2 on Itanium with a 100 lines of
> > code. The exact same approach would also work on X86 Oprofile as well.
>
> The existing oprofile code works already fine on x86, no real
> need for another one.
>
Can you support advanced monitoring like I just described above?
> > > e.g. PEBS and so on pretty much fix the in memory sample format in hardware,
> > > so they only way to get a custom format would be to use a separate buffer.
> > >
> >
> > This is also how we support PEBS because, as you said, the format of the
> > samples is not under your control. if you want zero-copy PEBS support,
> > you have to follow the PEBS format.
>
> Exactly that makes the support for random custom buffers questionable.
>
Quite the contrary, without the custom buffers we would have horrible
hacks to support PEBS.
> e.g. as I can see the main advantage of perfmon over existing setups
> is that it support PEBS etc., but with your custom buffer formats which
> are by definition incompatible with PEBS you would negate that advantage
> again.
>
I think you are confused about the terms here. The custom sampling
format is a kernel-level interface to plug-in kernel modules
which implement custom sampling formats. PEBS requires a custom
format because you do not control what is recorded. Thus what
you do is you *create* a format whose sample format *maps* the PEBS
format exactly. And that format is *different* from the one used
by the default sampling format.
> Ok IBS will probably need some special handling.
>
No, it does not. No sampling format, no extra tricks.
> > Yes, you could do that without changing the core implementation of
> > perfmon2.
>
> Why this insistence against changing anything?
>
Because hardware is very diverse and is changing rapidly.
Changing the kernel is difficult and it takes a very long time
for new features to reach end-users. You are not without knowing
that most users do not download their production kernels from
kernel.org. Monitoring is not just reserved for core developers
and it is also very useful on production systems to diagnose
performance problems.
--
-Stephane
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 16:28 ` Andi Kleen
@ 2007-11-16 17:13 ` William Cohen
2007-11-16 21:56 ` Stephane Eranian
2007-11-16 17:36 ` Stephane Eranian
1 sibling, 1 reply; 19+ messages in thread
From: William Cohen @ 2007-11-16 17:13 UTC (permalink / raw)
To: Andi Kleen
Cc: Stephane Eranian, Philip Mucci, Andrew Morton, Greg KH,
Robert Richter, linux-kernel
Andi Kleen wrote:
> On Fri, Nov 16, 2007 at 08:00:56AM -0800, Stephane Eranian wrote:
>> No, he is talking about something similar to what was in perfctr.
>> The kernel emulates 64-bit counters in software and that is you
>> get back when you read the counters. If you read via RDPMC, you
>> get 40 bits. To reconstruct the full 64-bit value from user land
>> you need the upper bits. One approach is for the kernel to allow
>> you to remap a page that has the 64-bit (software) counters. With
>> that and a bit of mask/shifting you can reconstruct the full value.
>
> You mean the page contains the upper [40;63] bits?
>
> Sounds reasonable, although I don't remember seeing that when I looked
> at the perfmon code last.
Upper 32-bit ([32:63]). On many implementations the only lower 32-bit are
available in the register. the 32:40 bits in several processor implementation of
x86 processors can not be set to bit outside of sign extension of bit 32. On
other processor implementations the event counters are only 32-bit in width.
>
>>> I'm considering that an essential feature too. I wasn't aware
>>> it was dropped.
>>>
>> What I dropped is the cr4.pce enabled for self-monitoring sessions.
>
> That sounds bad.
>
>> Perfmon2 allows you to have an in-kernel sampling buffer. The idea is
>
> ... you also didn't say *why* that is needed.
>
> Can you give a concrete use case for something that cannot be done
> without custom buffer formats?
>
>> Using this mechanism, for instance, we were able to connect the
>> Oprofile kernel code to perfmon2 on Itanium with a 100 lines of
>> code. The exact same approach would also work on X86 Oprofile as well.
>
> The existing oprofile code works already fine on x86, no real
> need for another one.
OProfile is very useful in many cases, but it only perform sampling. If one want
to take a look at the number events a specific section of code causes, one can't
really do that with oprofile. The counters are running systemwide, not per
thread. For some experiments developers really like to have per thread counters.
The rewrite of oprofile to use the perfmon code was to consolidate code using
the performance monitoring hardware. Use one interface for accessing the
performance monitoring hardware rather than have one for sampling and another
for virtualizing the counters on a per thread basis.
>>> e.g. PEBS and so on pretty much fix the in memory sample format in hardware,
>>> so they only way to get a custom format would be to use a separate buffer.
>>>
>> This is also how we support PEBS because, as you said, the format of the
>> samples is not under your control. if you want zero-copy PEBS support,
>> you have to follow the PEBS format.
>
> Exactly that makes the support for random custom buffers questionable.
>
> e.g. as I can see the main advantage of perfmon over existing setups
> is that it support PEBS etc., but with your custom buffer formats which
> are by definition incompatible with PEBS you would negate that advantage
> again.
>
> Ok IBS will probably need some special handling.
>
>> Yes, you could do that without changing the core implementation of
>> perfmon2.
>
> Why this insistence against changing anything?
>
> -Andi
So the alternative approach is to write a new device driver for each of the new
performance monitoring mechanisms, e.g. one for PEBS and another for IBS?
One of the reason for the custom sample buffers was to avoid having an expensive
user-space signal for a process to record some simple pieces of data each time
the data becomes available. For the oprofile port to the perfmon2 custom buffer
mechanism the instruction pointer and the counter that overflowed are
recorded. The buffer can be processed in one large chunk by userspace, reducing
overhead. In essence the current implementation of OProfile in the mainline
kernels has a custom buffer mechanism.
-Will
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 16:00 ` Stephane Eranian
@ 2007-11-16 16:28 ` Andi Kleen
2007-11-16 17:13 ` William Cohen
2007-11-16 17:36 ` Stephane Eranian
0 siblings, 2 replies; 19+ messages in thread
From: Andi Kleen @ 2007-11-16 16:28 UTC (permalink / raw)
To: Stephane Eranian
Cc: Andi Kleen, Philip Mucci, Andrew Morton, Greg KH, William Cohen,
Robert Richter, linux-kernel
On Fri, Nov 16, 2007 at 08:00:56AM -0800, Stephane Eranian wrote:
> No, he is talking about something similar to what was in perfctr.
> The kernel emulates 64-bit counters in software and that is you
> get back when you read the counters. If you read via RDPMC, you
> get 40 bits. To reconstruct the full 64-bit value from user land
> you need the upper bits. One approach is for the kernel to allow
> you to remap a page that has the 64-bit (software) counters. With
> that and a bit of mask/shifting you can reconstruct the full value.
You mean the page contains the upper [40;63] bits?
Sounds reasonable, although I don't remember seeing that when I looked
at the perfmon code last.
>
> > I'm considering that an essential feature too. I wasn't aware
> > it was dropped.
> >
> What I dropped is the cr4.pce enabled for self-monitoring sessions.
That sounds bad.
> Perfmon2 allows you to have an in-kernel sampling buffer. The idea is
... you also didn't say *why* that is needed.
Can you give a concrete use case for something that cannot be done
without custom buffer formats?
> Using this mechanism, for instance, we were able to connect the
> Oprofile kernel code to perfmon2 on Itanium with a 100 lines of
> code. The exact same approach would also work on X86 Oprofile as well.
The existing oprofile code works already fine on x86, no real
need for another one.
> > e.g. PEBS and so on pretty much fix the in memory sample format in hardware,
> > so they only way to get a custom format would be to use a separate buffer.
> >
>
> This is also how we support PEBS because, as you said, the format of the
> samples is not under your control. if you want zero-copy PEBS support,
> you have to follow the PEBS format.
Exactly that makes the support for random custom buffers questionable.
e.g. as I can see the main advantage of perfmon over existing setups
is that it support PEBS etc., but with your custom buffer formats which
are by definition incompatible with PEBS you would negate that advantage
again.
Ok IBS will probably need some special handling.
> Yes, you could do that without changing the core implementation of
> perfmon2.
Why this insistence against changing anything?
-Andi
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 15:15 ` Andi Kleen
@ 2007-11-16 16:00 ` Stephane Eranian
2007-11-16 16:28 ` Andi Kleen
2007-11-16 17:51 ` dean gaudet
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Stephane Eranian @ 2007-11-16 16:00 UTC (permalink / raw)
To: Andi Kleen
Cc: Philip Mucci, Andrew Morton, Greg KH, William Cohen,
Robert Richter, linux-kernel, Stephane Eranian
Andi,
On Fri, Nov 16, 2007 at 04:15:56PM +0100, Andi Kleen wrote:
> My impression so far is that you're not quite sure what you want,
> otherwise you would be more concrete.
>
> > - A feature which was dropped earlier by Stefane (only to satiate
> > LKML), we consider
> > very important. Allowing one tomapping of the kernels view of the
> > PMD's, allowing
> > user-space access to full 64-bit counts, if the architecture
> > supports a user-level read instruction.
>
> You mean returning the register number for RDPMC or equivalent
> and a way to enable it for ring 3 access?
>
No, he is talking about something similar to what was in perfctr.
The kernel emulates 64-bit counters in software and that is you
get back when you read the counters. If you read via RDPMC, you
get 40 bits. To reconstruct the full 64-bit value from user land
you need the upper bits. One approach is for the kernel to allow
you to remap a page that has the 64-bit (software) counters. With
that and a bit of mask/shifting you can reconstruct the full value.
> I'm considering that an essential feature too. I wasn't aware
> it was dropped.
>
What I dropped is the cr4.pce enabled for self-monitoring sessions.
> Yes it is for everybody. I've been rather questioning if the slow
> ways (complicated syscalls) to get the counter information are really
> needed.
>
> > referring to the concept of eventsets. Having multiplexing is
> > important.
>
> Why is it important?
>
Read my follow-up message to Dean's message.
> > - Custom sample formats would be considered not often used in our
> > community, largely
> > because the tools run on all HPC/Linux architectures. PAPI uses the
> > default sample
> > format which has been sufficient for our needs. However, the lack of
> > custom sample
> > formats preclude the dev of the specialized tools that access the
> > sampling
> > hardware as found on the IA64, PPC64, the Barcelona and the SiCortex
> > node chip.
> > pfmon exports this functionality quite well, and it does get used.
>
> What do you mean with custom sample formats exactly? What information
> do you want in there? And why?
>
Perfmon2 allows you to have an in-kernel sampling buffer. The idea is
not new, Oprofile has this as well. The problem here is that if the
buffer is in the kernel the format of the samples is fixed and it
should have to. Tools may want to record samples in different formats
and as you said some may need extra information gathered in the kernel.
Some may want to aggregate samples in the kernel (Oprofile used to
do that), some may want to use a double-buffer approach to minimize
blind spots, others may simply use the counter overflow mechanism to
record something that is non-PMU related, e.g, kernel call stack.
I have built such a module and it was quite interesting to collect
the call stack when you hit a last cache level miss.
The idea behind customizable sampling format is simple: extract the
format from the perfmon core and put this into a kernel module. The
core provides a simple registration mechanism and the two communicate
via a set of callbacks.
Perfmon2 comes with a basic default format which works on all
platforms. But it is possible to develop others without having to
patch the kernel nor recompile nor reboot. At its core, each format provides
a handler routine which is called on counter overflow. The handler routine
controls what is recorded, how it is recorded, how it is exported to
userland, and wheher overflow notifications need to be sent.
Using this mechanism, for instance, we were able to connect the
Oprofile kernel code to perfmon2 on Itanium with a 100 lines of
code. The exact same approach would also work on X86 Oprofile as well.
> e.g. PEBS and so on pretty much fix the in memory sample format in hardware,
> so they only way to get a custom format would be to use a separate buffer.
>
This is also how we support PEBS because, as you said, the format of the
samples is not under your control. if you want zero-copy PEBS support,
you have to follow the PEBS format.
I am sure other processors haev and will have hardware buffers as well.
> I can think of one reason why the kernel should add more information
> in a separate buffer (log the instruction bytes so that it can
> be disassembled and a address histogram be generated using the PEBS
> register values), but it is a relatively obscure one and definitely
> not a essential feature. Unfortunately it is also hard to implement
> completely race-free.
>
Yes, you could do that without changing the core implementation of
perfmon2.
--
-Stephane
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-16 9:18 ` Philip Mucci
@ 2007-11-16 15:15 ` Andi Kleen
2007-11-16 16:00 ` Stephane Eranian
` (4 more replies)
0 siblings, 5 replies; 19+ messages in thread
From: Andi Kleen @ 2007-11-16 15:15 UTC (permalink / raw)
To: Philip Mucci
Cc: Andi Kleen, Andrew Morton, Greg KH, Stephane Eranian,
William Cohen, Robert Richter, linux-kernel, papi list
Philip Mucci <mucci@cs.utk.edu> writes:
>
> Yes, although this has been done before. You've got the list below in
> the previous
> emails which should be considered the absolute minimum.
I didn't see a clear list.
My impression so far is that you're not quite sure what you want,
otherwise you would be more concrete.
> - A feature which was dropped earlier by Stefane (only to satiate
> LKML), we consider
> very important. Allowing one tomapping of the kernels view of the
> PMD's, allowing
> user-space access to full 64-bit counts, if the architecture
> supports a user-level read instruction.
You mean returning the register number for RDPMC or equivalent
and a way to enable it for ring 3 access?
I'm considering that an essential feature too. I wasn't aware
it was dropped.
> Getting the counts in a
> couple of dozen cycles
> is ALWAYS a win for us.
Yes it is for everybody. I've been rather questioning if the slow
ways (complicated syscalls) to get the counter information are really
needed.
> referring to the concept of eventsets. Having multiplexing is
> important.
Why is it important?
> - Custom sample formats would be considered not often used in our
> community, largely
> because the tools run on all HPC/Linux architectures. PAPI uses the
> default sample
> format which has been sufficient for our needs. However, the lack of
> custom sample
> formats preclude the dev of the specialized tools that access the
> sampling
> hardware as found on the IA64, PPC64, the Barcelona and the SiCortex
> node chip.
> pfmon exports this functionality quite well, and it does get used.
What do you mean with custom sample formats exactly? What information
do you want in there? And why?
e.g. PEBS and so on pretty much fix the in memory sample format in hardware,
so they only way to get a custom format would be to use a separate buffer.
I can think of one reason why the kernel should add more information
in a separate buffer (log the instruction bytes so that it can
be disassembled and a address histogram be generated using the PEBS
register values), but it is a relatively obscure one and definitely
not a essential feature. Unfortunately it is also hard to implement completely
race-free.
> This is kind of comment that makes the Linux/HPC folks 'somber'. What
> isn't useful, is being dismissive of an entire community that moves a
> heck of a lot of Linux DVD's.
Sorry, but these kind of non technical BS arguments will just make
you be ignored in mainline Linux lands. They might work if you pay
a lot of money to specific Linux companies (do you?), but here
on linux-kernel you have to convince with purely technical arguments.
-Andi
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-14 1:52 ` Andi Kleen
@ 2007-11-16 9:18 ` Philip Mucci
2007-11-16 15:15 ` Andi Kleen
0 siblings, 1 reply; 19+ messages in thread
From: Philip Mucci @ 2007-11-16 9:18 UTC (permalink / raw)
To: Andi Kleen
Cc: Andrew Morton, Greg KH, Stephane Eranian, William Cohen,
Robert Richter, linux-kernel, papi list
Just getting back to this now that SC07 is finally over...
On Nov 13, 2007, at 5:52 PM, Andi Kleen wrote:
> On Tue, Nov 13, 2007 at 04:28:52PM -0800, Philip Mucci wrote:
>> I know you don't want to hear this, but we actually use all of the
>> features of perfmon, because a) we wanted to use the best methods
>
> That is hard to believe.
>
You are welcome to download the code and some of the tools and verify
the functionality yourself. It might be a good exercise.
> But let's go for it temporarily for the argument.
>
> Can you instead prioritize features. What is most essential, what is
> important, what is just nice to have, what is rarely used?
Yes, although this has been done before. You've got the list below in
the previous
emails which should be considered the absolute minimum.
- A feature which was dropped earlier by Stefane (only to satiate
LKML), we consider
very important. Allowing one tomapping of the kernels view of the
PMD's, allowing
user-space access to full 64-bit counts, if the architecture
supports a user-level read instruction. Getting the counts in a
couple of dozen cycles
is ALWAYS a win for us. This is because the HPC community is mainly
interested in
self-monitoring, not third-party, because the former can be easily
associated with
context in the app through instrumentation in various forms.
- Kernel multiplexing is very nice to have, saves you tremendous
overhead at user
level. PAPI has an implementation in user-space for the platforms
that don't support
this. The flexibility of the current implementation is not exploited,
here I'm
referring to the concept of eventsets. Having multiplexing is
important. Being able
to allocate/reallocate eventsets and the threshold of individual
eventsets is just nice
to have.
- Custom sample formats would be considered not often used in our
community, largely
because the tools run on all HPC/Linux architectures. PAPI uses the
default sample
format which has been sufficient for our needs. However, the lack of
custom sample
formats preclude the dev of the specialized tools that access the
sampling
hardware as found on the IA64, PPC64, the Barcelona and the SiCortex
node chip.
pfmon exports this functionality quite well, and it does get used.
>> - providing virtualized 64-bit counters per-thread
>> - providing notification (buffered or non) on interrupt/overflow of
>> the above.
>
> Ok that makes sense and should be possible with a reasonable simple
> interface.
Well that's good news. The above is what we have used via the PerfCtr
set of
patches for a long time. It wasn't quite enough, but it got the job
done.
>> If you'd like to outline further what you'd like to hear from the
>> community, I can arrange that. I seem to remember going through this
>> once before, but I'd be happy to do it again. For reference, here's a
>> quick list from memory of some of the tools in active use and built
>> on this infrastructure. These are used heavily around the globe.
>
> Please list concrete features, throwing around random names is not
> useful.
>
This is kind of comment that makes the Linux/HPC folks 'somber'. What
isn't useful, is being dismissive of an entire community that moves a
heck of a lot of Linux DVD's. >80% of the top500 list is Linux these
days (compared to < 10% just a few years back), and so is the bulk of
the HPC clusters in the marketplace, large and small. (ref those
expensive IDC reports) These are tools used daily in HPC centers and
industry around the globe, doing real work for folks that buy a lot
of hardware and actually pay for Linux distributions. These tools
seem random to you, because you haven't spent any time educating
yourself about this community since we first talked about this >3
years back when considering PerfCtr. Really, there are dozens of HPC/
Linux events held every year around the world of varying sizes;
should you ever attend one, this all might not seem so 'random'. And
yes, you would be warmly welcomed.
-Phil
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-13 18:32 ` Stephane Eranian
@ 2007-11-13 22:29 ` Christoph Hellwig
0 siblings, 0 replies; 19+ messages in thread
From: Christoph Hellwig @ 2007-11-13 22:29 UTC (permalink / raw)
To: Stephane Eranian
Cc: Robert Richter, Andi Kleen, gregkh, akpm, linux-kernel,
perfmon2-devel, perfmon
On Tue, Nov 13, 2007 at 10:32:39AM -0800, Stephane Eranian wrote:
> It would obvisouly cause a lot of troubles to existing perfmon libraries and
> applications (e.g. PAPI). It would also be fairly tricky to do because you'd
> have to make sure that in the beginning, you leave enough flexiblity such that
> you can add the rest while maintaining total backward compatibility. But given
> that we already have the full solution, it could just be a matter of dropping
> features without disrupting the user level API.
There no way we'll keep this completely idiotic userland API. If people start
to use out of tree APIs they can pretty much expect that they're not going
to stay around. And in this case they most certainly won't.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: perfmon2 merge news
2007-11-13 15:17 ` perfmon2 merge news Robert Richter
2007-11-13 15:35 ` [perfmon2] " William Cohen
@ 2007-11-13 18:32 ` Stephane Eranian
2007-11-13 22:29 ` Christoph Hellwig
1 sibling, 1 reply; 19+ messages in thread
From: Stephane Eranian @ 2007-11-13 18:32 UTC (permalink / raw)
To: Robert Richter
Cc: Andi Kleen, gregkh, akpm, linux-kernel, perfmon2-devel, perfmon
Hello,
On Tue, Nov 13, 2007 at 04:17:18PM +0100, Robert Richter wrote:
> On 10.11.07 21:32:39, Andi Kleen wrote:
> > It would be really good to extract a core perfmon and start with
> > that and then add stuff as it makes sense.
> >
> > e.g. core perfmon could be something simple like just support
> > to context switch state and initialize counters in a basic way
> > and perhaps get counter numbers for RDPMC in ring3 on x86[1]
>
> Perhaps a core could provide also as much functionality so that
> Perfmon can be used with an *unpatched* kernel using loadable modules?
> One drawback with today's Perfmon is that it can not be used with a
> vanilla kernel. But maybe such a core is by far too complex for a
> first merge.
>
Note that I am not against the gradual approach such as:
- system-wide only counting
- per-thread counting
- user-level sampling support
- in-kernel sampling buffer support
- in-kernel customizable sampling buffer formats via modules
- event set multiplexing
- PMU description modules
It would obvisouly cause a lot of troubles to existing perfmon libraries and
applications (e.g. PAPI). It would also be fairly tricky to do because you'd
have to make sure that in the beginning, you leave enough flexiblity such that
you can add the rest while maintaining total backward compatibility. But given
that we already have the full solution, it could just be a matter of dropping
features without disrupting the user level API. Of course there would be a bigger
burden on the maintainer because he would have two trees to maintain but I think
that is already commonplace in many of the kernel-related projects.
Let's take a simple example. The set of syscalls necessary to control a system-wide
monitoring session is exactly the same as for a per-thread session. The difference is
just a flag when the session is created. Thus, we could keep the same set of syscalls,
but only accept system-wide sessions. Later on, when we add per-thread, we would just
have to expose the per-thread session flag.
Having said that, does not mean that this is necessarily what we will do. I am just
try to present my understanding of the comments from Andrew, Andi and others.
I think that going with a kernel module will not address the 'complexity/bloat' perception
that some people have. There is a logic to that, I did not just wakeup one day saying
'wouldn't it be cool to add set multiplexing?'. There was a true need expressed by users or
developers and it was justfied by what the hardware offered then. This unfortunately still
stands today. I admit that justification is not necessarily spelled out clearly in the code. So
I understand most of those worries and I am trying to figure out how we could best address them.
--
-Stephane
^ permalink raw reply [flat|nested] 19+ messages in thread
* perfmon2 merge news
2007-11-10 20:32 ` Andi Kleen
@ 2007-11-13 15:17 ` Robert Richter
2007-11-13 15:35 ` [perfmon2] " William Cohen
2007-11-13 18:32 ` Stephane Eranian
0 siblings, 2 replies; 19+ messages in thread
From: Robert Richter @ 2007-11-13 15:17 UTC (permalink / raw)
To: Andi Kleen; +Cc: gregkh, akpm, eranian, linux-kernel, perfmon2-devel
On 10.11.07 21:32:39, Andi Kleen wrote:
> It would be really good to extract a core perfmon and start with
> that and then add stuff as it makes sense.
>
> e.g. core perfmon could be something simple like just support
> to context switch state and initialize counters in a basic way
> and perhaps get counter numbers for RDPMC in ring3 on x86[1]
Perhaps a core could provide also as much functionality so that
Perfmon can be used with an *unpatched* kernel using loadable modules?
One drawback with today's Perfmon is that it can not be used with a
vanilla kernel. But maybe such a core is by far too complex for a
first merge.
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2007-11-18 0:35 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-17 17:19 perfmon2 merge news Patrick DEMICHEL
2007-11-18 0:35 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2007-11-07 0:34 [PATCH] fix up perfmon to build on -mm Greg KH
2007-11-09 20:06 ` Andrew Morton
2007-11-09 21:38 ` Greg KH
2007-11-10 20:32 ` Andi Kleen
2007-11-13 15:17 ` perfmon2 merge news Robert Richter
2007-11-13 15:35 ` [perfmon2] " William Cohen
2007-11-13 17:55 ` Stephane Eranian
2007-11-13 18:47 ` [perfmon] " Philip Mucci
2007-11-13 18:59 ` Greg KH
2007-11-13 20:07 ` Andrew Morton
2007-11-13 20:36 ` Andi Kleen
2007-11-14 0:28 ` Philip Mucci
2007-11-14 1:52 ` Andi Kleen
2007-11-16 9:18 ` Philip Mucci
2007-11-16 15:15 ` Andi Kleen
2007-11-16 16:00 ` Stephane Eranian
2007-11-16 16:28 ` Andi Kleen
2007-11-16 17:13 ` William Cohen
2007-11-16 21:56 ` Stephane Eranian
2007-11-16 17:36 ` Stephane Eranian
2007-11-16 17:51 ` dean gaudet
2007-11-17 0:29 ` David Miller
2007-11-17 1:07 ` Greg KH
2007-11-16 20:16 ` Philip Mucci
2007-11-17 0:15 ` David Miller
[not found] ` <1d7226b10711161713j675341b7wdb4f050c59a8be0a@mail.gmail.com>
2007-11-17 1:25 ` Greg KH
[not found] ` <1d7226b10711161748n39b7f195q796d85282ef66134@mail.gmail.com>
2007-11-17 2:13 ` Greg KH
2007-11-13 18:32 ` Stephane Eranian
2007-11-13 22:29 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®