Skip to content

Commit 00a6a5e

Browse files
committed
Merge tag 'kvm-ppc-fixes-5.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into kvm-master
PPC KVM fix for 5.7 - Fix a regression introduced in the last merge window, which results in guests in HPT mode dying randomly.
2 parents 3bda038 + ae49ded commit 00a6a5e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

arch/powerpc/kvm/book3s_64_mmu_hv.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,18 +604,19 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
604604
*/
605605
local_irq_disable();
606606
ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
607+
pte = __pte(0);
608+
if (ptep)
609+
pte = *ptep;
610+
local_irq_enable();
607611
/*
608612
* If the PTE disappeared temporarily due to a THP
609613
* collapse, just return and let the guest try again.
610614
*/
611-
if (!ptep) {
612-
local_irq_enable();
615+
if (!pte_present(pte)) {
613616
if (page)
614617
put_page(page);
615618
return RESUME_GUEST;
616619
}
617-
pte = *ptep;
618-
local_irq_enable();
619620
hpa = pte_pfn(pte) << PAGE_SHIFT;
620621
pte_size = PAGE_SIZE;
621622
if (shift)

arch/powerpc/kvm/book3s_64_mmu_radix.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,18 +815,19 @@ int kvmppc_book3s_instantiate_page(struct kvm_vcpu *vcpu,
815815
*/
816816
local_irq_disable();
817817
ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
818+
pte = __pte(0);
819+
if (ptep)
820+
pte = *ptep;
821+
local_irq_enable();
818822
/*
819823
* If the PTE disappeared temporarily due to a THP
820824
* collapse, just return and let the guest try again.
821825
*/
822-
if (!ptep) {
823-
local_irq_enable();
826+
if (!pte_present(pte)) {
824827
if (page)
825828
put_page(page);
826829
return RESUME_GUEST;
827830
}
828-
pte = *ptep;
829-
local_irq_enable();
830831

831832
/* If we're logging dirty pages, always map single pages */
832833
large_enable = !(memslot->flags & KVM_MEM_LOG_DIRTY_PAGES);

0 commit comments

Comments
 (0)