Re: x86/pti: smp_processor_id() called while preemptible in resume-from-sleep

From: Thomas Gleixner
Date: Sat Dec 30 2017 - 14:41:20 EST


On Sat, 30 Dec 2017, Linus Torvalds wrote:
> On Sat, Dec 30, 2017 at 10:20 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> So I'd suggest moving the preempt_disable() up to the top of that
> function, regardless of whether we could then remove that seemingly
> stale TLB flush in that crazy
> smpboot_setup/restore_warm_reset_vector() dance...

Regardless of the other bogosity, I did some digging and had to go back
into the 2.1 aera to find the reason for this local_flush_tlb(). That old
code manipulated swapper_pg_dir in do_boot_cpu.

+ local_flush_tlb();
+ SMP_PRINTK(("1.\n"));
+ *((volatile unsigned short *) phys_to_virt(0x469)) = ((unsigned long)stack)>>4;
+ SMP_PRINTK(("2.\n"));
+ *((volatile unsigned short *) phys_to_virt(0x467)) = 0;
+ SMP_PRINTK(("3.\n"));
+
+ maincfg=swapper_pg_dir[0];
+ ((unsigned long *)swapper_pg_dir)[0]=0x102007;

.....

+ swapper_pg_dir[0]=maincfg;
+ local_flush_tlb();

That pagetable fiddling dissappeared long ago, but the flush stayed around
forever.

Thanks,

tglx