Re: Linux 5.3-rc7

From: Linus Torvalds
Date: Sat Sep 07 2019 - 15:23:42 EST

On Sat, Sep 7, 2019 at 8:00 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> Ok let me find a testbox to figure out whats wrong there.

Honestly, it looks like we should just revert that commit, since we
never used to clear the LDR bits before either, and the bug it "fixes"
doesn't really seem to be a bug (well, it's a bug in KVM, but that's a
different thing).

And I wouldn't be at all surprised if it confuses some BIOS code.

We use the LDR bits ourselves in smp_get_logical_apicid(), and so
clearing them out seems entirely bogus.

At a guess, it's wakeup_cpu_via_init_nmi() that does that

if (apic->dest_logical == APIC_DEST_LOGICAL)
id = cpu0_logical_apicid;
id = apicid;

and now that we've cleared the APIC LDR bits, we no longer wake the
BSP. We send the NMI to the _old_ APIC ID, but we've overwritten it
with 0 when we put it to sleep, so now nothing happens.

I'm really not clear on why it's a good idea to clear the LDR bits on
shutdown, and commit 558682b52919 ("x86/apic: Include the LDR when
clearing out APIC registers") just looks pointless. And now it has
proven to break some machines.

So why wouldn't we just revert it?