From patchwork Tue May 31 12:38:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 68927 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1918280qge; Tue, 31 May 2016 05:26:08 -0700 (PDT) X-Received: by 10.98.193.5 with SMTP id i5mr29659393pfg.64.1464697567974; Tue, 31 May 2016 05:26:07 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 77si43562095pft.184.2016.05.31.05.26.07 for ; Tue, 31 May 2016 05:26:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbcEaM0H (ORCPT ); Tue, 31 May 2016 08:26:07 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:30451 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752788AbcEaM0A (ORCPT ); Tue, 31 May 2016 08:26:00 -0400 Received: from 172.24.1.60 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.60]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CCM13938; Tue, 31 May 2016 20:25:53 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Tue, 31 May 2016 20:25:43 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 2/3] hisi_sas: fix the inconsistent lock issue reported by CONFIG_PROVE_LOCKING Date: Tue, 31 May 2016 20:38:50 +0800 Message-ID: <1464698331-228732-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464698331-228732-1-git-send-email-john.garry@huawei.com> References: <1464698331-228732-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.574D82D2.01C3, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 37263807ce7f44a624fe08a04c272270 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It is not necessary to surround call to notify_port_event(, PORTE_BROADCAST_RCVD) by spin_lock_irqsave(), so remove. This was causing a warn, as below: ================================= [ INFO: inconsistent lock state ] 4.4.8+ #12 Not tainted --------------------------------- inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. kworker/u64:1/168 [HC0[0]:SC0[0]:HE1:SE1] takes: (&(&hisi_hba->lock)->rlock){?.....}, at: [] alloc_dev_quirk_v2_hw+0x48/0xec {IN-HARDIRQ-W} state was registered at: [] mark_lock+0x19c/0x6a0 [] __lock_acquire+0xa2c/0x1d00 [] lock_acquire+0x58/0x7c [] _raw_spin_lock_irqsave+0x54/0x6c [] int_chnl_int_v2_hw+0x1c4/0x248 [] handle_irq_event_percpu+0x9c/0x144 [] handle_irq_event+0x44/0x74 [] handle_fasteoi_irq+0xb4/0x188 [] generic_handle_irq+0x24/0x38 [] __handle_domain_irq+0x60/0xac [] gic_handle_irq+0xcc/0x168 [] el1_irq+0x6c/0xe0 [] default_idle_call+0x1c/0x34 [] cpu_startup_entry+0x1d4/0x228 [] rest_init+0x150/0x160 [] start_kernel+0x3a4/0x3b8 [<00000000008bb000>] 0x8bb000 irq event stamp: 32661 hardirqs last enabled at (32661): [] __mutex_unlock_slowpath+0x108/0x18c hardirqs last disabled at (32660): [] __mutex_unlock_slowpath+0x44/0x18c softirqs last enabled at (25114): [] __do_softirq+0x210/0x27c softirqs last disabled at (25095): [] irq_exit+0x9c/0xe8 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&(&hisi_hba->lock)->rlock); lock(&(&hisi_hba->lock)->rlock); *** DEADLOCK *** 2 locks held by kworker/u64:1/168: #0: ("%s"shost->work_q_name){++++.+}, at: [] process_one_work+0x134/0x3cc #1: ((&sw->work)#2){+.+.+.}, at: [] process_one_work+0x134/0x3cc stack backtrace: CPU: 4 PID: 168 Comm: kworker/u64:1 Not tainted 4.4.8+ #12 Hardware name: Huawei Technologies Co., Ltd. D03/D03, BIOS 1.12 01/01/1900 Workqueue: scsi_wq_1 sas_discover_domain Call trace: [] dump_backtrace+0x0/0x114 [] show_stack+0x14/0x1c [] dump_stack+0xb4/0xf0 [] print_usage_bug+0x210/0x2b4 [] mark_lock+0x5fc/0x6a0 [] __lock_acquire+0x800/0x1d00 [] lock_acquire+0x58/0x7c [] _raw_spin_lock+0x44/0x58 [] alloc_dev_quirk_v2_hw+0x48/0xec [] hisi_sas_dev_found+0x48/0x1b8 [] sas_notify_lldd_dev_found+0x34/0xe0 [] sas_discover_root_expander+0x58/0x128 [] sas_discover_domain+0x4bc/0x564 [] process_one_work+0x1a0/0x3cc [] worker_thread+0x138/0x438 [] kthread+0xdc/0xf0 [] ret_from_fork+0x10/0x40 Signed-off-by: Wei Xu Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 5 ----- 1 file changed, 5 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index e933cdc..c8c0b45 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1909,14 +1909,9 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba) struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; struct asd_sas_phy *sas_phy = &phy->sas_phy; struct sas_ha_struct *sas_ha = &hisi_hba->sha; - unsigned long flags; hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1); - - spin_lock_irqsave(&hisi_hba->lock, flags); sas_ha->notify_port_event(sas_phy, PORTE_BROADCAST_RCVD); - spin_unlock_irqrestore(&hisi_hba->lock, flags); - hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, CHL_INT0_SL_RX_BCST_ACK_MSK); hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 0);