Skip to contentSkip to conversation

Drivers: hv: vmbus: fix init_vp_index() for reloading hv_netvsc

PATCH In review K. Y. Srinivasan 3 participants 4 messages Aug 13, 2015 – Aug 14, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drivers: hv: vmbus: fix init_vp_index() for reloading hv_netvsc

From: Dexuan Cui <[email protected]>

This fixes the recent commit 3b71107d73b16074afa7658f3f0fcf837aabfe24:
Drivers: hv: vmbus: Further improve CPU affiliation logic

Without the fix, reloading hv_netvsc hangs the guest.

---
 drivers/hv/channel_mgmt.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/hv/channel_mgmt.c +17 -0
index 3ab4753..8a4105c 100644
@@ -204,6 +204,8 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
 		spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
 		list_del(&channel->listentry);
 		spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+
+		primary_channel = channel;
 	} else {
 		primary_channel = channel->primary_channel;
 		spin_lock_irqsave(&primary_channel->lock, flags);
@@ -211,6 +213,14 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
 		primary_channel->num_sc--;
 		spin_unlock_irqrestore(&primary_channel->lock, flags);
 	}
+
+	/*
+	 * We need to free the bit for init_vp_index() to work in the case
+	 * of sub-channel, when we reload drivers like hv_netvsc.
+	 */
+	cpumask_clear_cpu(channel->target_cpu,
+			  &primary_channel->alloced_cpus_in_node);
+
 	free_channel(channel);
 }
 
@@ -457,6 +467,13 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui
 			continue;
 		}
 
+		/*
+		 * NOTE: in the case of sub-channel, we clear the sub-channel
+		 * related bit(s) in primary->alloced_cpus_in_node in
+		 * hv_process_channel_removal(), so when we reload drivers
+		 * like hv_netvsc in SMP guest, here we're able to re-allocate
+		 * bit from primary->alloced_cpus_in_node.
+		 */
 		if (!cpumask_test_cpu(cur_cpu,
 				&primary->alloced_cpus_in_node)) {
 			cpumask_set_cpu(cur_cpu,
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw
Quoted 3 lines · K. Y. Srinivasan

From: Dexuan Cui <[email protected]>

This fixes the recent commit 3b71107d73b16074afa7658f3f0fcf837aabfe24:

Which tree is this in? upstream linus is giving me bad object on that id.

Quoted 3 lines

Drivers: hv: vmbus: Further improve CPU affiliation logic

Without the fix, reloading hv_netvsc hangs the guest.

The reason for looking for the commit id was to see if cc to stable was necessary, is it?

James

Quoted 48 lines
---
 drivers/hv/channel_mgmt.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/hv/channel_mgmt.c +17 -0
index 3ab4753..8a4105c 100644
@@ -204,6 +204,8 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
 		spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
 		list_del(&channel->listentry);
 		spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+
+		primary_channel = channel;
 	} else {
 		primary_channel = channel->primary_channel;
 		spin_lock_irqsave(&primary_channel->lock, flags);
@@ -211,6 +213,14 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
 		primary_channel->num_sc--;
 		spin_unlock_irqrestore(&primary_channel->lock, flags);
 	}
+
+	/*
+	 * We need to free the bit for init_vp_index() to work in the case
+	 * of sub-channel, when we reload drivers like hv_netvsc.
+	 */
+	cpumask_clear_cpu(channel->target_cpu,
+			  &primary_channel->alloced_cpus_in_node);
+
 	free_channel(channel);
 }
 
@@ -457,6 +467,13 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui
 			continue;
 		}
 
