Re: [PATCH 3/6] KVM: MMU: introduce gfn_to_page_atomic() and gfn_to_pfn_atomic()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Avi Kivity wrote:
> On 06/15/2010 05:46 AM, Xiao Guangrong wrote:
>> Introduce gfn_to_page_atomic() and gfn_to_pfn_atomic(), those
>> functions is fast path and can used in atomic context, the later
>> patch will use those
>>
>>
>> @@ -942,6 +942,41 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
>>   }
>>   EXPORT_SYMBOL_GPL(gfn_to_hva);
>>
>> +static pfn_t hva_to_pfn_atomic(struct kvm *kvm, unsigned long addr)
>> +{
>> +    struct page *page[1];
>> +    int npages;
>> +    pfn_t pfn;
>> +
>> +    npages = __get_user_pages_fast(addr, 1, 1, page);
>> +
>> +    if (unlikely(npages != 1)) {
>> +        if (is_hwpoison_address(addr)) {
>> +            get_page(hwpoison_page);
>> +            return page_to_pfn(hwpoison_page);
>> +        }
>> +        get_page(bad_page);
>> +        return page_to_pfn(bad_page);
>> +    } else
>> +        pfn = page_to_pfn(page[0]);
>> +
>> +    return pfn;
>> +}
>>    
> 
> Too much duplication.  How about putting the tail end of the function in
> a common helper (with an inatomic flag)?
> 

OK, will cleanup it in the next version.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux