linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][re-post] vmbus: fix subchannel removal
@ 2019-01-09 20:56 Dexuan Cui
  2019-01-10  0:20 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2019-01-09 20:56 UTC (permalink / raw)
  To: 'gregkh@linuxfoundation.org', 'Stephen Hemminger',
	Sasha Levin, Stephen Hemminger
  Cc: Haiyang Zhang, KY Srinivasan,
	'devel@linuxdriverproject.org',
	'linux-kernel@vger.kernel.org',
	Michael Kelley, 'marcelo.cerri@canonical.com',
	'apw@canonical.com', 'olaf@aepfle.de',
	vkuznets, 'jasowang@redhat.com', 'Dan B'


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.

Fixes: ae6935ed7d42 ("vmbus: split ring buffer allocation from open")
Cc: stable@vger.kernel.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>

---

The patch was firstly posted on Dec-7 2018:
https://www.spinics.net/lists/linux-driver-devel/msg120802.html
but it looks it's neglected.

Now let me rebase it to v5.0-rc1: the line "channel->num_sc = 0;"
in the original patch must be removed due to
4d3c5c69191f ("Drivers: hv: vmbus: Remove the useless API vmbus_get_outgoing_channel()")

When the patch is backported to v4.20.1, there will be a conflict because
v4.20.1 doesn't have 4d3c5c69191f. I suggest we cherry-pick 4d3c5c69191f
into v4.20.1, before we backport this patch.

 drivers/hv/channel.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index ce0ba20..bea4c98 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -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);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][re-post] vmbus: fix subchannel removal
  2019-01-09 20:56 [PATCH][re-post] vmbus: fix subchannel removal Dexuan Cui
@ 2019-01-10  0:20 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2019-01-10  0:20 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: 'gregkh@linuxfoundation.org', 'Stephen Hemminger',
	Sasha Levin, Stephen Hemminger, Haiyang Zhang, KY Srinivasan,
	'devel@linuxdriverproject.org',
	'linux-kernel@vger.kernel.org',
	Michael Kelley, 'marcelo.cerri@canonical.com',
	'apw@canonical.com', 'olaf@aepfle.de',
	vkuznets, 'jasowang@redhat.com', 'Dan B'

On Wed, Jan 09, 2019 at 08:56:06PM +0000, Dexuan Cui wrote:
>
>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.
>
>Fixes: ae6935ed7d42 ("vmbus: split ring buffer allocation from open")
>Cc: stable@vger.kernel.org
>Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
>Signed-off-by: Dexuan Cui <decui@microsoft.com>

Queued, thank you.

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-10  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 20:56 [PATCH][re-post] vmbus: fix subchannel removal Dexuan Cui
2019-01-10  0:20 ` Sasha Levin

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).