lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] locking/qrwlock: Give priority to readers with irqs disabled to prevent deadlock
On Wed, Apr 04, 2018 at 06:24:39PM +0300, Kirill Tkhai wrote:
> The following situation leads to deadlock:
>
> [task 1] [task 2] [task 3]
> kill_fasync() mm_update_next_owner() copy_process()
> spin_lock_irqsave(&fa->fa_lock) read_lock(&tasklist_lock) write_lock_irq(&tasklist_lock)
> send_sigio() <IRQ> ...
> read_lock(&fown->lock) kill_fasync() ...
> read_lock(&tasklist_lock) spin_lock_irqsave(&fa->fa_lock) ...
>
> Task 1 can't acquire read locked tasklist_lock, since there is
> already task 3 expressed its wish to take the lock exclusive.
> Task 2 holds the read locked lock, but it can't take the spin lock.
>
> The patch makes queued_read_lock_slowpath() to give task 1 the same
> priority as it was an interrupt handler, and to take the lock

That re-introduces starvation scenarios. And the above looks like a
proper deadlock that should be sorted by fixing the locking order.

\
 
 \ /
  Last update: 2018-04-04 17:39    [W:0.096 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site