From patchwork Fri Jun 7 19:38:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Henrique Cerri X-Patchwork-Id: 1112232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45LCXZ6kdRz9s6w; Sat, 8 Jun 2019 05:39:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hZKiA-0007Ue-G3; Fri, 07 Jun 2019 19:39:38 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hZKi3-0007OX-Pw for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 19:39:31 +0000 Received: from mail-qk1-f198.google.com ([209.85.222.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hZKi1-00072z-V2 for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 19:39:30 +0000 Received: by mail-qk1-f198.google.com with SMTP id y190so2463773qkc.21 for ; Fri, 07 Jun 2019 12:39:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PPB3Fb68Cjd7XH7PZTlZqoA6ecfep0lvm8FTpLXq0YM=; b=GD5hhKz8mkcwsVV+V7Cp+pUFG/8R4QdOIXRrGLvROQgs1Ei1uThj5J2ZM5vjkYpPTT /ufg+D95uoBezAIDQST4E2Yfifp4mnVC/kUhNmnm+L3wL0eYJvBOvfxp2QLzf7LTSYnn x8XV8eKrL4YIDSaGQ6H65cYksW++u0r1a7SLputSH5TAmdeel07ewXNLtQdET1+eQu7X lOeQTFPfYCP9UZaPBWH2lVc1yLlRbBXVp7owJyTQSum76I782ZsbZXmyO2A9XgdvAOqG 5Fefq4QNq1F/r7JEJgwvS+9ZcKb8S1peI6uMtMCpZM1m+t3lM2HiurJDAFXWObsUFAuH xi0g== X-Gm-Message-State: APjAAAUWAtxhigjZOeh/88J+2dXwoVyeY7adNr/HzGoVqZJMajxyXBXj vrR5ilQsS1uAdQWV7Ar6FQLur9KJDLkScbwOovf8wgtFgZmMWIUxGvPEn+2/Uj4ncTO05qa2z9i JNJ8JQ8J//QBPsjcGmFYDZGQUWbjBkluf7mBnwbyf X-Received: by 2002:a0c:9e58:: with SMTP id z24mr26569525qve.214.1559936368726; Fri, 07 Jun 2019 12:39:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDsmLvVuzK4gTGNT8Y0+IyLO8ETCJs0NPW+MeUv+zUcivXyNrLeMaXG1ZazcXgUW/yXE8DwA== X-Received: by 2002:a0c:9e58:: with SMTP id z24mr26569512qve.214.1559936368432; Fri, 07 Jun 2019 12:39:28 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e3:4a76:b1ae:211f:e30b:4e05]) by smtp.gmail.com with ESMTPSA id r2sm1318875qtp.8.2019.06.07.12.39.26 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 12:39:27 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [x/azure][PATCH 17/17] vmbus: fix subchannel removal Date: Fri, 7 Jun 2019 16:38:51 -0300 Message-Id: <20190607193851.21914-18-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607193851.21914-1-marcelo.cerri@canonical.com> References: <20190607193851.21914-1-marcelo.cerri@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Dexuan Cui BugLink: http://bugs.launchpad.net/bugs/1812123 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 Signed-off-by: Dexuan Cui Signed-off-by: Sasha Levin (backported from commit b5679cebf780c6f1c2451a73bf1842a4409840e7) [marcelo.cerri: kept `channel->num_sc = 0;` to avoid cherry picking 4d3c5c69191f ("Drivers: hv: vmbus: Remove the useless API vmbus_get_outgoing_channel()")] Signed-off-by: Marcelo Henrique Cerri --- drivers/hv/channel.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 1bbf048dd931..cfea80530325 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -696,20 +696,14 @@ 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); channel->num_sc = 0; - 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);