From: "Andrea Parri (Microsoft)" <parri.andrea@gmail.com>
To: "K . Y . Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>,
Michael Kelley <mikelley@microsoft.com>
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
"Andrea Parri (Microsoft)" <parri.andrea@gmail.com>
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 [thread overview]
Message-ID: <20200617164642.37393-7-parri.andrea@gmail.com> (raw)
In-Reply-To: <20200617164642.37393-1-parri.andrea@gmail.com>
None of the readers/updaters of sc_list rely on channel->lock for
synchronization.
Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
---
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
next prev parent reply other threads:[~2020-06-17 16:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 16:46 [PATCH 0/8] Drivers: hv: vmbus: Miscellaneous cleanups Andrea Parri (Microsoft)
2020-06-17 16:46 ` [PATCH 1/8] Drivers: hv: vmbus: Remove the target_vp field from the vmbus_channel struct Andrea Parri (Microsoft)
2020-06-18 15:24 ` Michael Kelley
2020-06-17 16:46 ` [PATCH 2/8] Drivers: hv: vmbus: Remove the numa_node " Andrea Parri (Microsoft)
2020-06-18 15:26 ` Michael Kelley
2020-06-17 16:46 ` [PATCH 3/8] Drivers: hv: vmbus: Replace cpumask_test_cpu(, cpu_online_mask) with cpu_online() Andrea Parri (Microsoft)
2020-06-18 15:27 ` Michael Kelley
2020-06-17 16:46 ` [PATCH 4/8] Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (sc_list readers) Andrea Parri (Microsoft)
2020-06-18 15:29 ` Michael Kelley
2020-06-17 16:46 ` [PATCH 5/8] Drivers: hv: vmbus: Use channel_mutex in channel_vp_mapping_show() Andrea Parri (Microsoft)
2020-06-18 18:31 ` Michael Kelley
2020-06-17 16:46 ` Andrea Parri (Microsoft) [this message]
2020-06-18 18:32 ` [PATCH 6/8] Drivers: hv: vmbus: Remove unnecessary channel->lock critical sections (sc_list updaters) Michael Kelley
2020-06-17 16:46 ` [PATCH 7/8] scsi: storvsc: Introduce the per-storvsc_device spinlock Andrea Parri (Microsoft)
2020-06-18 18:34 ` Michael Kelley
2020-06-19 16:01 ` Wei Liu
2020-06-19 16:18 ` Andrea Parri
2020-06-20 2:58 ` Martin K. Petersen
2020-06-20 9:15 ` Wei Liu
2020-06-17 16:46 ` [PATCH 8/8] Drivers: hv: vmbus: Remove the lock field from the vmbus_channel struct Andrea Parri (Microsoft)
2020-06-18 18:35 ` Michael Kelley
2020-06-19 15:39 ` [PATCH 0/8] Drivers: hv: vmbus: Miscellaneous cleanups Wei Liu
2020-06-19 15:56 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200617164642.37393-7-parri.andrea@gmail.com \
--to=parri.andrea@gmail.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikelley@microsoft.com \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).