+		/*
+		 * NOTE: in the case of sub-channel, we clear the sub-channel
+		 * related bit(s) in primary->alloced_cpus_in_node in
+		 * hv_process_channel_removal(), so when we reload drivers
+		 * like hv_netvsc in SMP guest, here we're able to re-allocate
+		 * bit from primary->alloced_cpus_in_node.
+		 */
 		if (!cpumask_test_cpu(cur_cpu,
 				&primary->alloced_cpus_in_node)) {
 			cpumask_set_cpu(cur_cpu,
#2 lore raw
Quoted 8 lines · James Bottomley
Quoted 3 lines · K. Y. Srinivasan

From: Dexuan Cui <[email protected]>

This fixes the recent commit 3b71107d73b16074afa7658f3f0fcf837aabfe24:

Which tree is this in? upstream linus is giving me bad object on that id.

It's in Greg's char-misc-next tree. I like to have the commit id so I can look at buggy patches.

regards,
dan carpenter

#3 lore raw
In reply to James Bottomley
Quoted 14 lines

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Thursday, August 13, 2015 4:09 PM
To: KY Srinivasan <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Dexuan Cui <[email protected]>
Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: fix init_vp_index() for reloading hv_netvsc

Quoted 7 lines
Quoted 3 lines · K. Y. Srinivasan

From: Dexuan Cui <[email protected]>

This fixes the recent commit 3b71107d73b16074afa7658f3f0fcf837aabfe24:

Which tree is this in? upstream linus is giving me bad object on that id.

Greg's char-misc tree.

Quoted 8 lines
Quoted 5 lines

Drivers: hv: vmbus: Further improve CPU affiliation logic

Without the fix, reloading hv_netvsc hangs the guest.

The reason for looking for the commit id was to see if cc to stable was necessary, is it?

The offending patch was committed on August 5th and cc to stable was not necessary.

K. Y

Quoted 58 lines

James

drivers/hv/channel_mgmt.c void hv_process_channel_removal(struct

Quoted 11 lines
---
 drivers/hv/channel_mgmt.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/hv/channel_mgmt.c +0 -0
index 3ab4753..8a4105c 100644
@@ -204,6 +204,8 @@ void hv_process_channel_removal(struct

vmbus_channel *channel, u32 relid)

drivers/hv/channel_mgmt.c void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)

Quoted 3 lines
drivers/hv/channel_mgmt.c +0 -0
 		spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
 		list_del(&channel->listentry);
 		spin_unlock_irqrestore(&vmbus_connection.channel_lock,

flags);

drivers/hv/channel_mgmt.c void hv_process_channel_removal(struct

Quoted 6 lines
drivers/hv/channel_mgmt.c +2 -0
+
+		primary_channel = channel;
 	} else {
 		primary_channel = channel->primary_channel;
 		spin_lock_irqsave(&primary_channel->lock, flags);
@@ -211,6 +213,14 @@ void hv_process_channel_removal(struct

vmbus_channel *channel, u32 relid)

drivers/hv/channel_mgmt.c static void init_vp_index(struct vmbus_channel

Quoted 15 lines
drivers/hv/channel_mgmt.c +8 -0
 		primary_channel->num_sc--;
 		spin_unlock_irqrestore(&primary_channel->lock, flags);
 	}
+
+	/*
+	 * We need to free the bit for init_vp_index() to work in the case
+	 * of sub-channel, when we reload drivers like hv_netvsc.
+	 */
+	cpumask_clear_cpu(channel->target_cpu,
+			  &primary_channel->alloced_cpus_in_node);
+
 	free_channel(channel);
 }
 
@@ -457,6 +467,13 @@ static void init_vp_index(struct vmbus_channel

*channel, const uuid_le *type_gui

drivers/hv/channel_mgmt.c static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui

Quoted 7 lines
drivers/hv/channel_mgmt.c +4 -0
 			continue;
 		}
 
+		/*
+		 * NOTE: in the case of sub-channel, we clear the sub-channel
+		 * related bit(s) in primary->alloced_cpus_in_node in
+		 * hv_process_channel_removal(), so when we reload

drivers

Quoted 6 lines
drivers/hv/channel_mgmt.c +3 -0
+		 * like hv_netvsc in SMP guest, here we're able to re-allocate
+		 * bit from primary->alloced_cpus_in_node.
+		 */
 		if (!cpumask_test_cpu(cur_cpu,
 				&primary->alloced_cpus_in_node)) {
 			cpumask_set_cpu(cur_cpu,