diff mbox

[v2] KVM: pci-assign: do not map smm memory slot pages

Message ID 58D9B791.2000905@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Herongguang (Stephen) March 28, 2017, 1:08 a.m. UTC
From 8f5b9d2c2944ea7cd8149e9d3b4088f487217d20 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.

Signed-off-by: herongguang <herongguang.he@huawei.com>
---
  virt/kvm/kvm_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini March 28, 2017, 8:09 a.m. UTC | #1
On 28/03/2017 03:08, Herongguang (Stephen) wrote:
> From 8f5b9d2c2944ea7cd8149e9d3b4088f487217d20 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.
> 
> Signed-off-by: herongguang <herongguang.he@huawei.com>
> ---
>  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;
>      }

Thanks!

Paolo
diff mbox

Patch

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;
  	}