From patchwork Tue Mar 12 23:30:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10850211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CAB1F17E6 for ; Tue, 12 Mar 2019 23:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7E3B29705 for ; Tue, 12 Mar 2019 23:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABEEC29917; Tue, 12 Mar 2019 23:30:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34E3E29705 for ; Tue, 12 Mar 2019 23:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727223AbfCLXas (ORCPT ); Tue, 12 Mar 2019 19:30:48 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36559 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726581AbfCLXar (ORCPT ); Tue, 12 Mar 2019 19:30:47 -0400 Received: by mail-pg1-f196.google.com with SMTP id r124so102471pgr.3 for ; Tue, 12 Mar 2019 16:30:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bI7qYXD/VasK/D7oO/qMrYpVp0SQS7m089cqk3I2JwM=; b=BQjYu1N0GDyBzCct8WydjOYKFX4wusZLkIjnkuwk823XzQjZIBS4avBVi24jFF+wxi W9zDjVZoHUWJKY1GM09EagyWoJxsFQJZeVHu+NRJbGlaFbxBDIY06ksDrKR6a/VpL4Q2 0xblGgsn4ZDtltBSGi5WBc2Bbp3C9ATzQ1WyXebbVkLrds+0nRFEqSPRIwyrCueZyt3h Y04WbxjywVWtshua6EDiHo5X8pYoAAqJQeyG1Nuro28xOLC+STDKeOuTqlEpAwpT7Q84 +TNFYHIGr0u6mhPTiZcXYfILyN+3lxvTbAI6yl44XKEp7xkG/M+wobMYdhhjxwj6i4pv QPFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bI7qYXD/VasK/D7oO/qMrYpVp0SQS7m089cqk3I2JwM=; b=aQA8P3eCUxfqgpv+HF2LpaIpYjeDz1X0wKG3a242m63rmq//V3k0Dw215As9uzW1I7 bTiMweGTE8mnllR3jb+PG/isV0vvEHoTnDlNms80zN748gkdJ50ZjxcazrImnWlnohmM miEV2Ea5SYJAqRixeWwoLh/IN7OSfOsMbq26/EqyrwllFRMVIlVyOAGBlUVRk7qWR2U7 m2z1VuBvnHGRer+wQIRmbOwzZa88K3NC2w6IZq6hGY+sHDY7eWUHJP5suA109W3mTde0 awMSXmyVYfSz+dpjQP5U9TUOA4chYn6fMf9JYo2Sp8jihGnhbRK45kDmzMjZbAisbcCQ WquA== X-Gm-Message-State: APjAAAWcKKmz4nkH0m63HeUgDjrDZHuy94Va5I2Mrf3p5kGcYFhxBXVN tTt2HcQ8XyYZ7ts/ec9XHJQ/mXKQ X-Google-Smtp-Source: APXvYqy6roqGxbTWK3yEzfHfks0aHOl8yl003wLfsc3w9xybzLYeyo6aRSOrVjaYblfaBNXhgIFrTA== X-Received: by 2002:a63:c0e:: with SMTP id b14mr37542036pgl.236.1552433446235; Tue, 12 Mar 2019 16:30:46 -0700 (PDT) Received: from pallmd1.broadcom.com ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id d11sm17284409pfh.29.2019.03.12.16.30.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Mar 2019 16:30:45 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy Subject: [PATCH 02/30] lpfc: Resolve irq-unsafe lockdep heirarchy warning in lpfc_io_free Date: Tue, 12 Mar 2019 16:30:05 -0700 Message-Id: <20190312233033.32670-3-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20190312233033.32670-1-jsmart2021@gmail.com> References: <20190312233033.32670-1-jsmart2021@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A patch in the 12.2.0.0 set caused a new lockdep warning: WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected 5.0.0-rc8-next-20190301-dbg+ #1 Not tainted Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&(&qp->io_buf_list_put_lock)->rlock); local_irq_disable(); lock(&(&phba->hbalock)->rlock); lock(&(&qp->io_buf_list_put_lock)->rlock); lock(&(&phba->hbalock)->rlock); see: https://www.spinics.net/lists/linux-scsi/msg128389.html In summary, the new patch added taking the io_buf_list_put_lock while under an irq-disabled hbalock. This created a lock heirarchy dependent upon irq being disabled, and there are paths that take the io_buf_list_put_lock without disabling irq. Looking at the lpfc_io_free routine, which is where the new heirarchy was introduced, there is no reason to be taking out the hbalock and raising irq, as the functionality is replaced by the io_buf_list_xxx locks. Resolve by removing the hbalock/irq calls in lpfc_io_free. Fixes: 5e5b511d8bfa ("scsi: lpfc: Partition XRI buffer list across Hardware Queues") Reported-by: Bart Van Assche Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_init.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 707dbe7a8d15..3e9cc06c3cff 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -3611,8 +3611,6 @@ lpfc_io_free(struct lpfc_hba *phba) struct lpfc_sli4_hdw_queue *qp; int idx; - spin_lock_irq(&phba->hbalock); - for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { qp = &phba->sli4_hba.hdwq[idx]; /* Release all the lpfc_nvme_bufs maintained by this host. */ @@ -3642,8 +3640,6 @@ lpfc_io_free(struct lpfc_hba *phba) } spin_unlock(&qp->io_buf_list_get_lock); } - - spin_unlock_irq(&phba->hbalock); } /**