Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp634108ybt; Wed, 17 Jun 2020 09:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys8FzSyqH2nk81vAIimlsmyVCp1E4a/3XCDmUEMEfJSnHMOBgHgdwKeF+C8gRG8kUMoyWz X-Received: by 2002:a17:906:1149:: with SMTP id i9mr134211eja.100.1592412871020; Wed, 17 Jun 2020 09:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592412871; cv=none; d=google.com; s=arc-20160816; b=TBdv0hdra6s4v9G/fhBrN/TYni8t4vcdnC5cYKVc1gW1L7Wu4q+8C+k3NkjWyuRxuh pBBie15xrAfDBrNysH9WzKStIpZJJx+XCdrhvUHuKzLhZ789cmVBlGqBT51MgO47QlB0 eDWDDeUOjCn6+Tx6KCOpUBbaiP+mx29RxnmkzpgMQsguHuFtjHLO0guawtpuF3Hz8Pjh r7qX2qf7DflVbAlUWoQTnhdceUqE1KGZD2ar+gE25gos63A4VcZrJKLOEeeVfCjlOeLz ABKBCV1JWovh6wQa+iRSB25exMhihuIHISg6002dfXmYRSfjiDCFRCc/tLgBy6Bn2Kfa /8NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jO6YYKLcVc4zVnNFJ3vwcO4SaIx1I79j4ycIlYEFriM=; b=dSuvEcJkeHy+/KbxE2h4MPj8eC14+sjCjuZVm0pgmXa/8yhCTgSv3a5T81Vg2xoCy2 9qal7BV5hw/kkrqsRZB1ezyneZhuPKLtWEM877HQvJsxEws1fGbK5a5bXeDkoL0Z5Fxa iDONnHVyxfMD8YMgARliRDvjMywaIFX753F9JdqovygKCzOgAIqzTQKSFYF5XyX6dzHy ofQ2RIGntZvoMJx6Cies5Cyg880Eu+Cf44YpSBMRm82iiEKkH1DFj6AmVjju/LjAqn64 LIi74lMb4dzzZhO+rAljYTa5quO3W9bkGHpEeBiH7++EXU+wABxnk2N/XqagPt+rOYCn JPuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dGPuDDIv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si360492eds.79.2020.06.17.09.54.08; Wed, 17 Jun 2020 09:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dGPuDDIv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727894AbgFQQtX (ORCPT + 99 others); Wed, 17 Jun 2020 12:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgFQQsJ (ORCPT ); Wed, 17 Jun 2020 12:48:09 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34B91C0613ED; Wed, 17 Jun 2020 09:48:09 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id e1so3088678wrt.5; Wed, 17 Jun 2020 09:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jO6YYKLcVc4zVnNFJ3vwcO4SaIx1I79j4ycIlYEFriM=; b=dGPuDDIvXNEAfIMnvc6hzhIro0ysybgDo0L+ZYIyozSv6xaJx9m7uAQkGe1x+2DC0+ eiAABPwv27e67/k3fYv9ibRHiBjborGi+5GkyFUFaXD9CAKOmgGXw5nNMjtoRd2Scqkr LBGoYPjTRBntsJCj9OmNIRRAeAwfpAMT8nxp+G4O3zp4hNCEexTbdsbhSIq1ymKpDYBN VPv7d84x2hO/SBcBMgj+kiI1Ik7HSo0Km4HOuNiUHd9V24IAUT3Vp1qgTRAXdQZrEO6k Uq6ceySpT6bIhxV36j3uk9imhs0UJDBjrWkqXGFeV5m2zK5A3Ygu0o/sxMTpGAVq9TI0 2YLA== 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:mime-version:content-transfer-encoding; bh=jO6YYKLcVc4zVnNFJ3vwcO4SaIx1I79j4ycIlYEFriM=; b=ISP7Vm+l0GNDPazJaoc6OpR1KZk8cz8YgqaN3loS6SNwPLkDACjlCPql1b7B93xaYG 86aOhxxAE5GALQqhJNkUenDMTC5Zx0Gd+F5tqn5J1SGEVd20aoXXSxzkiV1Rp5tJat+g lvRSVMVeUl0eSTLRyxbxeTBiZkHSP4P8Ui0mh8aWWpazRRr1BXf3UVD3WpRs6T5YVjXq /8JF1oGLlNi4zjOGAncdurMai7q/7xjmPcRQvhTII/Or1ZXj2r+CboArZWw9TXCsBq5m oeXuRF3csKDLdc9nHK+q1fI5/yJasTeC8yrgxO86NVRGaB53TVXqAWrZcmNJzvpbPBix vQOg== X-Gm-Message-State: AOAM530JSMrrOP0mvfz18dsZwin1fiCWdJW89Z3fskhHX88grKrFQpj/ OAQnEOAQ+5kNGj4sdvFIMfxe41l7Z2BZhw== X-Received: by 2002:a5d:468d:: with SMTP id u13mr150370wrq.73.1592412487715; Wed, 17 Jun 2020 09:48:07 -0700 (PDT) Received: from localhost.localdomain (ip-213-220-210-175.net.upcbroadband.cz. [213.220.210.175]) by smtp.gmail.com with ESMTPSA id g3sm199165wrb.46.2020.06.17.09.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 09:48:07 -0700 (PDT) From: "Andrea Parri (Microsoft)" To: "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Michael Kelley Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, "Andrea Parri (Microsoft)" Subject: [PATCH 8/8] Drivers: hv: vmbus: Remove the lock field from the vmbus_channel struct Date: Wed, 17 Jun 2020 18:46:42 +0200 Message-Id: <20200617164642.37393-9-parri.andrea@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200617164642.37393-1-parri.andrea@gmail.com> References: <20200617164642.37393-1-parri.andrea@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The spinlock is (now) *not used to protect test-and-set accesses to attributes of the structure or sc_list operations. There is, AFAICT, a distinct lack of {WRITE,READ}_ONCE()s in the handling of channel->state, but the changes below do not seem to make things "worse". ;-) Signed-off-by: Andrea Parri (Microsoft) --- drivers/hv/channel.c | 6 +----- drivers/hv/channel_mgmt.c | 1 - include/linux/hyperv.h | 6 ------ 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 8848d1548b3f2..3ebda7707e46a 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -129,12 +129,8 @@ static int __vmbus_open(struct vmbus_channel *newchannel, send_pages = newchannel->ringbuffer_send_offset; recv_pages = newchannel->ringbuffer_pagecount - send_pages; - spin_lock_irqsave(&newchannel->lock, flags); - if (newchannel->state != CHANNEL_OPEN_STATE) { - spin_unlock_irqrestore(&newchannel->lock, flags); + if (newchannel->state != CHANNEL_OPEN_STATE) return -EINVAL; - } - spin_unlock_irqrestore(&newchannel->lock, flags); newchannel->state = CHANNEL_OPENING_STATE; newchannel->onchannel_callback = onchannelcallback; diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 92f8bb2077a94..591106cf58fc0 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -317,7 +317,6 @@ static struct vmbus_channel *alloc_channel(void) return NULL; spin_lock_init(&channel->sched_lock); - spin_lock_init(&channel->lock); init_completion(&channel->rescind_event); INIT_LIST_HEAD(&channel->sc_list); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 690394b79d727..38100e80360ac 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -840,12 +840,6 @@ struct vmbus_channel { */ void (*chn_rescind_callback)(struct vmbus_channel *channel); - /* - * The spinlock to protect the structure. It is being used to protect - * test-and-set access to various attributes of the structure as well - * as all sc_list operations. - */ - spinlock_t lock; /* * All Sub-channels of a primary channel are linked here. */ -- 2.25.1