Re: [PATCH 1/1] direct mmio for passthrough - kernel part

Anthony Liguori
2008-04-02T14:59:56Z

Avi Kivity wrote:
> Andrea Arcangeli wrote:
>> On Wed, Apr 02, 2008 at 12:50:50PM +0300, Avi Kivity wrote:
>>
>>> Isn't it faster though? We don't need to pull in the cacheline
>>> containing the struct page anymore.
>>>
>>
>> Exactly, not only that, get_user_pages is likely a bit slower that we
>> need for just kvm pte lookup. GRU uses follow_page directly because it
>> runs in the tlb miss handler, for us instead the tlb miss handler
>> doesn't invoke a page fault unless the spte is non present.
>>
>>
>
> How about this plan?
>
> 0. Merge mmu notifiers

Are mmu-notifiers likely to get pushed when the 2.6.26 window opens up?

> 1. gfn_to_page() -> gfn_to_pfn()
>
> Still keeping the refcount. Change bad_page to kvm_bad_hfn.

kvm_bad_pfn.

> 2. Drop the refcounting from gfn_to_pfn() and from kvm_release_page_*()
>
> Still using get_user_pages() (and dropping the refcount immediately)
>
> Simultaneously, change hack_module.awk to add the refcount back.

This has the dependency on mmu notifiers so step 1 can conceivably be
merged in the absence of mmu notifiers.

Regards,

Anthony Liguori

> 3. Export follow_page() or something based on fast_gup(), and use it
>
> btw, if we change the method we use to read the Linux pte, I'd like to
> get the writable bit out of it. This was, when we create an spte for
> a gpte that is writable and dirty, we can set the spte writable iff
> the Linux pte is writable. This avoids breaking COW unnecessarily.