search for: futex_atomic_cmpxchg_inatom

Displaying 4 results from an estimated 4 matches for "futex_atomic_cmpxchg_inatom".

2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...to a userspace bitmap through GUP and kmap_atomic() since kernel doesn't have a set_bit_to_user() helper. This will cause issues for the arch that has virtually tagged caches. The way to fix is to keep using userspace virtual address. Fortunately, futex has a cmpxchg to userspace memory helper futex_atomic_cmpxchg_inatomic(). So switch to use it to exchange the userspace bitmap with zero, set the bit and then write it back through put_user(). Note: there're archs (few non popular ones) that don't implement futex helper, we can't log dirty pages. We can fix them on top or simply disable LOG_ALL features...
2019 May 07
4
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...to a userspace bitmap through GUP and kmap_atomic() since kernel doesn't have a set_bit_to_user() helper. This will cause issues for the arch that has virtually tagged caches. The way to fix is to keep using userspace virtual address. Fortunately, futex has a cmpxchg to userspace memory helper futex_atomic_cmpxchg_inatomic(). So switch to use it to exchange the userspace bitmap with zero, set the bit and then write it back through put_user(). Note: there're archs (few non popular ones) that don't implement futex helper, we can't log dirty pages. We can fix them on top or simply disable LOG_ALL features...
2019 May 08
0
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...GUP and > kmap_atomic() since kernel doesn't have a set_bit_to_user() > helper. This will cause issues for the arch that has virtually tagged > caches. The way to fix is to keep using userspace virtual address. > > Fortunately, futex has a cmpxchg to userspace memory helper > futex_atomic_cmpxchg_inatomic(). So switch to use it to exchange the > userspace bitmap with zero, set the bit and then write it back through > put_user(). > > Note: there're archs (few non popular ones) that don't implement > futex helper, we can't log dirty pages. We can fix them on top or > s...
2019 May 07
0
[PATCH RFC] vhost: don't use kmap() to log dirty pages
...set_bit_to_user(int nr, u32 __user *addr) > { > unsigned long log = (unsigned long)addr; > struct page *page; > + u32 old_log; > int r; > > r = get_user_pages_fast(log, 1, 1, &page); > if (r < 0) > return r; > BUG_ON(r != 1); > + > + r = futex_atomic_cmpxchg_inatomic(&old_log, addr, 0, 0); > + if (r < 0) > + return r; > + > + old_log |= 1 << nr; > + r = put_user(old_log, addr); > + if (r < 0) > + return r; And this just looks odd to me. Why do we need the futex call to replace a 0 value with 0? Why does it still dupli...