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 git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fixes from Avi Kivity:
"Two asynchronous page fault fixes (one guest, one host), a powerpc
page refcount fix, and an ia64 build fix."

* git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: ia64: fix build due to typo
KVM: PPC: Book3S HV: Fix refcounting of hugepages
KVM: Do not take reference to mm during async #PF
KVM: ensure async PF event wakes up vcpu from halt

+16 -20
+1 -1
arch/ia64/kvm/kvm-ia64.c
··· 1174 1174 1175 1175 bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) 1176 1176 { 1177 - return irqchip_in_kernel(vcpu->kcm) == (vcpu->arch.apic != NULL); 1177 + return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL); 1178 1178 } 1179 1179 1180 1180 int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
+13 -9
arch/powerpc/kvm/book3s_64_mmu_hv.c
··· 258 258 !(memslot->userspace_addr & (s - 1))) { 259 259 start &= ~(s - 1); 260 260 pgsize = s; 261 + get_page(hpage); 262 + put_page(page); 261 263 page = hpage; 262 264 } 263 265 } ··· 283 281 err = 0; 284 282 285 283 out: 286 - if (got) { 287 - if (PageHuge(page)) 288 - page = compound_head(page); 284 + if (got) 289 285 put_page(page); 290 - } 291 286 return err; 292 287 293 288 up_err: ··· 677 678 SetPageDirty(page); 678 679 679 680 out_put: 680 - if (page) 681 - put_page(page); 681 + if (page) { 682 + /* 683 + * We drop pages[0] here, not page because page might 684 + * have been set to the head page of a compound, but 685 + * we have to drop the reference on the correct tail 686 + * page to match the get inside gup() 687 + */ 688 + put_page(pages[0]); 689 + } 682 690 return ret; 683 691 684 692 out_unlock: ··· 985 979 pa = *physp; 986 980 } 987 981 page = pfn_to_page(pa >> PAGE_SHIFT); 982 + get_page(page); 988 983 } else { 989 984 hva = gfn_to_hva_memslot(memslot, gfn); 990 985 npages = get_user_pages_fast(hva, 1, 1, pages); ··· 998 991 page = compound_head(page); 999 992 psize <<= compound_order(page); 1000 993 } 1001 - if (!kvm->arch.using_mmu_notifiers) 1002 - get_page(page); 1003 994 offset = gpa & (psize - 1); 1004 995 if (nb_ret) 1005 996 *nb_ret = psize - offset; ··· 1008 1003 { 1009 1004 struct page *page = virt_to_page(va); 1010 1005 1011 - page = compound_head(page); 1012 1006 put_page(page); 1013 1007 } 1014 1008
-2
arch/powerpc/kvm/book3s_hv.c
··· 1192 1192 continue; 1193 1193 pfn = physp[j] >> PAGE_SHIFT; 1194 1194 page = pfn_to_page(pfn); 1195 - if (PageHuge(page)) 1196 - page = compound_head(page); 1197 1195 SetPageDirty(page); 1198 1196 put_page(page); 1199 1197 }
+1 -8
arch/x86/kernel/kvm.c
··· 79 79 u32 token; 80 80 int cpu; 81 81 bool halted; 82 - struct mm_struct *mm; 83 82 }; 84 83 85 84 static struct kvm_task_sleep_head { ··· 125 126 126 127 n.token = token; 127 128 n.cpu = smp_processor_id(); 128 - n.mm = current->active_mm; 129 129 n.halted = idle || preempt_count() > 1; 130 - atomic_inc(&n.mm->mm_count); 131 130 init_waitqueue_head(&n.wq); 132 131 hlist_add_head(&n.link, &b->list); 133 132 spin_unlock(&b->lock); ··· 158 161 static void apf_task_wake_one(struct kvm_task_sleep_node *n) 159 162 { 160 163 hlist_del_init(&n->link); 161 - if (!n->mm) 162 - return; 163 - mmdrop(n->mm); 164 164 if (n->halted) 165 165 smp_send_reschedule(n->cpu); 166 166 else if (waitqueue_active(&n->wq)) ··· 201 207 * async PF was not yet handled. 202 208 * Add dummy entry for the token. 203 209 */ 204 - n = kmalloc(sizeof(*n), GFP_ATOMIC); 210 + n = kzalloc(sizeof(*n), GFP_ATOMIC); 205 211 if (!n) { 206 212 /* 207 213 * Allocation failed! Busy wait while other cpu ··· 213 219 } 214 220 n->token = token; 215 221 n->cpu = smp_processor_id(); 216 - n->mm = NULL; 217 222 init_waitqueue_head(&n->wq); 218 223 hlist_add_head(&n->link, &b->list); 219 224 } else
+1
arch/x86/kvm/x86.c
··· 6581 6581 kvm_inject_page_fault(vcpu, &fault); 6582 6582 } 6583 6583 vcpu->arch.apf.halted = false; 6584 + vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 6584 6585 } 6585 6586 6586 6587 bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu)