From patchwork Mon May 14 16:24:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10400157 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C5EF6600F4 for ; Tue, 15 May 2018 07:28:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89CBE2862A for ; Tue, 15 May 2018 07:28:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E52D28647; Tue, 15 May 2018 07:28:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0492828641 for ; Tue, 15 May 2018 07:28:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E90930C0DD7; Tue, 15 May 2018 07:28:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C91B1001944; Tue, 15 May 2018 07:28:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0327F4CA94; Tue, 15 May 2018 07:28:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4EGuwp6019712 for ; Mon, 14 May 2018 12:56:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 89B80607A3; Mon, 14 May 2018 16:56:58 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9773117C25; Mon, 14 May 2018 16:56:51 +0000 (UTC) Received: from Galois.linutronix.de (Galois.linutronix.de [146.0.238.70]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DBC830B3C31; Mon, 14 May 2018 16:56:50 +0000 (UTC) Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1fIGGd-0000S1-JT; Mon, 14 May 2018 18:24:07 +0200 Date: Mon, 14 May 2018 18:24:07 +0200 From: Sebastian Andrzej Siewior To: Mike Snitzer Message-ID: <20180514162407.rigrq3enfic3i7xw@linutronix.de> References: <20180504143639.5300-1-bigeasy@linutronix.de> <20180504155311.GA4787@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180504155311.GA4787@redhat.com> User-Agent: NeoMutt/20180323 X-Greylist: Delayed for 00:32:39 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 14 May 2018 16:56:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 14 May 2018 16:56:50 +0000 (UTC) for IP:'146.0.238.70' DOMAIN:'Galois.linutronix.de' HELO:'Galois.linutronix.de' FROM:'bigeasy@linutronix.de' RCPT:'' X-RedHat-Spam-Score: 0 () 146.0.238.70 Galois.linutronix.de 146.0.238.70 Galois.linutronix.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 15 May 2018 03:28:50 -0400 Cc: Keith Busch , dm-devel@redhat.com, Thomas Gleixner , Alasdair Kergon Subject: [dm-devel] [PATCH] dm rq: replace BUG_ON(!irqs_disabled) with lockdep's lock annotation X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 15 May 2018 07:28:56 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP In commit 052189a2ec95 ("dm: remove superfluous irq disablement in dm_request_fn") the spin_lock_irq() was replaced with spin_lock() + a check for disabled interrupts. Later the locking part was removed in commit 2eb6e1e3aa87 ("dm: submit stacked requests in irq enabled context") but the BUG_ON() check remained. Mike Snitzer explained that: |the queue_lock hasn't been removed for the old .request_fn path in block |core -- which dm_old_request_fn is providing the hook for. | |This BUG_ON() documents that reality. The BUG_ON() statement checks for disabled interrupts. The better check would to let lockdep check if the required lock (queue_lock) is held. Lockdep will then validate that the lock is held an complain if this is not the case. Since lockdep will see this lock held in IRQ-context it will also complain should the interrupts be enabled while lock still held or acquired with enabled interrupts. So this !irq_disabled() is not required. This change helps to avoid the BUG_ON() statement on preempt-rt where the lock is a sleeping lock and interrupts are never really disabled. Signed-off-by: Sebastian Andrzej Siewior --- drivers/md/dm-rq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index bf0b840645cc..78a44bb7537f 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -688,7 +688,7 @@ static void dm_old_request_fn(struct request_queue *q) /* Establish tio->ti before queuing work (map_tio_request) */ tio->ti = ti; kthread_queue_work(&md->kworker, &tio->work); - BUG_ON(!irqs_disabled()); + lockdep_assert_held(q->queue_lock); } }