From patchwork Fri Jun 7 19:38:49 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: 1112230 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 45LCXW1HY5z9s4Y; Sat, 8 Jun 2019 05:39:39 +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 1hZKi5-0007QZ-8h; Fri, 07 Jun 2019 19:39:33 +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 1hZKhz-0007LF-BT for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 19:39:27 +0000 Received: from mail-qk1-f199.google.com ([209.85.222.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hZKhx-00072i-SV for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 19:39:26 +0000 Received: by mail-qk1-f199.google.com with SMTP id w184so2471236qka.15 for ; Fri, 07 Jun 2019 12:39:25 -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=W7Og8jCkrOrj6oywNe+7llJ7OP1MHNFh1OZ1mM1/0pA=; b=hf0kuiIT3lxeUPTmWrdv2ekhcfYNOJUGwIyhaNip6xM5USDA929jem1/cjd6zSrmZu c0Ug/0EgFv1n9PXRWRNbqY4xo6xdcAIwOvrYLhh9yT2Mbm7+CUwglsrMlrq9hz3NvZMg A89Sq9T6E++iqytK0BIkGWBxFOclREyJgyUN44CHaC4ah63S0oiTS42qhZxKNyeBi3ZJ QnYJ8VDBJS2Ic2EGkPZyn0vQ2cjH0ipI9miHqFJUr87dQWo5CqRdFPnGW7OGOQ+1N+s7 NxShZbiTYGtcqtUO5f9W1LQdIayhL07+w/03t2Ypda1m/pjsymLmQ6i8HYrwhwwer+eg /dZQ== X-Gm-Message-State: APjAAAVRyIwmSctrTgdCYeE8F9YbRSDMjJJGTIiPIjBfR/iqxRtuKX2J kNmRgRa1c571FnsaJ2Dek1r7anfQDSjifxlLZulnV+dUSG+1tO8IwP3aGS1wHV4zk7NdUnw7XgA SRzbM+xgN84ov2kzwovYcG1xJZqTWxfVEjznavwEA X-Received: by 2002:ac8:6b06:: with SMTP id w6mr44963727qts.80.1559936364624; Fri, 07 Jun 2019 12:39:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpRZY1oXxtpvpBot84UcGAU8xsefQ2RtBPK1/0+cp+OE8t5pTfI09XDNQ8hnZCLnHW9a7RAw== X-Received: by 2002:ac8:6b06:: with SMTP id w6mr44963706qts.80.1559936364341; Fri, 07 Jun 2019 12:39:24 -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.22 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 12:39:23 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [x/azure][PATCH 15/17] vmbus: pass channel to hv_process_channel_removal Date: Fri, 7 Jun 2019 16:38:49 -0300 Message-Id: <20190607193851.21914-16-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: Stephen Hemminger BugLink: http://bugs.launchpad.net/bugs/1812123 Rather than passing relid and then looking up the channel. Pass the channel directly, since caller already knows it. Signed-off-by: Stephen Hemminger Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 800b932969c53c4044ff9f9fd1ee793a87fa8ef0) Signed-off-by: Marcelo Henrique Cerri --- drivers/hv/channel.c | 3 +-- drivers/hv/channel_mgmt.c | 17 +++++------------ drivers/hv/vmbus_drv.c | 3 +-- include/linux/hyperv.h | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index c94ded629518..0c4a943c4275 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -688,8 +688,7 @@ void vmbus_close(struct vmbus_channel *channel) wait_for_completion(&cur_channel->rescind_event); mutex_lock(&vmbus_connection.channel_mutex); vmbus_close_internal(cur_channel); - hv_process_channel_removal( - cur_channel->offermsg.child_relid); + hv_process_channel_removal(cur_channel); } else { mutex_lock(&vmbus_connection.channel_mutex); vmbus_close_internal(cur_channel); diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index b9bc1f3f2110..975d471f4d21 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -385,21 +385,14 @@ static void vmbus_release_relid(u32 relid) trace_vmbus_release_relid(&msg, ret); } -void hv_process_channel_removal(u32 relid) +void hv_process_channel_removal(struct vmbus_channel *channel) { + struct vmbus_channel *primary_channel; unsigned long flags; - struct vmbus_channel *primary_channel, *channel; BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex)); - - /* - * Make sure channel is valid as we may have raced. - */ - channel = relid2channel(relid); - if (!channel) - return; - BUG_ON(!channel->rescind); + if (channel->target_cpu != get_cpu()) { put_cpu(); smp_call_function_single(channel->target_cpu, @@ -429,7 +422,7 @@ void hv_process_channel_removal(u32 relid) cpumask_clear_cpu(channel->target_cpu, &primary_channel->alloced_cpus_in_node); - vmbus_release_relid(relid); + vmbus_release_relid(channel->offermsg.child_relid); free_channel(channel); } @@ -1003,7 +996,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) * The channel is currently not open; * it is safe for us to cleanup the channel. */ - hv_process_channel_removal(rescind->child_relid); + hv_process_channel_removal(channel); } else { complete(&channel->rescind_event); } diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index f699d5777c78..1bdc8fc8bec8 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -819,10 +819,9 @@ static void vmbus_device_release(struct device *device) struct vmbus_channel *channel = hv_dev->channel; mutex_lock(&vmbus_connection.channel_mutex); - hv_process_channel_removal(channel->offermsg.child_relid); + hv_process_channel_removal(channel); mutex_unlock(&vmbus_connection.channel_mutex); kfree(hv_dev); - } /* The one and only one */ diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 307cd1c5d754..c174b3bc7492 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1421,7 +1421,7 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf, const int *srv_version, int srv_vercnt, int *nego_fw_version, int *nego_srv_version); -void hv_process_channel_removal(u32 relid); +void hv_process_channel_removal(struct vmbus_channel *channel); void vmbus_setevent(struct vmbus_channel *channel); /*