FAILED: patch "[PATCH] vmbus: fix subchannel removal" failed to apply to 4.20-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.20-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From b5679cebf780c6f1c2451a73bf1842a4409840e7 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Wed, 9 Jan 2019 20:56:06 +0000
Subject: [PATCH] vmbus: fix subchannel removal
The changes to split ring allocation from open/close, broke the cleanup of subchannels. This resulted in problems using uio on network devices because the subchannel was left behind when the network device was unbound.
The cause was in the disconnect logic which used list splice to move the subchannel list into a local variable. This won't work because the subchannel list is needed later during the process of the rescind messages (relid2channel).
The fix is to just leave the subchannel list in place which is what the original code did. The list is cleaned up later when the host rescind is processed.
Without the fix, we have a lot of "hang" issues in netvsc when we try to change the NIC's MTU, set the number of channels, etc.
drivers/hv/channel.c +1 -8
@@ -701,19 +701,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel)int vmbus_disconnect_ring (struct vmbus_channel *channel) {struct vmbus_channel *cur_channel, *tmp; -unsigned long flags; -LIST_HEAD (list);int ret;if (channel->primary_channel !=NULL )return -EINVAL ; -/* Snapshot the list of subchannels */ -spin_lock_irqsave (&channel->lock, flags); -list_splice_init (&channel->sc_list, &list); -spin_unlock_irqrestore (&channel->lock, flags); - -list_for_each_entry_safe (cur_channel, tmp, &list, sc_list) { +list_for_each_entry_safe (cur_channel, tmp, &channel->sc_list, sc_list) {if (cur_channel->rescind)wait_for_completion (&cur_channel->rescind_event);
Dexuan Cui
maintainerQuoted 65 lines
From: [email protected] <[email protected]>
Sent: Monday, January 28, 2019 4:35 AM
To: Dexuan Cui <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] vmbus: fix subchannel removal" failed to apply to 4.20-stable treeThe patch below does not apply to the 4.20-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
b5679cebf780c6f1c2451a73bf1842a4409840e7Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Wed, 9 Jan 2019 20:56:06 +0000
Subject: [PATCH] vmbus: fix subchannel removalThe changes to split ring allocation from open/close, broke the cleanup of subchannels. This resulted in problems using uio on network devices because the subchannel was left behind when the network device was unbound.
The cause was in the disconnect logic which used list splice to move the subchannel list into a local variable. This won't work because the subchannel list is needed later during the process of the rescind messages (relid2channel).
The fix is to just leave the subchannel list in place which is what the original code did. The list is cleaned up later when the host rescind is processed.
Without the fix, we have a lot of "hang" issues in netvsc when we try to change the NIC's MTU, set the number of channels, etc.
Fixes ae6935ed7d42 ("vmbus: split ring buffer allocation from open")Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Dexuan Cui <[email protected]>Signed-off-by Sasha Levin <[email protected]>drivers/hv/channel.c +0
-2@@ -701,19 +701,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel)int vmbus_disconnect_ring (struct vmbus_channel *channel) {struct vmbus_channel *cur_channel, *tmp; -unsigned long flags; -LIST_HEAD (list);int ret;if (channel->primary_channel !=NULL )return -EINVAL ;
drivers/hv/channel.c static int vmbus_close_internal(struct · line 712
Quoted 10 lines
drivers/hv/channel.c +1
-6-/* Snapshot the list of subchannels */ -spin_lock_irqsave (&channel->lock, flags); -list_splice_init (&channel->sc_list, &list); -spin_unlock_irqrestore (&channel->lock, flags); - -list_for_each_entry_safe (cur_channel, tmp, &list, sc_list) { +list_for_each_entry_safe (cur_channel, tmp, &channel->sc_list, sc_list) {if (cur_channel->rescind)wait_for_completion (&cur_channel->rescind_event);
Hi Sasha, Greg,
We need to backport this patch to linux-4.20.y. To cleanly cherry-pick this patch (i.e. b5679cebf780 ("vmbus: fix subchannel removal")), we need to backport another patch first:
4d3c5c69191f ("Drivers: hv: vmbus: Remove the useless API vmbus_get_outgoing_channel()")
Unluckily we can't cleanly git-cherry-pick 4d3c5c69191f, as a trivial rebase is required. I attached the rebased version, and let me also paste the patch below for your convenience.
Thanks,
-- Dexuan
From 5975e6868fd7294d66664fffad48b61f576a9e11 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Mon, 26 Nov 2018 02:17:56 +0000
Subject: [PATCH] Drivers: hv: vmbus: Remove the useless API
vmbus_get_outgoing_channel()
Commit d86adf482b84 ("scsi: storvsc: Enable multi-queue support") removed the usage of the API in Jan 2017, and the API is not used since then.
netvsc and storvsc have their own algorithms to determine the outgoing channel, so this API is useless.
And the API is potentially unsafe, because it reads primary->num_sc without any lock held. This can be risky considering the RESCIND-OFFER message.
Let's remove the API.
--- drivers/hv/channel.c | 1 - drivers/hv/channel_mgmt.c | 44 --------------------------------------- include/linux/hyperv.h | 17 --------------- 3 files changed, 62 deletions(-)
drivers/hv/channel.c +0 -1
@@ -711,7 +711,6 @@ int vmbus_disconnect_ring(struct vmbus_channel *channel)/* Snapshot the list of subchannels */ spin_lock_irqsave (&channel->lock, flags);list_splice_init (&channel->sc_list, &list); - channel->num_sc =0 ;spin_unlock_irqrestore (&channel->lock, flags);list_for_each_entry_safe (cur_channel, tmp, &list, sc_list) {
drivers/hv/channel_mgmt.c +0 -44
56 lines not on this page · raw message
include/linux/hyperv.h +0 -17
@@ -830,15 +830,6 @@ struct vmbus_channel {* All Sub-channels of a primary channel are linked here. */ struct list_head sc_list; -/* -* Current number of sub-channels. -*/ -int num_sc; -/* -* Number of a sub-channel (position within sc_list) which is supposed -* to be used as the next outgoing channel. -*/ -int next_oc;/* * The primary channel this sub-channel belongs to. * This will be NULL for the primary channel.
@@ -972,14 +963,6 @@ void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,void vmbus_set_chn_rescind_callback (struct vmbus_channel *channel,void (*chn_rescind_cb)(struct vmbus_channel *)); -/* -* Retrieve the (sub) channel on which to send an outgoing request. -* When a primary channel has multiple sub-channels, we choose a -* channel whose VCPU binding is closest to the VCPU on which -* this call is being made. -*/ -struct vmbus_channel *vmbus_get_outgoing_channel (struct vmbus_channel *primary); -/* * Check if sub-channels have already been offerred. This API will be useful * when the driver is unloaded after establishing sub-channels. In this case,
Signature · 1 line
2.17.1
From 5975e6868fd7294d66664fffad48b61f576a9e11 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Mon, 26 Nov 2018 02:17:56 +0000
Subject: [PATCH] Drivers: hv: vmbus: Remove the useless API
vmbus_get_outgoing_channel()
Commit d86adf482b84 ("scsi: storvsc: Enable multi-queue support") removed the usage of the API in Jan 2017, and the API is not used since then.
netvsc and storvsc have their own algorithms to determine the outgoing channel, so this API is useless.
And the API is potentially unsafe, because it reads primary->num_sc without any lock held. This can be risky considering the RESCIND-OFFER message.
Let's remove the API.
--- drivers/hv/channel.c | 1 - drivers/hv/channel_mgmt.c | 44 --------------------------------------- include/linux/hyperv.h | 17 --------------- 3 files changed, 62 deletions(-)
drivers/hv/channel.c +0 -1
@@ -711,7 +711,6 @@ int vmbus_disconnect_ring(struct vmbus_channel *channel)/* Snapshot the list of subchannels */ spin_lock_irqsave (&channel->lock, flags);list_splice_init (&channel->sc_list, &list); - channel->num_sc =0 ;spin_unlock_irqrestore (&channel->lock, flags);list_for_each_entry_safe (cur_channel, tmp, &list, sc_list) {
drivers/hv/channel_mgmt.c +0 -44
56 lines not on this page · raw message
include/linux/hyperv.h +0 -17
@@ -830,15 +830,6 @@ struct vmbus_channel {* All Sub-channels of a primary channel are linked here. */ struct list_head sc_list; -/* -* Current number of sub-channels. -*/ -int num_sc; -/* -* Number of a sub-channel (position within sc_list) which is supposed -* to be used as the next outgoing channel. -*/ -int next_oc;/* * The primary channel this sub-channel belongs to. * This will be NULL for the primary channel.
@@ -972,14 +963,6 @@ void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,void vmbus_set_chn_rescind_callback (struct vmbus_channel *channel,void (*chn_rescind_cb)(struct vmbus_channel *)); -/* -* Retrieve the (sub) channel on which to send an outgoing request. -* When a primary channel has multiple sub-channels, we choose a -* channel whose VCPU binding is closest to the VCPU on which -* this call is being made. -*/ -struct vmbus_channel *vmbus_get_outgoing_channel (struct vmbus_channel *primary); -/* * Check if sub-channels have already been offerred. This API will be useful * when the driver is unloaded after establishing sub-channels. In this case,
Signature · 1 line
2.17.1
Sasha Levin
maintainerQuoted 81 lines · Dexuan Cui
Quoted 65 lines
From: [email protected] <[email protected]>
Sent: Monday, January 28, 2019 4:35 AM
To: Dexuan Cui <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] vmbus: fix subchannel removal" failed to apply to 4.20-stable treeThe patch below does not apply to the 4.20-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
b5679cebf780c6f1c2451a73bf1842a4409840e7Mon Sep 17 00:00:00 2001
From: Dexuan Cui <[email protected]>
Date: Wed, 9 Jan 2019 20:56:06 +0000
Subject: [PATCH] vmbus: fix subchannel removalThe changes to split ring allocation from open/close, broke the cleanup of subchannels. This resulted in problems using uio on network devices because the subchannel was left behind when the network device was unbound.
The cause was in the disconnect logic which used list splice to move the subchannel list into a local variable. This won't work because the subchannel list is needed later during the process of the rescind messages (relid2channel).
The fix is to just leave the subchannel list in place which is what the original code did. The list is cleaned up later when the host rescind is processed.
Without the fix, we have a lot of "hang" issues in netvsc when we try to change the NIC's MTU, set the number of channels, etc.
Fixes ae6935ed7d42 ("vmbus: split ring buffer allocation from open")Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Dexuan Cui <[email protected]>Signed-off-by Sasha Levin <[email protected]>drivers/hv/channel.c +0
-2@@ -701,19 +701,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel)int vmbus_disconnect_ring (struct vmbus_channel *channel) {struct vmbus_channel *cur_channel, *tmp; -unsigned long flags; -LIST_HEAD (list);int ret;if (channel->primary_channel !=NULL )return -EINVAL ;drivers/hv/channel.c static int vmbus_close_internal(struct · line 712
Quoted 10 lines
drivers/hv/channel.c +1
-6-/* Snapshot the list of subchannels */ -spin_lock_irqsave (&channel->lock, flags); -list_splice_init (&channel->sc_list, &list); -spin_unlock_irqrestore (&channel->lock, flags); - -list_for_each_entry_safe (cur_channel, tmp, &list, sc_list) { +list_for_each_entry_safe (cur_channel, tmp, &channel->sc_list, sc_list) {if (cur_channel->rescind)wait_for_completion (&cur_channel->rescind_event);Hi Sasha, Greg,
We need to backport this patch to linux-4.20.y. To cleanly cherry-pick this patch (i.e.b5679cebf780("vmbus: fix subchannel removal")), we need to backport another patch first:
Quoted 5 lines
4d3c5c69191f("Drivers: hv: vmbus: Remove the useless APIvmbus_get_outgoing_channel()")Unluckily we can't cleanly git-cherry-pick
4d3c5c69191f, as a trivial rebase is required. I attached the rebased version, and let me also paste the patch below for your convenience.
I've queued your backport of 4d3c5c69191f and b5679cebf780 on top of it for 4.20, thank you.
--
Thanks,
Sasha