When splitting a huge pmd pte, we need to mark the pmd entry invalid. We
can do that by clearing _PAGE_PRESENT bit. But then that will be taken as a
swap pte. In order to differentiate between the two use a software pte bit
when invalidating.
For regular pte, due to bd5050e38aec ("powerpc/mm/radix: Change pte relax
sequence to handle nest MMU hang") we need to mark the pte entry invalid when
relaxing access permission. Instead of marking pte_none which can result in
different page table walk routines possibly skipping this pte entry, invalidate
it but still keep it marked present.
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/include/asm/book3s/64/pgtable.h | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
The Nest MMU workaround is only needed for RW upgrades. Avoid doing that
for other pte updates.
We also avoid clearing the pte while marking it invalid. This is because other
page table walk will find this pte none and can result in unexpected behaviour
due to that. Instead we clear _PAGE_PRESENT and set the software pte bit
_PAGE_INVALID. pte_present is already updated to check for bot the bits. This
make sure page table walkers will find the pte present and things like
pte_pfn(pte) returns the right value.
Based on the original patch from Benjamin Herrenschmidt [off-list ref]
The Nest MMU workaround is only needed for RW upgrades. Avoid doing that
for other pte updates.
We also avoid clearing the pte while marking it invalid. This is because other
page table walk will find this pte none and can result in unexpected behaviour
due to that. Instead we clear _PAGE_PRESENT and set the software pte bit
_PAGE_INVALID. pte_present is already updated to check for bot the bits. This
make sure page table walkers will find the pte present and things like
pte_pfn(pte) returns the right value.
Based on the original patch from Benjamin Herrenschmidt [off-list ref]
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/mm/pgtable-radix.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-08-23 09:23:29
On Wed, 22 Aug 2018 22:46:05 +0530
"Aneesh Kumar K.V" [off-list ref] wrote:
The Nest MMU workaround is only needed for RW upgrades. Avoid doing that
for other pte updates.
We also avoid clearing the pte while marking it invalid. This is because other
page table walk will find this pte none and can result in unexpected behaviour
due to that. Instead we clear _PAGE_PRESENT and set the software pte bit
_PAGE_INVALID. pte_present is already updated to check for bot the bits. This
make sure page table walkers will find the pte present and things like
pte_pfn(pte) returns the right value.
Based on the original patch from Benjamin Herrenschmidt [off-list ref]
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/mm/pgtable-radix.c | 8 +++++---
This is powerpc/mm/radix, isn't it? Subject says hash.
Could we make this fix POWER9 only and use a RSV bit for it
rather than use up a SW bit? Other than that,
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2018-08-23 11:51:37
On Thu, 2018-08-23 at 19:23 +1000, Nicholas Piggin wrote:
On Wed, 22 Aug 2018 22:46:05 +0530
"Aneesh Kumar K.V" [off-list ref] wrote:
quoted
The Nest MMU workaround is only needed for RW upgrades. Avoid doing that
for other pte updates.
We also avoid clearing the pte while marking it invalid. This is because other
page table walk will find this pte none and can result in unexpected behaviour
due to that. Instead we clear _PAGE_PRESENT and set the software pte bit
_PAGE_INVALID. pte_present is already updated to check for bot the bits. This
make sure page table walkers will find the pte present and things like
pte_pfn(pte) returns the right value.
Based on the original patch from Benjamin Herrenschmidt [off-list ref]
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/mm/pgtable-radix.c | 8 +++++---
This is powerpc/mm/radix, isn't it? Subject says hash.
Could we make this fix POWER9 only and use a RSV bit for it
rather than use up a SW bit? Other than that,
Well, the SW bit is necessary for THP as well isn't it ?
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2018-08-23 11:57:33
Nicholas Piggin [off-list ref] writes:
On Wed, 22 Aug 2018 22:46:05 +0530
"Aneesh Kumar K.V" [off-list ref] wrote:
quoted
The Nest MMU workaround is only needed for RW upgrades. Avoid doing that
for other pte updates.
We also avoid clearing the pte while marking it invalid. This is because other
page table walk will find this pte none and can result in unexpected behaviour
due to that. Instead we clear _PAGE_PRESENT and set the software pte bit
_PAGE_INVALID. pte_present is already updated to check for bot the bits. This
make sure page table walkers will find the pte present and things like
pte_pfn(pte) returns the right value.
Based on the original patch from Benjamin Herrenschmidt [off-list ref]
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/mm/pgtable-radix.c | 8 +++++---
This is powerpc/mm/radix, isn't it? Subject says hash.
I fixed it when applying.
Could we make this fix POWER9 only and use a RSV bit for it
rather than use up a SW bit? Other than that,
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
From: Michael Ellerman <hidden> Date: 2018-08-23 14:18:43
On Wed, 2018-08-22 at 17:16:04 UTC, "Aneesh Kumar K.V" wrote:
When splitting a huge pmd pte, we need to mark the pmd entry invalid. We
can do that by clearing _PAGE_PRESENT bit. But then that will be taken as a
swap pte. In order to differentiate between the two use a software pte bit
when invalidating.
For regular pte, due to bd5050e38aec ("powerpc/mm/radix: Change pte relax
sequence to handle nest MMU hang") we need to mark the pte entry invalid when
relaxing access permission. Instead of marking pte_none which can result in
different page table walk routines possibly skipping this pte entry, invalidate
it but still keep it marked present.
Signed-off-by: Aneesh Kumar K.V <redacted>