Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751131AbdL3TlR (ORCPT ); Sat, 30 Dec 2017 14:41:17 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:35173 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750986AbdL3TlQ (ORCPT ); Sat, 30 Dec 2017 14:41:16 -0500 Date: Sat, 30 Dec 2017 20:41:13 +0100 (CET) From: Thomas Gleixner To: Linus Torvalds cc: Dominik Brodowski , Andy Lutomirski , Dave Hansen , LKML , the arch/x86 maintainers Subject: Re: x86/pti: smp_processor_id() called while preemptible in resume-from-sleep In-Reply-To: Message-ID: References: <20171230132927.GA2731@light.dominikbrodowski.net> <20171230153054.GA1604@light.dominikbrodowski.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1075 Lines: 32 On Sat, 30 Dec 2017, Linus Torvalds wrote: > On Sat, Dec 30, 2017 at 10:20 AM, Thomas Gleixner 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