Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64

From: Andi Kleen
Date: Sat May 15 2004 - 04:10:16 EST


On Fri, May 14, 2004 at 10:37:36PM -0700, Bryan O'Sullivan wrote:
> On Fri, 2004-05-14 at 08:14, Andi Kleen wrote:
>
> > Before merging all that I would definitely recommend some generic
> > module to allocate performance counters. IBM had a patch for this
> > long ago, and it is even more needed now.
>
> That's currently handled in user space, by PAPI (which sits on top of
> perfctr). One reason *not* to do it in the kernel is the bloat it would

That's clearly the wrong place to do it.

> entail; just look at the horrendous mess that is the P4 performance
> counter event selector.

There is no way around that - there are kernel users (like the
nmi watchdog or oprofile) and kernel users cannot be made dependent
on user space modules. Also I think managing of hardware resources is the
primary task of a kernel, nothing that should be delegated to user
space.

The netburst mess can be probably abstracted just into more counters.
The kernel doesn't need to know everything about them, just roughly
how many independent counters there are.

>
> > Why do you check for K8 C stepping? I don't see any code that
> > does anything special with that.
>
> The reason it's interesting at all is that it's the first K8 stepping
> that introduces new performance counter unit masks. The kernel driver
> already passes its notion of what the CPU type is up to userspace.
> (Clearly, userspace could figure this out, since it's just parsing the
> cpuid instruction.)
>
> It also checks the CPU type in a few places internally; it just doesn't
> happen to care internally about K8 stepping C. Thoroughness?

Why does the library caring about that not just read /proc/cpuinfo
to find out?

I sense pointless duplication of mechanism.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/