Re: [PATCH 00/35 v5] PTI support for x32

From: Joerg Roedel
Date: Wed Apr 18 2018 - 03:36:10 EST


On Mon, Apr 16, 2018 at 09:13:22AM -0700, Linus Torvalds wrote:
> See for example commit 8c06c7740d19 ("x86/pti: Leave kernel text
> global for !PCID") and in particular the performance numbers (that's
> an Atom microserver, but it was chosen due to lack of PCID).

Okay, I checked this on 32 bit and after some small changes I got
identical mappings with GLB set in all page-tables. The changes were:

* Don't change permission bits in pti_clone_kernel_text().
Changing them does not make a difference on 64 bit as
everything cloned in this function is RO anyway. On 32 bit
some areas are mapped RW, so it does make a difference there.

Having different permissions between kernel and user
page-table does also not make sense, because a permission
mismatch in the TLB will cause a re-walk, which is as fast as
not mapping it at all.

* Mapping kernel-text to user-space on 32 bit too. Since there
is no PCID this should improve performance. I have not
measured that yet, but will do so before posting the next
version.

I do some more testing and performance measurements and will send
version 6 of my patches beginning of next week when v4.17-rc2 is out.


Regards,

Joerg