lkml.org 
[lkml]   [2021]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 16/18] KVM: Don't take mmu_lock for range invalidation unless necessary
Date
On 31/03/21 21:47, Sean Christopherson wrote:
> Rereading things, a small chunk of the rwsem nastiness can go away. I don't see
> any reason to use rw_semaphore instead of rwlock_t.

Wouldn't it be incorrect to lock a mutex (e.g. inside *another* MMU
notifier's invalidate callback) while holding an rwlock_t? That makes
sense because anybody that's busy waiting in write_lock potentially
cannot be preempted until the other task gets the mutex. This is a
potential deadlock.

I also thought of busy waiting on down_read_trylock if the MMU notifier
cannot block, but that would also be invalid for the opposite reason
(the down_write task might be asleep, waiting for other readers to
release the task, and the down_read_trylock busy loop might not let that
task run).

> And that's _already_ the worst case since notifications are currently
> serialized by mmu_lock.

But right now notifications are not a single critical section, they're
two, aren't they?

Paolo

\
 
 \ /
  Last update: 2021-03-31 22:43    [W:0.076 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site