[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUp86UPJMcmpuN=YUjYW==BHNPW_yypwnVTkhrOLLFu+Q@mail.gmail.com>
Date: Mon, 4 Dec 2017 14:36:13 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bpetkov@...e.de>,
Greg KH <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...gle.com>,
Hugh Dickins <hughd@...gle.com>,
Brian Gerst <brgerst@...il.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Rik van Riel <riel@...hat.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
David Laight <David.Laight@...lab.com>,
Eduardo Valentin <eduval@...zon.com>, aliguori@...zon.com,
Will Deacon <will.deacon@....com>,
Daniel Gruss <daniel.gruss@...k.tugraz.at>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...nel.org>, michael.schwarz@...k.tugraz.at,
Borislav Petkov <bp@...en8.de>, moritz.lipp@...k.tugraz.at,
richard.fellner@...dent.tugraz.at
Subject: Re: [patch 51/60] x86/mm: Allow flushing for future ASID switches
On Mon, Dec 4, 2017 at 2:34 PM, Dave Hansen <dave.hansen@...el.com> wrote:
> On 12/04/2017 02:22 PM, Andy Lutomirski wrote:
>>> +
>>> + this_cpu_write(cpu_tlbstate.invalidate_other, true);
>>
>> Why do we need this extra variable instead of just looping over all
>> other ASIDs and invalidating them? It would be something like:
>>
>> for (i = 1; i < TLB_NR_DYN_ASIDS; i++) {
>> if (i != this_cpu_read(cpu_tlbstate.loaded_mm_asid))
>> this_cpu_write(cpu_tlbstate.ctxs[i].ctx_id, 0);
>> }
>
> We have loops like this:
>
> for (addr = start; addr < end; addr += PAGE_SIZE)
> flush_tlb_single();
Couldn't we just make those looks more intelligent:
for (...)
flush_tlb_kernelmode_single(...);
if (kpti)
invalidate_asid_other();
(Isn't there only one such look now, in flush_tlb_func_common()?)
--Andy
Powered by blists - more mailing lists