From patchwork Thu Mar 14 18:31:33 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: 1056656 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 44Ky3l3JSFz9s9N; Fri, 15 Mar 2019 05:32:03 +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 1h4V92-0007oP-Tg; Thu, 14 Mar 2019 18:31:56 +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 1h4V8z-0007me-Pg for kernel-team@lists.ubuntu.com; Thu, 14 Mar 2019 18:31:53 +0000 Received: from mail-qt1-f197.google.com ([209.85.160.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1h4V8z-0004Y5-AX for kernel-team@lists.ubuntu.com; Thu, 14 Mar 2019 18:31:53 +0000 Received: by mail-qt1-f197.google.com with SMTP id f15so6205380qtk.16 for ; Thu, 14 Mar 2019 11:31:53 -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=j/xh92NdIc0R3gZGUASs//nYb00AKmjOahtLTRpsIZo=; b=pDaBp7/yzy5Cw0HPtcSQcb8XJkh0vFiFLkLyWa2jYOXNgc4P78zfnob9Izk6lauE1h eMyDpeXJXNJzUzPDw6PAKxAONJeRtfDy9NBG3paGrz68jyZr1fSDg5RbGalMS0tyUmEv kcudJKiKjAfJv1UW4IosLVbbjl1cfgMCW6iTJhibvN7uzMe4XzswfoX5PaFkUYi+M50h OXZvMotnCZB6OqG0yTVEIpdzUCCVRO9yCnpPlyIWN3c42vnQQIpLVs7Ra/jPpazrtDiV nhqB8hNLXf0/s3X2f7CSPXOj1MOvzT8Rg6jW8CIFXYMpxRVRTYTnQ9OgO+fU9k1EvY/E qhlg== X-Gm-Message-State: APjAAAXK0H8fJEwp070zCJLnGcIZ59zxSlmG6gFZdfSe49SGIvXR2nVy cpqUqD1jgzhHLT+oHllBy3+NBoIyKbrBjwYRg8TyrLL/GbD5ulEviAL9UMJ8DJjUuBfjR6f8WfS Y5+S3Kr6oZbTv17p9O6IHESo3046qkdeVbz3ov2uK X-Received: by 2002:ac8:2b2e:: with SMTP id 43mr39837498qtu.33.1552588312069; Thu, 14 Mar 2019 11:31:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyahccxck2eVqwDxdqOL+HsgN41nbQMCi24Z+qDCN2uCBCrOEPWuWhRielNIHLciT8p61nyAA== X-Received: by 2002:ac8:2b2e:: with SMTP id 43mr39837480qtu.33.1552588311791; Thu, 14 Mar 2019 11:31:51 -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.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 11:31:50 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [c/azure][PATCH 6/8] vmbus: pass channel to hv_process_channel_removal Date: Thu, 14 Mar 2019 15:31:33 -0300 Message-Id: <20190314183135.20235-7-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: 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 c247bfae0284..00ca3008d412 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -696,8 +696,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 16eb9b3f1cb1..ab2d9f28ebe7 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); } @@ -1010,7 +1003,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 c9a466be7709..28c6f00d9d2c 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -768,10 +768,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 e39b7113b8e4..815b0a0102da 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1434,7 +1434,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); /*