Re: [PATCH 03/20] x86, mce: Add persistent MCE event

Borislav Petkov
2010-11-11T13:35:52Z

On Thu, Nov 11, 2010 at 03:58:25AM -0500, Ingo Molnar wrote:
> > Yep, event enumeration will land in /sysfs eventually but in this case debugfs is
> > used to export the buffers with the events recorded so far to the daemon which
> > mmaps them. And I remember also being mentioned that debugfs will thus be always
> > compiled in because of that.
>
> The event ring-buffer can be mmap()-ed off the fd that sys_perf_event_open() gives.

This is what I did in the first version of the patchset...

> This is what all of tools/perf/ does - it uses debugfs only for even enumeration
> (which will move to sysfs).

but then PeterZ suggested I should use debugfs to export the buffers
and not teach sys_perf_event_open of persistent events. Which is also
the right thing to do (maybe not through debugfs) since we want to have
a single per-cpu buffer with all MCEs in there which even multiple
userspace tools can access. So the question is, how do I mmap() those
properly?

So we either

1) use the perf syscall and teach it about persistent events and it always
returns the same fd whenever a persistent event is requested over its attr
argument;

2) use debugfs (current approach);

3) enable the persistent event and stash its fd in some /sysfs member
which the RAS daemon reads out and mmaps. This last one actually sounds
pretty neat.

4) another idea which I'm missing.

So what do you guys think?

--
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632