lkml.org 
[lkml]   [2017]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: x86/pti: smp_processor_id() called while preemptible in resume-from-sleep
On Sat, Dec 30, 2017 at 11:03 AM, Dave Hansen
<dave.hansen@linux.intel.com> wrote:
> On 12/30/2017 10:40 AM, Linus Torvalds wrote:
>> The __native_flush_tlb() function looks _very_ broken.
> ...
>> 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...
>
> If someone is calling __native_flush_tlb(), shouldn't they already be in
> a state where they can't be preempted? It's fundamentally a one-cpu
> thing, both the actual CPU TLB flush _and_ the per-cpu variables.

Hmm. I think you're right.

> It seems like we might want to _remove_ the explicit
> preempt_dis/enable() from here:
>
> preempt_disable();
> native_write_cr3(__native_read_cr3());
> preempt_enable();
>
> and add some warnings to ensure it's disabled when we enter
> __native_flush_tlb().

Agreed, that would certainly also be consistent.

The current code that disables preemption only selectively seems
insane to me. Either all or nothing, not this crazy half-way thing.

Linus

\
 
 \ /
  Last update: 2017-12-30 20:16    [W:0.128 / U:7.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site