Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp631763ybt; Wed, 17 Jun 2020 09:50:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5c7n0T1+WBmGqiRyFa4kHivKwrJCtob/YbG9UKXe4xyHDar3Tgql9+osT9jXMojCm97Pe X-Received: by 2002:a17:906:c2c6:: with SMTP id ch6mr109032ejb.36.1592412632225; Wed, 17 Jun 2020 09:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592412632; cv=none; d=google.com; s=arc-20160816; b=osrGhLwZn9DBdx8n7tlbHrbkknl+rpstdUNzYujG3OYimLcYj/aokkDQEz36h7FVBg v/nkISVLKJalVKPxBhMS3A7v2Oy1StFhAAD9ocMMcp0ASUgVcHeNWYzW1673JgoJ48bZ folKR57MDswdd1Lj07saXOPRtUFQVL0As+pa7IPLDS2SNyw6bcptnoyrf4OLzAxi7O9c cks0w2LVPz6ASZPRX+a8dNmj04Tj8TwDfhDMnII7V3V8Z5I28orhGVwEODMrBl4NgsfY UKplKNB3kTjlJ+rhnSf7+vf6tvDiZbUQ1s+ycZ8t9C0kKab+z0sp0yTdCcHcraboWPuS Sv4A== 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=3Go2fiYakbW2vKFMOGcvytm/DxMDEAhQetDDWkR8rDU=; b=DJGUHGRHa3I9/FFSlqkQUfCfwiZlSzNZcRTd3l8qHQVuOSrVvDvC7GvIy4ynvzcg+P mHv72fRZYR3foIHz72BDF0RRbLmaldKrcTfhHPz6WlJ+oHXGFsnPJeipmfjljUd1ii6k NM/oA8d8up2DDs8ExyHdOeMXgXyn3I3HaUj/RAnYFcwvZqjO7k+zwHQ3WjZvQB20Xv5b ZUrmWvu+jJsJBSvQxgeXGbGNjHfrPNVX7c8sXOokMT7g1CuZRwBIWnqGPeYqlL8pKYOP MXbIXrnyFpKhDnOb3VFurk8SFWCL/W0o9t2uy4XjpF72qw8UuGFf9H/gt+du1Mzu7eyu jP2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dbwR1PLk; 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 cf29si327350edb.419.2020.06.17.09.50.09; Wed, 17 Jun 2020 09:50:32 -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=dbwR1PLk; 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 S1727031AbgFQQsF (ORCPT + 99 others); Wed, 17 Jun 2020 12:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbgFQQsD (ORCPT ); Wed, 17 Jun 2020 12:48:03 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F18AFC061755; Wed, 17 Jun 2020 09:48:02 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id q2so640506wrv.8; Wed, 17 Jun 2020 09:48:02 -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=3Go2fiYakbW2vKFMOGcvytm/DxMDEAhQetDDWkR8rDU=; b=dbwR1PLkSWkWkt85auklGLPY/7P6hUmrCUojRQE5zFLBJ6G62U/AOp84vfA4kF/H8C iFRXFavfXgjiWDo9F8UB4+w2Tw3fL7AWewIt2HokENO9+WIPDCASJ3J6dOqKf9mwt67/ FkKyPLANxrW3QeH1mhsRV2Z79Vo8iqcQSowwF06dVxr1s+4hrYzoo2/N8RBFloMJZGhu rFPKdZJ6Q1n7s/kIL/tTH7y2vrRmeFX19Dg93M0EcM6ZyRPzuyB/bdbjfCr6SvfUIw5l TpoiF5kLdd/FfXAu1Sj7g0nwIMDhrkR0DwLzMpMEPrFU7yE4l0+JTJigV0/OKM3S5CD3 mFsA== 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=3Go2fiYakbW2vKFMOGcvytm/DxMDEAhQetDDWkR8rDU=; b=erziG1rkSmH8rSYSGPmsTZd9I9oMZwrizd+BEtAofFcABRHF/UaKgLntknJlu+NjKH FSWDKgzndi4cXQle0amKIEEtDx4yWHV/wKfhhhzE7sJf+MSYA8R9lS/M90EBA2d+zKwB vlcKEgHuhaf2dJZBCL4JZW+Glk5JyBCzm3eaNkYpjXWjoLo81l/EG6Ny6kT7emZFgyVX 5Xr40Qby2YDGopEXJJus/0CYGturEYKCN3OTqx423llMrO+Vooq6nbEd8SFWVvNPv4hs m1raseN96zhUKHyxwUZpqQz/xBMkHXRGvrwan6K+m3kxVTeEoQgGAoABysLHF71D/QaC KGRg== X-Gm-Message-State: AOAM531AmiET+WTgvoudRZjXQW2+g016h7AetVoVxGbaNNY12UNrFJps JgLO63woQgo4meiFgYqXf6A= X-Received: by 2002:adf:c707:: with SMTP id k7mr146549wrg.382.1592412481502; Wed, 17 Jun 2020 09:48:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 09:48:01 -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 6/8] Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (sc_list updaters) Date: Wed, 17 Jun 2020 18:46:40 +0200 Message-Id: <20200617164642.37393-7-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 None of the readers/updaters of sc_list rely on channel->lock for synchronization. Signed-off-by: Andrea Parri (Microsoft) --- drivers/hv/channel_mgmt.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 36dd8b6c544a4..92f8bb2077a94 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -400,8 +400,6 @@ static void vmbus_release_relid(u32 relid) void hv_process_channel_removal(struct vmbus_channel *channel) { - unsigned long flags; - lockdep_assert_held(&vmbus_connection.channel_mutex); BUG_ON(!channel->rescind); @@ -422,14 +420,10 @@ void hv_process_channel_removal(struct vmbus_channel *channel) if (channel->offermsg.child_relid != INVALID_RELID) vmbus_channel_unmap_relid(channel); - if (channel->primary_channel == NULL) { + if (channel->primary_channel == NULL) list_del(&channel->listentry); - } else { - struct vmbus_channel *primary_channel = channel->primary_channel; - spin_lock_irqsave(&primary_channel->lock, flags); + else list_del(&channel->sc_list); - spin_unlock_irqrestore(&primary_channel->lock, flags); - } /* * If this is a "perf" channel, updates the hv_numa_map[] masks so that @@ -470,7 +464,6 @@ static void vmbus_add_channel_work(struct work_struct *work) struct vmbus_channel *newchannel = container_of(work, struct vmbus_channel, add_channel_work); struct vmbus_channel *primary_channel = newchannel->primary_channel; - unsigned long flags; int ret; /* @@ -531,13 +524,10 @@ static void vmbus_add_channel_work(struct work_struct *work) */ newchannel->probe_done = true; - if (primary_channel == NULL) { + if (primary_channel == NULL) list_del(&newchannel->listentry); - } else { - spin_lock_irqsave(&primary_channel->lock, flags); + else list_del(&newchannel->sc_list); - spin_unlock_irqrestore(&primary_channel->lock, flags); - } /* vmbus_process_offer() has mapped the channel. */ vmbus_channel_unmap_relid(newchannel); @@ -557,7 +547,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) { struct vmbus_channel *channel; struct workqueue_struct *wq; - unsigned long flags; bool fnew = true; /* @@ -609,10 +598,10 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) } } - if (fnew) + if (fnew) { list_add_tail(&newchannel->listentry, &vmbus_connection.chn_list); - else { + } else { /* * Check to see if this is a valid sub-channel. */ @@ -630,9 +619,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) * Process the sub-channel. */ newchannel->primary_channel = channel; - spin_lock_irqsave(&channel->lock, flags); list_add_tail(&newchannel->sc_list, &channel->sc_list); - spin_unlock_irqrestore(&channel->lock, flags); } vmbus_channel_map_relid(newchannel); -- 2.25.1