From patchwork Tue Oct 24 15:51:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 116960 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5914097qgn; Tue, 24 Oct 2017 08:06:44 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SIA3ViRUwfmtnmKP0vdhksjzcO55ZAIrY39jAA33DS3Spa2Kh9iHjQBTaJ2GlAU1dtHEdm X-Received: by 10.84.241.129 with SMTP id b1mr13509480pll.103.1508857604731; Tue, 24 Oct 2017 08:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508857604; cv=none; d=google.com; s=arc-20160816; b=rn63VHc1mu1JBBWzs0yfcuQAd6i+a/89wolQIXJjm98GSppOk5yVNJ8YMQSNAlnWj/ surU7RVWg0eOeRzfN4lSng8KFuJR3LGtzol3MvV6kkqHxFYCFfF5z27KW9CdrOvj5xZ/ qlvyZDI9ulQjqxedo4v5UJIwE9A9zFiSGmNaoF90mqiXq5jmXa+CnzUoWgH1/HcZTbGC S4y2lkRbnB8Q4oWI0LxvmzQvQ0+avKb4CTw3J0oKw9vYQ+XEWd3DppWyWEnGqOahPsIs nwa+Pao4tj/d0g6jz7Al7iLa0EzyjWoVUXI1w8M0eIuftZBZz4AgDvZ0yG22wQ/PEnye 94Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=LWAIM4b75llGqP9qNTry68T/lgapfSrlMMcGs4Xqbgg=; b=vajqPdKWup8obh7aeYzsppJYRvu9nbIIruTqwmQNjd/8KQ8a3aLyzKMB6pT7lN9Ms7 Ax/rx4uu2U3eP0j/zpZHCmp1Vc5LrauRO0Nu03I5H2B2MKE4psfaGsCdx6TCM8w5LMsU VbhmSvDnwixxk+uJ811vin8C3eK5C2Kqk/6obGQQlaun8eOqn+zokMBENm4gTuFSFpAB qmug3iQ0uEse03aJtndiN0DRF80kvyRD/YsOiK/jukvZxPTmCpGqkZb7ZWiWt6maSpP1 S2bMBjcM97uNqmTncEjYB9IRD+9ReLaf+nEcQ6JBrWTkIIwT3zXwUC0VofG446ftNFSy LWkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10si262866plp.150.2017.10.24.08.06.44; Tue, 24 Oct 2017 08:06:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932379AbdJXPGn (ORCPT + 27 others); Tue, 24 Oct 2017 11:06:43 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50580 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751705AbdJXPF3 (ORCPT ); Tue, 24 Oct 2017 11:05:29 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5D72D4404433C; Tue, 24 Oct 2017 23:05:23 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Tue, 24 Oct 2017 23:05:15 +0800 From: John Garry To: , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 03/19] scsi: hisi_sas: use spin_lock_irqsave() for hisi_hba.lock Date: Tue, 24 Oct 2017 23:51:33 +0800 Message-ID: <1508860309-212397-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508860309-212397-1-git-send-email-john.garry@huawei.com> References: <1508860309-212397-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan We used spin_lock() to grab hisi_hba.lock in two places where spin_lock_irqsave() should be used, as hisi_hba.lock can be taken in interrupt context. This patch is to fix this. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 5 +++-- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 0eb9174..e038bdf 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -505,9 +505,10 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) { struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_sas_device *sas_dev = NULL; + unsigned long flags; int i; - spin_lock(&hisi_hba->lock); + spin_lock_irqsave(&hisi_hba->lock, flags); for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) { if (hisi_hba->devices[i].dev_type == SAS_PHY_UNUSED) { int queue = i % hisi_hba->queue_count; @@ -524,7 +525,7 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) break; } } - spin_unlock(&hisi_hba->lock); + spin_unlock_irqrestore(&hisi_hba->lock, flags); return sas_dev; } diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 779af97..73d12ff 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -843,8 +843,9 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device) struct hisi_sas_device *sas_dev = NULL; int i, sata_dev = dev_is_sata(device); int sata_idx = -1; + unsigned long flags; - spin_lock(&hisi_hba->lock); + spin_lock_irqsave(&hisi_hba->lock, flags); if (sata_dev) if (!sata_index_alloc_v2_hw(hisi_hba, &sata_idx)) @@ -874,7 +875,7 @@ hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device) } out: - spin_unlock(&hisi_hba->lock); + spin_unlock_irqrestore(&hisi_hba->lock, flags); return sas_dev; }