From patchwork Thu May 18 16:18:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 9734739 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 C10F56022E for ; Thu, 18 May 2017 16:18:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9BBE2875B for ; Thu, 18 May 2017 16:18:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E88D287A3; Thu, 18 May 2017 16:18:28 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 44B652875B for ; Thu, 18 May 2017 16:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932678AbdERQS1 (ORCPT ); Thu, 18 May 2017 12:18:27 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:34241 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932616AbdERQSX (ORCPT ); Thu, 18 May 2017 12:18:23 -0400 Received: by mail-pg0-f47.google.com with SMTP id u28so25088642pgn.1 for ; Thu, 18 May 2017 09:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KAwqwcdH1omcgdp2kHKHpYcXG2bh4JK5lAECoJ9oK6s=; b=f96rRTi+4gDXtgqh3sJrAo8rFJBQezEOKTre3d6WHMC7L3n8AlPhRcEwkQXeAOfocG /O3EjUgo2flfYKkmgqFuZs/qXpnr+kECagsqoQKY3z6Lz7MF7PPWncIZkThqYHqMKEyD t30wsc051cZa5SKJjy85IXQ1u3ckhCqD8zViJYKwOGtTCs1r3W9todza+DCo5+YwOk2v 5I8Dzts06GJiHxTSNK5IpCWsl1Qi8HbHWZDsj9QP/Yy50bk6pkCj6duMid5llo+VDTrW 2+W+L1F+PDpZZx4w8ijZlIpd5CTJisb0q2sleUfWYShFTRq1Nn/6s05rbrOy6+bNSC3q aCxQ== 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=KAwqwcdH1omcgdp2kHKHpYcXG2bh4JK5lAECoJ9oK6s=; b=KRDf0z6SNJXzHnBB8rDnJlSDVWz7puXp19yK+eoKfKCzZRw0fwVDr6zhoxFXDoM9hk gXLAYlBo299STnJIdHRLOSNWE9yIZcIA46qhuVtytZ64lY+Twn70cAchC2WXrWULjI8k bB4+FfR0L1JO9Ci/T8lRhHIy1gfjSLpJ5pQ+frbasUWXESPUT3WiGjY+YG9DmqYytH/2 YDT8SO3k7T+A8m6cUT+S799p5EY/1teQ+p3adB0pTisvGeKrMxTnl/TdPt5yGg9g4mqV zdttNRBWsuHlCvxTtw9+oCFtUTm85sN/tBh9LqxEfh8iq8sjqAyyaZNMFUnYWN6xuRtm NnBg== X-Gm-Message-State: AODbwcCG6n7J2xd02T6JOojsKvB8+eoAxrcc1I2cVpcaS+hVujKmPrIP WGQ6FRnXcjDk4D7l X-Received: by 10.84.232.71 with SMTP id f7mr6006554pln.168.1495124302691; Thu, 18 May 2017 09:18:22 -0700 (PDT) Received: from xeon-e3.wavecable.com (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id d75sm896796pfj.75.2017.05.18.09.18.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 09:18:22 -0700 (PDT) From: Stephen Hemminger X-Google-Original-From: Stephen Hemminger To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, kys@microsoft.com Cc: devel@linuxdriverproject.org, linux-scsi@vger.kernel.org, Stephen Hemminger Subject: [PATCH 2/2] storvsc: remove unnecessary channel inbound lock Date: Thu, 18 May 2017 09:18:12 -0700 Message-Id: <20170518161812.14124-3-sthemmin@microsoft.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170518161812.14124-1-sthemmin@microsoft.com> References: <20170518161812.14124-1-sthemmin@microsoft.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 In storvsc driver, inbound messages do not go through inbound lock. The only effect of this lock was is to provide a barrier for connect and remove logic. Signed-off-by: Stephen Hemminger --- drivers/hv/channel_mgmt.c | 1 - drivers/scsi/storvsc_drv.c | 8 +++----- include/linux/hyperv.h | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 735f9363f2e4..685572bae1f0 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -332,7 +332,6 @@ static struct vmbus_channel *alloc_channel(void) if (!channel) return NULL; - spin_lock_init(&channel->inbound_lock); spin_lock_init(&channel->lock); INIT_LIST_HEAD(&channel->sc_list); diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index f8a1649e4c63..8d955db6424f 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1206,13 +1206,13 @@ static int storvsc_connect_to_vsp(struct hv_device *device, u32 ring_size, static int storvsc_dev_remove(struct hv_device *device) { struct storvsc_device *stor_device; - unsigned long flags; stor_device = hv_get_drvdata(device); - spin_lock_irqsave(&device->channel->inbound_lock, flags); stor_device->destroy = true; - spin_unlock_irqrestore(&device->channel->inbound_lock, flags); + + /* Make sure flag is set before waiting */ + wmb(); /* * At this point, all outbound traffic should be disable. We @@ -1229,9 +1229,7 @@ static int storvsc_dev_remove(struct hv_device *device) * we have drained - to drain the outgoing packets, we need to * allow incoming packets. */ - spin_lock_irqsave(&device->channel->inbound_lock, flags); hv_set_drvdata(device, NULL); - spin_unlock_irqrestore(&device->channel->inbound_lock, flags); /* Close the channel */ vmbus_close(device->channel); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index e09fc8290c2f..b7d7bbec74e0 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -744,7 +744,6 @@ struct vmbus_channel { u32 ringbuffer_pagecount; struct hv_ring_buffer_info outbound; /* send to parent */ struct hv_ring_buffer_info inbound; /* receive from parent */ - spinlock_t inbound_lock; struct vmbus_close_msg close_msg;