Re: [patch V6 04/37] x86: Make hardware latency tracing explicit

From: Thomas Gleixner
Date: Mon May 18 2020 - 04:04:24 EST


Andy Lutomirski <luto@xxxxxxxxxx> writes:
> On Sun, May 17, 2020 at 1:48 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> Remember this is about ensuring that all the state is properly
>> established before any of this instrumentation muck can happen.
>>
>> DR7 handling is specific to #DB and done even before nmi_enter to
>> prevent recursion.
>
> So why is this change needed?

We really want nmi_enter() to be the carefully crafted mechanism which
establishes correct state in whatever strange context the exception
hits. Not more, not less.

Random instrumentation has absolutely no business there and I went a
long way to make sure that this is enforcible by objtool.

Aside of that the tracing which is contained in nmi_enter() is about
taking timestamps for hardware latency detection. If someone runs
hardware latency detection with active break/watchpoints then I really
can't help it.

Thanks,

tglx