From patchwork Thu Dec 21 17:34:14 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: 10128135 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 459D560318 for ; Thu, 21 Dec 2017 17:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3451829CE3 for ; Thu, 21 Dec 2017 17:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 292DC29D3D; Thu, 21 Dec 2017 17:35:42 +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 9685529CE3 for ; Thu, 21 Dec 2017 17:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755150AbdLURfk (ORCPT ); Thu, 21 Dec 2017 12:35:40 -0500 Received: from mail-co1nam03on0073.outbound.protection.outlook.com ([104.47.40.73]:50048 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753797AbdLURe6 (ORCPT ); Thu, 21 Dec 2017 12:34:58 -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=fs0HZ7a5P8kwe7pbsPi8MQ54HK1PbFSp4up0zO9AMhQ=; b=Mn7oRCJFy2VjVbeGvMorSofnkETlQ/1pRIvbwjbv7gu9GaB6adVawZ3/tH8MqIiadPIuXCJ7Zw1KQuUyYBJeH9TmDWHilEIZ51oD5fD+e6GJl1URrYqAI7BBr0K67vrs4MkT8ouTtWl3gtYamPc3h4Hr3VNOU/rNsONvi08e64I= Received: from MWHPR02CA0045.namprd02.prod.outlook.com (10.164.133.34) by BY2PR0201MB1829.namprd02.prod.outlook.com (10.163.75.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Thu, 21 Dec 2017 17:34:49 +0000 Received: from BN1BFFO11FD036.protection.gbl (2a01:111:f400:7c10::1:195) by MWHPR02CA0045.outlook.office365.com (2603:10b6:301:60::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Thu, 21 Dec 2017 17:34:49 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; linux.vnet.ibm.com; dkim=none (message not signed) header.d=none; linux.vnet.ibm.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 BN1BFFO11FD036.mail.protection.outlook.com (10.58.144.99) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Thu, 21 Dec 2017 17:34:34 +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; Thu, 21 Dec 2017 09:34:28 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 23/29] scsi: aacraid: Block concurrent hotplug event handling Date: Thu, 21 Dec 2017 09:34:14 -0800 Message-ID: <20171221173420.8213-24-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171221173420.8213-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171221173420.8213-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)(346002)(39860400002)(376002)(39380400002)(2980300002)(438002)(199004)(189003)(36756003)(76506005)(305945005)(68736007)(1076002)(4326008)(106002)(356003)(5660300001)(59450400001)(53936002)(69596002)(8676002)(57986006)(97736004)(81166006)(104016004)(81156014)(2201001)(77096006)(316002)(16586007)(47776003)(110136005)(54906003)(478600001)(72206003)(86362001)(50226002)(2906002)(106466001)(6666003)(8936002)(50466002)(2950100002)(76176011)(48376002)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1829; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD036; 1:hYMJhOJ0j2Rsgmx1zO2A1OQJ+9bpsL1rdkjbDdvZbgqs7rd/34jtzfL2lmlALDGSFtVmF/+W3ENdCqGtodf2Wvhdv4rXKcn2AL/K8vCSL3LTMeU2dB8K88oThx8+rXqd X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 425803b0-8cc4-457b-0a9c-08d548991a1b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4608076)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:BY2PR0201MB1829; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 3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JQdK5P+j7gBajcKxM1B4uv4K8/0Y9uyyZFrL3IK3Jt17cJlOET81d+9qZVjEXr1y13Bs0DG+VUv16NFefBsiQC0ejpsn2OIbYsMy85xGu45B+/b8zksT4NjZJFajjYtj3B2G3bY1mqcUrg6SPiQII6Y5pgBDtOvjAoQqCIXbtlr/nreH9hgqno3fonTPc4ZaoD+G2mt4+kJGvpp1bfeRXvHZLnoPaN75DeY6l6Y99HwTRfrXsy1zEA/0ZqiGBVYAkJ+CnqaJ+JzeqdxIiCC1u/mBmWl9UWRXHLDnnMR4o9yP8nijIc0mDhKnz193HVAis8Hbubyh+bnoYYQhLFB8A/hzP8cGdS1CrA9kw46v6OL+UhyUQfrx2wW/dZsyzuyKp1jWFWTeNMC6GcnnYxNZI02y8krVglur1fYUlEFzXcli/Q9kKLziVtwsbkIuZYGT/Zj4bwQpGpi1k1X1X9lTK7tfY2Zd4IrctFqTe/BRdOQ4uhU7BuxSDMTzbyfchY3ZnM1n8GuI/5tG12BOYA5t3Ytp9QIXygGKj1boG+FRjdIhrf3Hs3ZRKydDBG1IZKfY= 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)(3002001)(3231023)(93006095)(93004095)(10201501046)(6055026)(6041268)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:BY2PR0201MB1829; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0201MB1829; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 4:ntZHcRfZbc2Cyy7dZUX9AnKHAZJVd5ca2MjnbYTNP5LEYL4rhQVDJ8/Liv6AIvJ49iqgt+TUb0cIeXjF3WQus+XyRf1/YNJElqg6V9Pi1YohfIBd6/rXSwOVRgnIx0XohIgcPzNcZ8hVj2kLqMLlNm7Sv6L471YF5xPGy7S1voL66jb9mgj9JWm+45xrbHn9zD/RpxbmxmTDgStBOaekSQBRKUCcRGnu2i4E18FzmfbLXd3BLuHi7+GzM1k5isxhBw6n87hCLy9AHdZGH7/vluulCy9HO4b2qdE/CXsJQGt5HA9Sze8mymPZZL+EN+Sj X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0201MB1829; 23:KIZmPbvFIQucHAoI3VmGJcpdHykMysQYvbn5ah0?= =?us-ascii?Q?wa0FVpzqcSh0l7QrF6qL4MgAH4nzBFrfWsrVXVagp34KK4ye9t2t5RN1AKES?= =?us-ascii?Q?RXodH4wQ8mLrU4TPg6XDMe+bVmtFQJnmIt+arxOLa3yW4+Tkzg/CJZlIBIme?= =?us-ascii?Q?t/HndiPxyd5pSEoLNErN4+umSmEhkGG+8JxTitXzaemsGcq6vAdmbOlW15Zj?= =?us-ascii?Q?9x8xV8awvoY563eWi8Bl6rO9XzB8heW8NLvVVpTdN76zljDQqs7rBBRHe2KX?= =?us-ascii?Q?kBr/Vt6LjvF1vIObim2CF6xUJMqnGrQvX3TxuyyQ7h9vw2Uuq9XB+G6LCUsC?= =?us-ascii?Q?DL48kLJlZUGOyqOZjV/TWtRa5673RLGgdMuh5MShqL2o2iIlxvS7xlrGhzKi?= =?us-ascii?Q?bk7Ku1SbImLkYNYVWP2zZUqIOpVxfpMhOGxS9eLiaPvFaDzvEMzBuYxrQztF?= =?us-ascii?Q?oHRCJh+kKkluzpvJjKb14LgZ8HNbTmzITgfrt9KESf7t5V+1FNHxvKe2w6WP?= =?us-ascii?Q?CksSnxKfw9anhafrC10El+L/azhVKHtItJ01eVrbtUBMH7K6G5qnz5U5/5tZ?= =?us-ascii?Q?TU1dUGUoDAouieDeY3MnnP4WunTXHNs46kcR1b84Ay7DmBWwJk8W2jiIiQtx?= =?us-ascii?Q?cHulDKFOhPFLXrqucKiD9qhKOYeFhyThh8KGlVfwRXmVZk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1I5qzU4L8tNcHzab1eoKlaMhs21pP/5lXP0vDD2g5wfX3dFptgrmp2f/lTQvA=; 24:gouZ29S4HUY5djZyUx65hEjQo84E6y9FzipJ7Pk+XR0FKpeaOYpyoNGVcei7YhfqEKIr0TLZDQvhHNi4c5elwBYGkl9iCj0E3ZahQk1scUE=; 7:fxatQiITmvXo0BQFt07VuLFugMqSqDiz6Xeye50SBZEEHeizAMl2f+c6nK++rdq/u5roSmpxFlBBdeEwes+hFnDHE7KJo01MVsmvX7NIX/xDrDWn6pX9F50X2sCStPfZrXMmGbV3jMoGcCpmzbk4hN8n9IBsYL593JUmjba8LwKPvs99OCSpTsz43QVZgDxKzr/fhQ8dkkAbjaXASRF95LU/TkFAWFzGtxK9NJkrwFTHwUfD9qmvb925ubS19f6a SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:34.4693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 425803b0-8cc4-457b-0a9c-08d548991a1b 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: BY2PR0201MB1829 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 --- 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 f781076..698c049 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -2001,7 +2001,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. */