All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/10] KVM: PPC: Book3S HV: radix clear pte when unmapping
@ 2018-05-06  7:37 Nicholas Piggin
  2018-05-07  0:32 ` Paul Mackerras
  2018-05-07  2:41 ` Nicholas Piggin
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2018-05-06  7:37 UTC (permalink / raw)
  To: kvm-ppc

The current partition table unmap code clears the _PAGE_PRESENT bit
out of the pte, which leaves pud_huge/pmd_huge true and does not
clear pud_present/pmd_present. This can confuse subsequent page
faults.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kvm/book3s_64_mmu_radix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c
index a6870288c0e0..361f42c8c73e 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c
@@ -584,7 +584,7 @@ int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
 
 	ptep = __find_linux_pte(kvm->arch.pgtable, gpa, NULL, &shift);
 	if (ptep && pte_present(*ptep)) {
-		old = kvmppc_radix_update_pte(kvm, ptep, _PAGE_PRESENT, 0,
+		old = kvmppc_radix_update_pte(kvm, ptep, ~0UL, 0,
 					      gpa, shift);
 		kvmppc_radix_tlbie_page(kvm, gpa, shift);
 		if ((old & _PAGE_DIRTY) && memslot->dirty_bitmap) {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 02/10] KVM: PPC: Book3S HV: radix clear pte when unmapping
  2018-05-06  7:37 [PATCH 02/10] KVM: PPC: Book3S HV: radix clear pte when unmapping Nicholas Piggin
@ 2018-05-07  0:32 ` Paul Mackerras
  2018-05-07  2:41 ` Nicholas Piggin
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2018-05-07  0:32 UTC (permalink / raw)
  To: kvm-ppc

On Sun, May 06, 2018 at 05:37:23PM +1000, Nicholas Piggin wrote:
> The current partition table unmap code clears the _PAGE_PRESENT bit
> out of the pte, which leaves pud_huge/pmd_huge true and does not
> clear pud_present/pmd_present. This can confuse subsequent page
> faults.

I'm OK with the patch, but this sounds like we can have a pmd where
the hardware does not consider it to be a valid translation, but
pmd_huge() and pmd_present() are both true.  That sounds like a
disaster waiting to happen elsewhere -- pmd_present() at least should
be fixed, and possible pmd_huge() also.

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 02/10] KVM: PPC: Book3S HV: radix clear pte when unmapping
  2018-05-06  7:37 [PATCH 02/10] KVM: PPC: Book3S HV: radix clear pte when unmapping Nicholas Piggin
  2018-05-07  0:32 ` Paul Mackerras
@ 2018-05-07  2:41 ` Nicholas Piggin
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Piggin @ 2018-05-07  2:41 UTC (permalink / raw)
  To: kvm-ppc

On Mon, 7 May 2018 10:32:52 +1000
Paul Mackerras <paulus@ozlabs.org> wrote:

> On Sun, May 06, 2018 at 05:37:23PM +1000, Nicholas Piggin wrote:
> > The current partition table unmap code clears the _PAGE_PRESENT bit
> > out of the pte, which leaves pud_huge/pmd_huge true and does not
> > clear pud_present/pmd_present. This can confuse subsequent page
> > faults.  
> 
> I'm OK with the patch, but this sounds like we can have a pmd where
> the hardware does not consider it to be a valid translation, but
> pmd_huge() and pmd_present() are both true.  That sounds like a
> disaster waiting to happen elsewhere -- pmd_present() at least should
> be fixed, and possible pmd_huge() also.

I don't know that we can after this patch. I can't see where that
would happen.

If you mean you just want to test just PAGE_PRESENT just in case
there are similar bugs, then sure I don't see a problem with that.

Thanks,
Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-07  2:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-06  7:37 [PATCH 02/10] KVM: PPC: Book3S HV: radix clear pte when unmapping Nicholas Piggin
2018-05-07  0:32 ` Paul Mackerras
2018-05-07  2:41 ` Nicholas Piggin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.