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

Avi Kivity
2008-04-03T08:51:36Z

Andrea Arcangeli wrote:
> On Wed, Apr 02, 2008 at 02:16:41PM +0300, Avi Kivity wrote:
>
>> Ugh, there's still mark_page_accessed() and SetPageDirty().
>>
>
> btw, like PG_dirty is only set if the spte is writeable,
> mark_page_accessed should only run if the accessed bit is set in the
> spte. It doesn't matter now as nobody could possibly clear it,

No one will clear it now, but it can start out cleared. This is done on
speculative mmu_set_spte(): when the guest writes into its page tables,
we update the spte speculatively, but the guest may not actually access
that location (for example, due to a page fault clustering).

So the change makes sense even now.

> It still skips an atomic op. Your plan still sounds just fine despite
> the above, infact it sounds too perfect: the awk hack to re-add the
> refcounting when building the external module if CONFIG_MMU_NOTIFIER
> isn't defined is going to be messy, a plain CONFIG_MMU_NOTIFIER in
> kvm.git would be simpler and more robust IMHO even if less perfect :).
>

Worst case, we stick a get_user_pages() inside the memslot setup
function. That makes things not swappable for pre-mmu notifiers, but
completely safe.

I'd rather avoid special casing the core code, whenever possible.

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