Mailing List Archive

[PATCH v2 01/10] KVM: iommu: fix releasing unmapped page
There are two bugs:
- the 'error page' is forgot to be released
[. it is unneeded after commit a2766325cf9f9, for backport, we
still do kvm_release_pfn_clean for the error pfn ]

- guest pages are always released regardless of the unmapped page
(e,g, caused by hwpoison)

Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
---
virt/kvm/iommu.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index c03f1fb..6a67bea 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -107,6 +107,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
*/
pfn = kvm_pin_pages(slot, gfn, page_size);
if (is_error_pfn(pfn)) {
+ kvm_release_pfn_clean(pfn);
gfn += 1;
continue;
}
@@ -300,6 +301,12 @@ static void kvm_iommu_put_pages(struct kvm *kvm,

/* Get physical address */
phys = iommu_iova_to_phys(domain, gfn_to_gpa(gfn));
+
+ if (!phys) {
+ gfn++;
+ continue;
+ }
+
pfn = phys >> PAGE_SHIFT;

/* Unmap address from IO address space */
--
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 01/10] KVM: iommu: fix releasing unmapped page [ In reply to ]
On Fri, Aug 03, 2012 at 03:36:52PM +0800, Xiao Guangrong wrote:
> There are two bugs:
> - the 'error page' is forgot to be released
> [. it is unneeded after commit a2766325cf9f9, for backport, we
> still do kvm_release_pfn_clean for the error pfn ]
>
> - guest pages are always released regardless of the unmapped page
> (e,g, caused by hwpoison)
>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>

Looks good.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 01/10] KVM: iommu: fix releasing unmapped page [ In reply to ]
On 08/03/2012 10:36 AM, Xiao Guangrong wrote:
> There are two bugs:
> - the 'error page' is forgot to be released
> [. it is unneeded after commit a2766325cf9f9, for backport, we
> still do kvm_release_pfn_clean for the error pfn ]
>
> - guest pages are always released regardless of the unmapped page
> (e,g, caused by hwpoison)
>

All applied, thanks.


--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/