Linux block layer
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, Clark Williams <williams@redhat.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sbitmap: Protect swap_lock from hardirq
Date: Mon, 14 Jan 2019 21:28:33 -0700	[thread overview]
Message-ID: <e2bebd6a-cc89-d6c2-8203-718b5c12ea4f@kernel.dk> (raw)
In-Reply-To: <20190115035952.13325-1-ming.lei@redhat.com>

On 1/14/19 8:59 PM, Ming Lei wrote:
> The original report is actually one real deadlock:
> 
>     [  106.132865]  Possible interrupt unsafe locking scenario:
>     [  106.132865]
>     [  106.133659]        CPU0                    CPU1
>     [  106.134194]        ----                    ----
>     [  106.134733]   lock(&(&sb->map[i].swap_lock)->rlock);
>     [  106.135318]                                local_irq_disable();
>     [  106.136014]                                lock(&sbq->ws[i].wait);
>     [  106.136747]                                lock(&(&hctx->dispatch_wait_lock)->rlock);
>     [  106.137742]   <Interrupt>
>     [  106.138110]     lock(&sbq->ws[i].wait);
> 
> Because we may call blk_mq_get_driver_tag() directly from
> blk_mq_dispatch_rq_list() without holding any lock, then HARDIRQ may come
> and the above DEADLOCK is triggered.
> 
> ab53dcfb3e7b ("sbitmap: Protect swap_lock from hardirq") tries to fix
> this issue by using 'spin_lock_bh', which isn't enough because we complete
> request from hardirq context direclty in case of multiqueue.

Thanks Ming, I'll queue this up for shipping this week.

-- 
Jens Axboe


  reply	other threads:[~2019-01-15  4:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15  3:59 [PATCH] sbitmap: Protect swap_lock from hardirq Ming Lei
2019-01-15  4:28 ` Jens Axboe [this message]
2019-01-15  4:31   ` Linus Torvalds
2019-01-15  4:34     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2bebd6a-cc89-d6c2-8203-718b5c12ea4f@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=ming.lei@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox