Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp631664ybt; Wed, 17 Jun 2020 09:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzo+xo7tIDN1EC03HNgc/CPUIELHu+PePU+pvfc86wurqYuU3VNzbvn/gA/U5m9fn8QaytT X-Received: by 2002:a05:6402:1486:: with SMTP id e6mr62198edv.99.1592412624537; Wed, 17 Jun 2020 09:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592412624; cv=none; d=google.com; s=arc-20160816; b=FIo5PfaI+iNkGVY4JFeOC8294IoPUtKtjWdXmzps2BPuJd9EZZRBydKPgo1Ck2cgep MGhmY9k56Tlc0c9mXBdk7BqbHGFsbcLaE8eeqEwXnX0ERuxXuDl5MNCA2GH7TZSWIllQ QWSUgcph9kgKG9cdLkqFCQ0MOPEOkfFLBaAOcS6AUlP2YBE6iLic2CIwXR1Jv2wCLyZq ArTDnfYWCiSpby+nAKKJvsnr+mUsDuzZAET5ZErtXcjEQn9y1RKXscA9tmIsytF7HTkn CgA85Jsf/WpiwgYEybxhVrscZkZyxiw02Bwqa+ZKzfdqeEfI9nBj5TfnfvZ8W1TnHnj1 XjQQ== 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=7ORuyjMnnXwMLSIeDovz3YoY1V6fNCALDgeCEXg6SIA=; b=crBPPgGby/OUJ/WsiC1npzHzgD4UH0QTMGkaeX+Sjz/JTSZUof1Xhm/4L6x5MODkr/ AyOfCIcEieF+IEtDroo1qSp7R0IeBM64ml31P7UL2NFvLz+ZYAHzj7sB2CtYFTqpfPAs CPt+U7v55ZHWvAvD/vfm6W062hYJlyd+Az1PQLCk/m6bwqv1yYCVlcNhqd8bybMlFr4f +PHGOmV3/wk4DKKjxCmAHumIEFpOGVfGed1xTCdF5RNf5SS6BY/YyMaHf28fA+oI4XuG oLuO2QgD3CwVgDzJ2DWx0DTas75ZQgZGGc4MVfUw1tLcx7eO+V0QRiQv/adF4KOp8DrK wRSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SJuPROnl; 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 v9si313411edr.417.2020.06.17.09.50.02; Wed, 17 Jun 2020 09:50:24 -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=SJuPROnl; 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 S1727007AbgFQQsB (ORCPT + 99 others); Wed, 17 Jun 2020 12:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726976AbgFQQr7 (ORCPT ); Wed, 17 Jun 2020 12:47:59 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 568C0C06174E; Wed, 17 Jun 2020 09:47:58 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id l26so2518278wme.3; Wed, 17 Jun 2020 09:47:58 -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=7ORuyjMnnXwMLSIeDovz3YoY1V6fNCALDgeCEXg6SIA=; b=SJuPROnlqweOFqWO6PVnR52VAPAIj0jUathvBUvgDVqrvlf2WhZP64Wd36soN1tC3B 3OMwEviDhXUavoHBuLFfpAYTFOYABZIBupQpzb8iXEn6zwiKxtrmTajue+h+JAFCOcwX 8NgF7gAqsHN7KR8RtJ6X6C6M5gJ8Sfm5V5jxHWL+LXcmV1XuH4e1nY/y5GMdFBDniIDq zyeYYsUeNWF1xDPzw/Yl8mtg7pDZxjXdpBFh4Iodb1AOWWW7s2DJxsze/9pnXZuBqD2c D78Xn1grxqnOKipMXkIFNQ4GafvgQAx0nXcNJAwhpcIHVkcUHu/LIuzOSBxaDO0lgQfJ f0hQ== 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=7ORuyjMnnXwMLSIeDovz3YoY1V6fNCALDgeCEXg6SIA=; b=c9yWsd+7yR6uZJo6AHo8TzEyOmxezj9ReocKVXjmXC0hs3rmJwWXfFDmHVi9fIitlO cnG3bl9taqeo7r2hmxcRYttImrxLh/FiTp6tofr8ZpjpoNY424CwVwyG0+DbR/2C4+jm 7+suVfc+khcLlNkdmw8LUMzjcDD1OgxpGmCHWW+TfFaAfczOJbz5A3zG71slDDjbWqBT jlHSUK0oCu23PAnfZhYhgLV0LMcDw/HV3XOMD7xTj/wp6GQVMheRvQT+5Z8nC1gfo95F xDXCBpbPtPiPAft18qMkt+p0V/yUCM/fXSxQruzeDJUQvMXxvTb8Ti4g71bu63kHOgM9 WAwQ== X-Gm-Message-State: AOAM532deZ6Bl3nGCDqPW+F/nepdKeum54Gw4te8Il8Hj+CHjckVsGZZ 8lZ00IHYmEDrOHdqzwDrKow= X-Received: by 2002:a1c:2cd7:: with SMTP id s206mr9141632wms.109.1592412476855; Wed, 17 Jun 2020 09:47:56 -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.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 09:47:56 -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 4/8] Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (sc_list readers) Date: Wed, 17 Jun 2020 18:46:38 +0200 Message-Id: <20200617164642.37393-5-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 Additions/deletions to/from sc_list (as well as modifications of target_cpu(s)) are protected by channel_mutex, which hv_synic_cleanup() and vmbus_bus_suspend() own for the duration of the channel->lock critical section in question. Signed-off-by: Andrea Parri (Microsoft) --- drivers/hv/hv.c | 3 --- drivers/hv/vmbus_drv.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 188b42b07f07b..0c637111e7c70 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -245,7 +245,6 @@ int hv_synic_cleanup(unsigned int cpu) { struct vmbus_channel *channel, *sc; bool channel_found = false; - unsigned long flags; /* * Hyper-V does not provide a way to change the connect CPU once @@ -267,14 +266,12 @@ int hv_synic_cleanup(unsigned int cpu) channel_found = true; break; } - spin_lock_irqsave(&channel->lock, flags); list_for_each_entry(sc, &channel->sc_list, sc_list) { if (sc->target_cpu == cpu) { channel_found = true; break; } } - spin_unlock_irqrestore(&channel->lock, flags); if (channel_found) break; } diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 452c14c656e2a..b5ae45eb8aef7 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2330,7 +2330,6 @@ static int vmbus_acpi_add(struct acpi_device *device) static int vmbus_bus_suspend(struct device *dev) { struct vmbus_channel *channel, *sc; - unsigned long flags; while (atomic_read(&vmbus_connection.offer_in_progress) != 0) { /* @@ -2388,12 +2387,10 @@ static int vmbus_bus_suspend(struct device *dev) continue; } - spin_lock_irqsave(&channel->lock, flags); list_for_each_entry(sc, &channel->sc_list, sc_list) { pr_err("Sub-channel not deleted!\n"); WARN_ON_ONCE(1); } - spin_unlock_irqrestore(&channel->lock, flags); atomic_inc(&vmbus_connection.nr_chan_fixup_on_resume); } -- 2.25.1