Re: [RFC PATCH V2] vhost: don't use kmap() to log dirty pages

From: Jason Wang
Date: Mon May 13 2019 - 01:24:17 EST



On 2019/5/10 äå12:48, Jason Wang wrote:

On 2019/5/10 äå10:59, Jason Wang wrote:

 Â r = get_user_pages_fast(log, 1, 1, &page);
OK so the trick is that page is pinned so you don't expect
arch_futex_atomic_op_inuser below to fail. get_user_pages_fast
guarantees page is not going away but does it guarantee PTE won't be
invaidated or write protected?


Good point, then I think we probably need to do manual fixup through fixup_user_fault() if arch_futex_atomic_op_in_user() fail.


This looks like a overkill, we don't need to atomic environment here actually. Instead, just keep pagefault enabled should work. So just introduce arch_futex_atomic_op_inuser_inatomic() variant with pagefault disabled there just for futex should be sufficient.

Thanks


Ok, instead of using tricks, I think we can gracefully fallback to a get_user()/put_user() pair protected by a mutex.

Let me post a non-rfc version for this.

Thanks