From patchwork Thu Mar 14 18:31:35 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: 1056658 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 44Ky3s72G7z9s6w; Fri, 15 Mar 2019 05:32:09 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1h4V98-0007sx-9t; Thu, 14 Mar 2019 18:32:02 +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 1h4V94-0007oy-As for kernel-team@lists.ubuntu.com; Thu, 14 Mar 2019 18:31:58 +0000 Received: from mail-qt1-f199.google.com ([209.85.160.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1h4V93-0004YB-4U for kernel-team@lists.ubuntu.com; Thu, 14 Mar 2019 18:31:57 +0000 Received: by mail-qt1-f199.google.com with SMTP id g17so6193652qte.17 for ; Thu, 14 Mar 2019 11:31:57 -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; bh=pk1BjX4rVNESwKSgIWn9xgFjgI86PR0U8IH/Z3ej9r4=; b=BdL5Jp+Bd+YI+/KLNoL3kpjrqPttDUdmFRiB0nh5c8DsFZspOHNba4cKF9B9Mh9Qy6 r7ka419K7CzqOCkwzfzpK6tXcb+Z8avGJbsvdvyG7U0XLVhV7MaLUxNMLDVHd399XDO4 UG0ucTLoyb1LMhtAdyUQ21YwOgkRrkdeHVXGKS0jBc1cRANk+g9i0dE7dPUW4z7s9Lnl 16YQuj2Bx2VAwAzvvBp0ZOzSVk3qANo8RivJq26d3Jbed6xsUEQHvuMmkZHGmKiEp0A+ GUQo+fHO4KBJPChk8L4pZps0YH2VnXzpVRfmODpqTBWc5LsZK+z48J7axPTIsFcMPp96 f8UQ== X-Gm-Message-State: APjAAAVkYt18OIYl4Ztd/u2Fki+BMweJO7hxufOVoXpNJFA9iuKMNYI3 bTCIkZU5oYFbt4C8qDBBDS34I/UA2hZj7OLec5vfV+J4VwYVAhn5WpNZCBYMyuOPLQu9CPNi3nK I5GMCZF289//zRN7Y0QzEk0T4rzyR3FmGGbdEMCs2 X-Received: by 2002:ae9:ec13:: with SMTP id h19mr27701507qkg.345.1552588315885; Thu, 14 Mar 2019 11:31:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCwCouvQhpl8zD4/ByRQGSBb8+/DFmXOG03T9AXtbDTNgHFbHZQRIOdON3GW+i8eK09LPBMA== X-Received: by 2002:ae9:ec13:: with SMTP id h19mr27701489qkg.345.1552588315611; Thu, 14 Mar 2019 11:31:55 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e3:4a76:8145:c566:46dd:a2ba]) by smtp.gmail.com with ESMTPSA id j64sm1575576qkf.13.2019.03.14.11.31.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 11:31:54 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [c/azure][PATCH 8/8] vmbus: fix subchannel removal Date: Thu, 14 Mar 2019 15:31:35 -0300 Message-Id: <20190314183135.20235-9-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190314183135.20235-1-marcelo.cerri@canonical.com> References: <20190314183135.20235-1-marcelo.cerri@canonical.com> 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: , MIME-Version: 1.0 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: keep `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 0ecbdcf3ad15..dbc3a20bdb33 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -701,20 +701,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);