Re: [PATCH 07/10] KVM: introduce readonly_fault_pfn

From: Avi Kivity
Date: Thu Jul 19 2012 - 06:15:12 EST


On 07/17/2012 05:44 PM, Xiao Guangrong wrote:
> Introduce readonly_fault_pfn, in the later patch, it indicates failure
> when we try to get a writable pfn from the readonly memslot
>
> +
> inline int kvm_is_mmio_pfn(pfn_t pfn)
> {
> if (pfn_valid(pfn)) {
> @@ -949,13 +952,15 @@ EXPORT_SYMBOL_GPL(kvm_disable_largepages);
>
> int is_error_page(struct page *page)
> {
> - return page == bad_page || page == hwpoison_page || page == fault_page;
> + return page == bad_page || page == hwpoison_page || page == fault_page
> + || page == readonly_fault_page;

All those checks are slow, and get_page(fault_page) etc. isn't very
scalable.

We should move to ERR_PTR() etc. We could use ENOENT, EHWPOISON,
EFAULT, and EROFS for the above, or maybe there are better matches.

> }
> EXPORT_SYMBOL_GPL(is_error_page);
>
> int is_error_pfn(pfn_t pfn)
> {
> - return pfn == bad_pfn || pfn == hwpoison_pfn || pfn == fault_pfn;
> + return pfn == bad_pfn || pfn == hwpoison_pfn || pfn == fault_pfn
> + || pfn == readonly_fault_pfn;
> }

And a similar change here.
--
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/