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

Avi Kivity
2008-04-02T10:59:46Z

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

1. gfn_to_page() -> gfn_to_pfn()

Still keeping the refcount. Change bad_page to kvm_bad_hfn.

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.

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.

--
error compiling committee.c: too many arguments to function