Re: [PATCH 1/1] perf tools: Add missing user space support forconfig1/config2

From: Ingo Molnar
Date: Tue Apr 26 2011 - 03:24:14 EST



* Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:

> > Now it has been disabled for unclear reasons.
>
> Also unfortunately only partial. Previously you could at least write the MSR
> from user space through /dev/cpu/*/msr, but now the kernel randomly rewrites
> it if anyone else uses cache events.

Ugh, that's an unbelievable hack - if you hack an active PMU via writing to it
via /dev/cpu/*/msr and it breaks you really get to keep the pieces. There's a
reason why those devices are root only - it's as if you wrote to a filesystem
that is already mounted!

If your user-space twiddling scripts go bad who knows what state the CPU gets
into and you might be reporting bogus bugs. I think writing to those msrs
directly should probably taint the kernel: i'll prepare a patch for that.

> It's very sad we have to go through this.

Not really, it took Peter 10 minutes to come up with an RFC patch to extend the
cache events in a meaningful way - and that was actually more useful to users
than all prior offcore patches combined. So the kernel already won from this
episode.

We are not at all interested in hiding PMU functionality and keeping it
unstructured, and just passing through some opaque raw ABI to user-space.

Thanks,

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