From patchwork Wed Dec 27 04:34:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 10133439 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 A27D66037D for ; Wed, 27 Dec 2017 04:35:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89C382DA63 for ; Wed, 27 Dec 2017 04:35:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E94D2DAA2; Wed, 27 Dec 2017 04:35:57 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 138E42DA63 for ; Wed, 27 Dec 2017 04:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbdL0Eft (ORCPT ); Tue, 26 Dec 2017 23:35:49 -0500 Received: from mail-sn1nam02on0082.outbound.protection.outlook.com ([104.47.36.82]:6720 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751853AbdL0EfV (ORCPT ); Tue, 26 Dec 2017 23:35:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZK31pFsplFqZTmRI2jRLAEn9FjKlseg7HGaUA4Wp+7M=; b=K3LRgjxVQMjr/wR/xiEUA8tTihfBDLFCuKdGPaHzr7ZpdOo9gIV4K5viER9LVDGDiiDBl92foTthKH8Ul7MQHY8tPZ6EbSwHB1V6cieSQFddoeM50xtPejBJLu8Kp/33oqcX5wplQsdgEEMx4B3SHny4FS59RzZ4Bg6brX/ksBU= Received: from MWHPR0201CA0047.namprd02.prod.outlook.com (10.167.160.24) by BLUPR02MB129.namprd02.prod.outlook.com (10.242.189.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Wed, 27 Dec 2017 04:35:18 +0000 Received: from BL2FFO11FD050.protection.gbl (2a01:111:f400:7c09::115) by MWHPR0201CA0047.outlook.office365.com (2603:10b6:301:73::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Wed, 27 Dec 2017 04:35:17 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BL2FFO11FD050.mail.protection.outlook.com (10.173.161.212) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Wed, 27 Dec 2017 04:34:58 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 26 Dec 2017 20:35:00 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 23/30] scsi: aacraid: Block concurrent hotplug event handling Date: Tue, 26 Dec 2017 20:34:44 -0800 Message-ID: <20171227043451.27813-24-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39850400004)(39380400002)(346002)(376002)(2980300002)(438002)(199004)(189003)(106466001)(81166006)(2906002)(50466002)(48376002)(51416003)(110136005)(76176011)(106002)(5660300001)(54906003)(57986006)(478600001)(316002)(2201001)(16586007)(76506005)(77096006)(86362001)(47776003)(1076002)(68736007)(81156014)(59450400001)(356003)(8676002)(104016004)(36756003)(6666003)(305945005)(97736004)(4326008)(69596002)(8936002)(50226002)(2950100002)(72206003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB129; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD050; 1:3T2Kq293C9SD10TZtQxuPn8TMSP8VavWMyebqecgNvr2l3GzBG3z2DJ8TBc7GRx5cVGbGablMm/Su2+agcBj/3srYf3Itt40lVQkeduo8i2tVwKiuyhyRL2DOWypF47t X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3da4418c-7378-4f6f-118d-08d54ce32fab X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BLUPR02MB129; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB129; 3:aUHE860UBGkX/gC6a3gjrwxHsi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80j9JDKwYQlKJB1zPRegwdqncua7wZr+tW0JE/tc+nByxWphDK8nOl57Q/tb6fHydY4yzsKF2/VmbtG4UhW5DVhZa/tH3t+k45MIE10or/WZ63yCITnaF1Nmh4eP7lReK9Kct6AIXZUn7BvPGQvMKwvnOBP2vj09mEko9ZaZMuIb5YU7l0UxmrZk0l4hD11Gnnul5Ya/xuKBR2eEjzU97lzP2dzS+SBvbKiyi/Kb2Nq9enG6gDLQq1U+zyTtdz0TyFlYbcq+EWv+GcKdfpHPcs/eXOjH3YWPpD+XSKgxH2iODL0wacgeZMikOroK14j6Cu64u+UUq6Bnhk/dW4ltHlDjbxfKAppV3rEazkywh+a7jtYB64KGeATry1EUTZ6LNRjdK3QNMOorC1ktPKv2+STbQaRAqokldCcKjcS44p4i1CSXG3ZM5tGxM/Fuh5Dhau6AMF95UOHPn67PUKUApG7TlXu1asF2enV8PwcULS21ZqLXjDq2M4/2J1jNPzTiuLFB1wVdWKzGwiRTce5nNSYswWI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93004095)(3002001)(3231023)(944501075)(10201501046)(6055026)(6041268)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:BLUPR02MB129; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR02MB129; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB129; 4:v4y936suoo+a+wWK6E8ykmOV9uTyLPDDuiHNkSKytEwMCPnxAsOKwRv2hvbfowqrMTDv2MUhKDSzdOJg4VKS5DL09zXtvEp3S69smcZzK5tiKKjvJ2dQf+XAzsoW/kwBqKtQ5oWyH1XEYg86hTxasD1fjv0QN4bTb4zWqhq0RSE3cFLGTNifCOQl9mKNXRTxzFOfRxlEwxwKN9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feLiaSPGQfEO5+VeVa+v/g=; 24:jTaHWUMHuP/zFjU4pxfmqty+17qU+g51M3tUOVcODojjHzIS6s0inbqvwK3bjLgI4c9TqR90+5+yKG1bpNKlvT5jBxSLKpCqgrYa6GHrRv0=; 7:5cYamK6Hpw0e+yKnEeb6qgZx5rViP1iIIuUYRT6V4LEFUyjUHQX9ePKs58o5SXKFaF7HKfGSUwRA/Z8TIdiKDf85cgtLCZUSV3teI61+FCCkee/AZcA7+njfhXYtuW5Uu6tfIE3hxUh2UhHwh8SRqPp8uTlE5DhzQCSJ2dKp4Nrw50814FtAd1nsJANmVFyDhhT9ZsxmmKxI6DJgN22wpOdPCX1ugZIrI3N9unO1EbYszwpEt2XX29eib6WiEEt/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:58.0544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3da4418c-7378-4f6f-118d-08d54ce32fab X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB129 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 Currently driver will attempt to process hotplug events concurrently based on the FW interrupt. Protect safw update function with a scan mutex. Signed-off-by: Raghava Aditya Renukunta --- Changes in V2: None drivers/scsi/aacraid/aacraid.h | 1 + drivers/scsi/aacraid/commsup.c | 2 ++ drivers/scsi/aacraid/linit.c | 1 + 3 files changed, 4 insertions(+) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index a8fe1e1..c70c998 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1565,6 +1565,7 @@ struct aac_dev spinlock_t fib_lock; struct mutex ioctl_mutex; + struct mutex scan_mutex; struct aac_queue_block *queues; /* * The user API will use an IOCTL to register itself to receive diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 34155b1..491e633 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1997,7 +1997,9 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) case SA_AIF_LDEV_CHANGE: case SA_AIF_BPCFG_CHANGE: + mutex_lock(&dev->scan_mutex); aac_update_safw_host_devices(dev, AAC_RESCAN); + mutex_unlock(&dev->scan_mutex); break; case SA_AIF_BPSTAT_CHANGE: diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index b2273e3..2c862cd 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -1683,6 +1683,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) spin_lock_init(&aac->fib_lock); mutex_init(&aac->ioctl_mutex); + mutex_init(&aac->scan_mutex); /* * Map in the registers from the adapter. */