[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9d6917dc-1a6c-a8d4-95fe-f767495f99d3@intel.com>
Date: Mon, 8 Jan 2018 09:20:08 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Willy Tarreau <w@....eu>, linux-kernel@...r.kernel.org,
x86@...nel.org
Cc: tglx@...utronix.de, gnomes@...rguk.ukuu.org.uk,
torvalds@...ux-foundation.org, Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH RFC 4/4] x86/entry/pti: don't switch PGD on tasks holding
flag TIF_NOPTI
Please cc Andy on this stuff. I can't imagine patching entry_64.S at
this point without cc'ing him. *Surely* you didn't even bother to run
get_maintainer.pl on this.
> @@ -214,6 +215,11 @@
> .macro SWITCH_TO_KERNEL_CR3 scratch_reg:req
> ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI
> mov %cr3, \scratch_reg
> +
> + /* if we're already on the kernel PGD, we don't switch */
> + testq $(PTI_SWITCH_PGTABLES_MASK), \scratch_reg
> + jz .Lend_\@
> +
> ADJUST_KERNEL_CR3 \scratch_reg
> mov \scratch_reg, %cr3
> .Lend_\@:
This is an optimization that we can do generally without your feature.
Actually, it would be a welcome bit of benchmarking if you could see if
just this hunk helps your workload.
You touched on it in the description, but this is a *very* clever way to
do what you need without needing to look at the task flag at
user->kernel entry which also happens to be a place you don't have
task_struct mapped. It *greatly* simplifies what this would have to do
otherwise.
That needs calling out specifically though.
Powered by blists - more mailing lists