[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171128164800.2z3ppusmfp4xyjgn@hirez.programming.kicks-ass.net>
Date: Tue, 28 Nov 2017 17:48:00 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Andy Lutomirski <luto@...capital.net>
Cc: Ingo Molnar <mingo@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H . Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 15/24] x86/mm: Allow flushing for future ASID switches
On Tue, Nov 28, 2017 at 05:39:08PM +0100, Peter Zijlstra wrote:
> @@ -220,7 +221,21 @@ For 32-bit we have the following conventions - kernel is built with
> .macro SWITCH_TO_USER_CR3 scratch_reg:req
> STATIC_JUMP_IF_FALSE .Lend_\@, kaiser_enabled_key, def=1
> mov %cr3, \scratch_reg
> - ADJUST_USER_CR3 \scratch_reg
> + push \scratch_reg
> + andq $(0x7FF), \scratch_reg
> + bt \scratch_reg, PER_CPU_VAR(__asid_flush)
> + jnc .Lnoflush_\@
> +
> + btr \scratch_reg, PER_CPU_VAR(__asid_flush)
> + pop \scratch_reg
> + jmp .Ldo_\@
> +
> +.Lnoflush_\@:
> + pop \scratch_reg
> + ALTERNATIVE "", "bts $63, \scratch_reg", X86_FEATURE_PCID
> +
> +.Ldo_\@:
> + orq $(KAISER_SWITCH_MASK), \scratch_reg
> mov \scratch_reg, %cr3
> .Lend_\@:
> .endm
Ah, I suppose I should also deal with RESTORE_CR3...
Powered by blists - more mailing lists