Re: [PATCH 2/3] x86 perf: Protect LBR msrs accessing against potential #GP

From: Peter Zijlstra
Date: Fri Aug 01 2014 - 14:51:30 EST


On Fri, Aug 01, 2014 at 03:21:20PM +0200, Andi Kleen wrote:
> > > NAK!
> > >
> > > I already said this isn't going to ever happen.
> > >
> > > Both PT and LBR are arbitrated through the kernel, therefore we can (and
> > > must) deny PT when there's existing LBR usage and vice versa.
> > >
> > > We will not hijack resources like this full stop end of story.
> > >
> > > Fuck hardware/BIOS, they should _NOT_ be touching this.
> > >
> > > The 3 people in the world with access to an x86 hardware debugger had
> > > better be competent and know WTF they're doing and the BIOS can just
> > > piss off right now, they should not be touching this _EVER_.
>
>
> So you realize that hardware level debugging becomes impossible
> if everyone starts using perf?

That only becomes a problem if you need to hardware debug something that
uses LBR/BTS (in the current state or things).

Now, by doing the patch you did, you already change behaviour by having
PT enabled, and therefore you already couldn't.

So this is an explicit blind spot for the hardware debugger, that seems
like a bad idea anyhow.

The things is, with or without this patch you cannot debug LBR using
software.

> I dont know how anyone can construct essentially sabotaging powerful
> debugging techniques ever as a good thing. In the end it'll just
> lead to more buggy software (and likely hardware) for everyone.

How about you see it as an attempt to improve things by not having
arbitrary and limiting blind spots like that?

A hardware debugger should be able to debug everything, including LBR
using software.

> > I yelled at BIOS engineers over their PMU usage and $vendor added a BIOS
> > knob to disable that, I'll yell at BIOS engineers again, just give me
> > their number.
> >
> > Really, say NO already.
>
> Ok, so no technical reason, merely a "me vs you" power play.

Clearly you forgot the discussion we had back then, you want me to find
you a link or do you think you can Google it yourself? I'm not the only
one who thinks its a terrible idea for the BIOS to involve itself in
these things.

> Thank you for not stating that earlier and wasting everyone's time.

Oh, so you thing its entirely reasonable for a BIOS to use PMU features
then? I suppose you do since you wrote that silly document back then
about 'sharing' things.

We should be limiting the things the BIOS does, because the BIOS will
get it wrong and then we have to spend ages working around it. There's
enough BIOS wreckage to deal with, don't encourage them to make more.


Attachment: pgpMB3Y66pmpp.pgp
Description: PGP signature