Message ID | 58D8BD6D.8080404@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 27/03/2017 09:21, Herongguang (Stephen) wrote: > From f6f0ee6831488bef7af841cb86f3d85a04848fe5 Mon Sep 17 00:00:00 2001 > From: herongguang <herongguang.he@huawei.com> > Date: Mon, 27 Mar 2017 15:08:59 +0800 > Subject: [PATCH] KVM: pci-assign: do not map smm memory slot pages > in vt-d page table > > or VM memory are not put thus leaked in kvm_iommu_unmap_memslots() when > destroy VM. > > This is consistent with current vfio implementation. > --- > virt/kvm/kvm_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 482612b..9018d06 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -1052,7 +1052,7 @@ int __kvm_set_memory_region(struct kvm *kvm, > * changes) is disallowed above, so any other attribute changes > getting > * here can be skipped. > */ > - if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { > + if ((as_id == 0) && ((change == KVM_MR_CREATE) || (change == > KVM_MR_MOVE))) { > r = kvm_iommu_map_pages(kvm, &new); > return r; > } This makes more sense. :) Applied to kvm/master, thanks. Paolo
On 27/03/2017 09:21, Herongguang (Stephen) wrote: > From f6f0ee6831488bef7af841cb86f3d85a04848fe5 Mon Sep 17 00:00:00 2001 > From: herongguang <herongguang.he@huawei.com> > Date: Mon, 27 Mar 2017 15:08:59 +0800 > Subject: [PATCH] KVM: pci-assign: do not map smm memory slot pages > in vt-d page table > > or VM memory are not put thus leaked in kvm_iommu_unmap_memslots() when > destroy VM. > > This is consistent with current vfio implementation. Oops, you forgot a Signed-off-by. Paolo > --- > virt/kvm/kvm_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 482612b..9018d06 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -1052,7 +1052,7 @@ int __kvm_set_memory_region(struct kvm *kvm, > * changes) is disallowed above, so any other attribute changes > getting > * here can be skipped. > */ > - if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { > + if ((as_id == 0) && ((change == KVM_MR_CREATE) || (change == > KVM_MR_MOVE))) { > r = kvm_iommu_map_pages(kvm, &new); > return r; > }
On Mon, Mar 27, 2017 at 8:22 PM, Paolo Bonzini <pbonzini@redhat.com> wrote: > > > On 27/03/2017 09:21, Herongguang (Stephen) wrote: >> From f6f0ee6831488bef7af841cb86f3d85a04848fe5 Mon Sep 17 00:00:00 2001 >> From: herongguang <herongguang.he@huawei.com> >> Date: Mon, 27 Mar 2017 15:08:59 +0800 >> Subject: [PATCH] KVM: pci-assign: do not map smm memory slot pages >> in vt-d page table >> >> or VM memory are not put thus leaked in kvm_iommu_unmap_memslots() when >> destroy VM. >> >> This is consistent with current vfio implementation. > > Oops, you forgot a Signed-off-by. Sorry, I forget this, I'll resend it tomorrow since I am home now. PS, what's your opinion about this (http://www.spinics.net/lists/kvm/msg146914.html)? > > Paolo > >> --- >> virt/kvm/kvm_main.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c >> index 482612b..9018d06 100644 >> --- a/virt/kvm/kvm_main.c >> +++ b/virt/kvm/kvm_main.c >> @@ -1052,7 +1052,7 @@ int __kvm_set_memory_region(struct kvm *kvm, >> * changes) is disallowed above, so any other attribute changes >> getting >> * here can be skipped. >> */ >> - if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { >> + if ((as_id == 0) && ((change == KVM_MR_CREATE) || (change == >> KVM_MR_MOVE))) { >> r = kvm_iommu_map_pages(kvm, &new); >> return r; >> } >
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 482612b..9018d06 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1052,7 +1052,7 @@ int __kvm_set_memory_region(struct kvm *kvm, * changes) is disallowed above, so any other attribute changes getting * here can be skipped. */ - if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { + if ((as_id == 0) && ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE))) { r = kvm_iommu_map_pages(kvm, &new); return r; }
From f6f0ee6831488bef7af841cb86f3d85a04848fe5 Mon Sep 17 00:00:00 2001 From: herongguang <herongguang.he@huawei.com> Date: Mon, 27 Mar 2017 15:08:59 +0800 Subject: [PATCH] KVM: pci-assign: do not map smm memory slot pages in vt-d page table or VM memory are not put thus leaked in kvm_iommu_unmap_memslots() when destroy VM. This is consistent with current vfio implementation. --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)