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

From: Xiao Guangrong
Date: Thu Jul 19 2012 - 22:56:33 EST


On 07/19/2012 06:15 PM, Avi Kivity wrote:
> 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.
>

Good point. I will do it in the next version, thank you, Avi!

--
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/