aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2015-08-13 20:07:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-21 01:44:51 -0400
commitca1c4b745779e20711322b3338f3a942a3c1224a (patch)
treee00109b8946c60e9199ada23604860750d3c212e /drivers/hv
parent5964db08767fb93376c0a0ddcf975fec1c0d1bd9 (diff)
Drivers: hv: vmbus: fix init_vp_index() for reloading hv_netvsc
This fixes the recent commit 3b71107d73b16074afa7658f3f0fcf837aabfe24: Drivers: hv: vmbus: Further improve CPU affiliation logic Without the fix, reloading hv_netvsc hangs the guest. Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/channel_mgmt.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 2f9aead4ecfc..652afd11a9ef 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -204,6 +204,8 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
204 spin_lock_irqsave(&vmbus_connection.channel_lock, flags); 204 spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
205 list_del(&channel->listentry); 205 list_del(&channel->listentry);
206 spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags); 206 spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
207
208 primary_channel = channel;
207 } else { 209 } else {
208 primary_channel = channel->primary_channel; 210 primary_channel = channel->primary_channel;
209 spin_lock_irqsave(&primary_channel->lock, flags); 211 spin_lock_irqsave(&primary_channel->lock, flags);
@@ -211,6 +213,14 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid)
211 primary_channel->num_sc--; 213 primary_channel->num_sc--;
212 spin_unlock_irqrestore(&primary_channel->lock, flags); 214 spin_unlock_irqrestore(&primary_channel->lock, flags);
213 } 215 }
216
217 /*
218 * We need to free the bit for init_vp_index() to work in the case
219 * of sub-channel, when we reload drivers like hv_netvsc.
220 */
221 cpumask_clear_cpu(channel->target_cpu,
222 &primary_channel->alloced_cpus_in_node);
223
214 free_channel(channel); 224 free_channel(channel);
215} 225}
216 226
@@ -458,6 +468,13 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui
458 continue; 468 continue;
459 } 469 }
460 470
471 /*
472 * NOTE: in the case of sub-channel, we clear the sub-channel
473 * related bit(s) in primary->alloced_cpus_in_node in
474 * hv_process_channel_removal(), so when we reload drivers
475 * like hv_netvsc in SMP guest, here we're able to re-allocate
476 * bit from primary->alloced_cpus_in_node.
477 */
461 if (!cpumask_test_cpu(cur_cpu, 478 if (!cpumask_test_cpu(cur_cpu,
462 &primary->alloced_cpus_in_node)) { 479 &primary->alloced_cpus_in_node)) {
463 cpumask_set_cpu(cur_cpu, 480 cpumask_set_cpu(cur_cpu,