From: Dave Hansen <dave.hansen@linux.intel.com>
To: Dominik Brodowski <linux@dominikbrodowski.net>,
Thomas Gleixner <tglx@linutronix.de>
Cc: luto@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: x86/pti: smp_processor_id() called while preemptible in resume-from-sleep
Date: Sat, 30 Dec 2017 09:51:45 -0800 [thread overview]
Message-ID: <83e0e8b4-9873-b938-5e03-1bfe7ffbf3ff@linux.intel.com> (raw)
In-Reply-To: <20171230153054.GA1604@light.dominikbrodowski.net>
On 12/30/2017 07:30 AM, Dominik Brodowski wrote:
>
> native_cpu_up+0x447/0xa30:
> kern_pcid at arch/x86/include/asm/tlbflush.h:105
> (inlined by) invalidate_user_asid at arch/x86/include/asm/tlbflush.h:342
> (inlined by) __native_flush_tlb at arch/x86/include/asm/tlbflush.h:351
> (inlined by) smpboot_restore_warm_reset_vector at arch/x86/kernel/smpboot.c:146
> (inlined by) do_boot_cpu at arch/x86/kernel/smpboot.c:1022
> (inlined by) native_cpu_up at arch/x86/kernel/smpboot.c:1070
This appears to be this path:
> static inline void smpboot_restore_warm_reset_vector(void)
> {
> unsigned long flags;
>
> /*
> * Install writable page 0 entry to set BIOS data area.
> */
> local_flush_tlb();
The PTI code is now tracking when a given ASID needs to get flushed in a
per-cpu variable, and we use smp_processor_id() in local_flush_tlb() to
do that tracking. That's the *proximate* cause of the new warning. I
think it's actually a quite valid warning that's catching something
questionable.
I'm limited here by not knowing how the warm reset vector actually
works, though. I don't know why we TLB flush at all, much less why we
do it after CMOS_WRITE() in the "setup" path but _before_ CMOS_WRITE()
in the "restore" one. Where do we actually "Install writable page 0
entry to set BIOS data area"? Shouldn't we just be flushing _there_?
But, even _doing_ a TLB flush with preempt enabled and interrupts on
seems wrong to me. It just fundamentally doesn't mean anything because
it can theoretically run anywhere and flush *any* TLB. There might be
some other implicit preempt-thwarting going on here, but I can't find it.
The naive fix here is to just preempt_dis/enable() over the area doing
the flush and the writes to the TRAMPOLINE_* area. That'll definitely
shut up the warnings.
next prev parent reply other threads:[~2017-12-30 17:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-30 13:29 x86/pti: smp_processor_id() called while preemptible in resume-from-sleep Dominik Brodowski
2017-12-30 15:03 ` Thomas Gleixner
2017-12-30 15:30 ` Dominik Brodowski
2017-12-30 17:51 ` Dave Hansen [this message]
2017-12-30 18:21 ` Thomas Gleixner
2017-12-30 18:20 ` Thomas Gleixner
2017-12-30 18:40 ` Linus Torvalds
2017-12-30 19:03 ` Dave Hansen
2017-12-30 19:15 ` Linus Torvalds
2017-12-30 19:32 ` Andy Lutomirski
2017-12-30 19:41 ` Thomas Gleixner
2017-12-30 20:00 ` Linus Torvalds
2017-12-30 20:28 ` Thomas Gleixner
2017-12-30 20:45 ` Linus Torvalds
2017-12-30 20:47 ` Thomas Gleixner
2017-12-30 20:49 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83e0e8b4-9873-b938-5e03-1bfe7ffbf3ff@linux.intel.com \
--to=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=luto@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.