Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fix from Radim Krčmář:
"Fix PPC HV host crash that can occur as a result of resizing the guest
hashed page table"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: PPC: Book3S HV: Fix exclusion between HPT resizing and other HPT updates

+29 -10
+10
arch/powerpc/kvm/book3s_64_mmu_hv.c
··· 646 646 hnow_v = hpte_new_to_old_v(hnow_v, hnow_r); 647 647 hnow_r = hpte_new_to_old_r(hnow_r); 648 648 } 649 + 650 + /* 651 + * If the HPT is being resized, don't update the HPTE, 652 + * instead let the guest retry after the resize operation is complete. 653 + * The synchronization for hpte_setup_done test vs. set is provided 654 + * by the HPTE lock. 655 + */ 656 + if (!kvm->arch.hpte_setup_done) 657 + goto out_unlock; 658 + 649 659 if ((hnow_v & ~HPTE_V_HVLOCK) != hpte[0] || hnow_r != hpte[1] || 650 660 rev->guest_rpte != hpte[2]) 651 661 /* HPTE has been changed under us; let the guest retry */
+19 -10
arch/powerpc/kvm/book3s_hv.c
··· 2705 2705 * Hard-disable interrupts, and check resched flag and signals. 2706 2706 * If we need to reschedule or deliver a signal, clean up 2707 2707 * and return without going into the guest(s). 2708 + * If the hpte_setup_done flag has been cleared, don't go into the 2709 + * guest because that means a HPT resize operation is in progress. 2708 2710 */ 2709 2711 local_irq_disable(); 2710 2712 hard_irq_disable(); 2711 2713 if (lazy_irq_pending() || need_resched() || 2712 - recheck_signals(&core_info)) { 2714 + recheck_signals(&core_info) || 2715 + (!kvm_is_radix(vc->kvm) && !vc->kvm->arch.hpte_setup_done)) { 2713 2716 local_irq_enable(); 2714 2717 vc->vcore_state = VCORE_INACTIVE; 2715 2718 /* Unlock all except the primary vcore */ ··· 3081 3078 3082 3079 static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 3083 3080 { 3084 - int n_ceded, i; 3081 + int n_ceded, i, r; 3085 3082 struct kvmppc_vcore *vc; 3086 3083 struct kvm_vcpu *v; 3087 3084 ··· 3135 3132 3136 3133 while (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE && 3137 3134 !signal_pending(current)) { 3135 + /* See if the HPT and VRMA are ready to go */ 3136 + if (!kvm_is_radix(vcpu->kvm) && 3137 + !vcpu->kvm->arch.hpte_setup_done) { 3138 + spin_unlock(&vc->lock); 3139 + r = kvmppc_hv_setup_htab_rma(vcpu); 3140 + spin_lock(&vc->lock); 3141 + if (r) { 3142 + kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; 3143 + kvm_run->fail_entry.hardware_entry_failure_reason = 0; 3144 + vcpu->arch.ret = r; 3145 + break; 3146 + } 3147 + } 3148 + 3138 3149 if (vc->vcore_state == VCORE_PREEMPT && vc->runner == NULL) 3139 3150 kvmppc_vcore_end_preempt(vc); 3140 3151 ··· 3266 3249 /* Order vcpus_running vs. hpte_setup_done, see kvmppc_alloc_reset_hpt */ 3267 3250 smp_mb(); 3268 3251 3269 - /* On the first time here, set up HTAB and VRMA */ 3270 - if (!kvm_is_radix(vcpu->kvm) && !vcpu->kvm->arch.hpte_setup_done) { 3271 - r = kvmppc_hv_setup_htab_rma(vcpu); 3272 - if (r) 3273 - goto out; 3274 - } 3275 - 3276 3252 flush_all_to_thread(current); 3277 3253 3278 3254 /* Save userspace EBB and other register values */ ··· 3313 3303 } 3314 3304 mtspr(SPRN_VRSAVE, user_vrsave); 3315 3305 3316 - out: 3317 3306 vcpu->arch.state = KVMPPC_VCPU_NOTREADY; 3318 3307 atomic_dec(&vcpu->kvm->arch.vcpus_running); 3319 3308 return r;