From patchwork Wed Aug 14 18:08:03 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: 1147168 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 467yHp27rZz9s7T; Thu, 15 Aug 2019 04:08:22 +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 1hxxgz-0002wT-KK; Wed, 14 Aug 2019 18:08:13 +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 1hxxgx-0002wE-Lp for kernel-team@lists.ubuntu.com; Wed, 14 Aug 2019 18:08:11 +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 1hxxgx-0005Wh-Be for kernel-team@lists.ubuntu.com; Wed, 14 Aug 2019 18:08:11 +0000 Received: by mail-qk1-f199.google.com with SMTP id n190so100377254qkd.5 for ; Wed, 14 Aug 2019 11:08:11 -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:mime-version :content-transfer-encoding; bh=ROD7E0EBU/BRQLWAw7lIOME7Ln9Y+ZUs880qEsik5Ws=; b=p1HmLT8fCkpVXoow2MaLje7MCehVTWUO+DctjRYmu5nC2NFVfjSJLJwHx8xn6NPzUq STF3kTJfReYYvE+vM7Bkroqvta4YIB3IvePth/PBBHmZp+3/1f2jDc1IIoal9K4otQdl jyi1IzvpZUlesonASQ44OHwYnaJHGBPRZma95VBI5adZbL0aYedwyL7KnPTNghI2tkRr ZM/F7Ymabi6p3mX/C5vxh+GxgBoE6xkaDbAsWIsA8vjJBHa62WJf0N6zAmGT1+IELLjK lG0CFhzfTrCTc7tdMFDQLdhwuhRXUZXUq9/Ejzo2ln3fbFUpM/u0fmPPVavLOUWZM62q oW+w== X-Gm-Message-State: APjAAAXWD7Vd0dPST0fM+ze5vSkGPONvXO9wPch4HsVlReEVKSdEWPad v3D8N8OjS8t8eW32ycVm8XgZz9p/Zf3k5NtH/CKr7zi5D0AnubrXQ96yh3S9cQd+gTuTaFquoSI kFw7+4tqeOIGORbEpK/WxzoczUb4EPz4+ECQ07jzt X-Received: by 2002:a0c:edcb:: with SMTP id i11mr750755qvr.206.1565806090115; Wed, 14 Aug 2019 11:08:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7yRslKiAt4jVBYwSfMXeBYX0DVCZjcLnTIUheJcgHHWJDIsnv1VrBifxd08TBqjpZ6LNPnQ== X-Received: by 2002:a0c:edcb:: with SMTP id i11mr750732qvr.206.1565806089797; Wed, 14 Aug 2019 11:08:09 -0700 (PDT) Received: from gallifrey.lan ([2804:14c:4e3:5580:2c77:8a85:ea59:4f17]) by smtp.gmail.com with ESMTPSA id q73sm229004qke.90.2019.08.14.11.08.07 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:08:08 -0700 (PDT) From: Marcelo Henrique Cerri To: kernel-team@lists.ubuntu.com Subject: [d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND Date: Wed, 14 Aug 2019 15:08:03 -0300 Message-Id: <20190814180804.6019-1-marcelo.cerri@canonical.com> X-Mailer: git-send-email 2.20.1 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: Long Li BugLink: https://bugs.launchpad.net/bugs/1839673 The user mode may call hvnd_query_gid multiple times, and from multiple user contexts at the same time. If it's already bound, return GID and not wait. Signed-off-by: Long Li Signed-off-by: Marcelo Henrique Cerri Acked-by: Sultan Alsawaf Acked-by: Connor Kuehl Acked-by: Khalid Elmously --- .../hw/vmbus-rdma/vmbus-rdma-144.0/provider.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c index 8e15522707b9..3ad27e9d6a5d 100644 --- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c +++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c @@ -604,9 +604,11 @@ static int hvnd_query_gid(struct ib_device *ibdev, u8 port, int index, debug_check(__func__, __LINE__); - ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ); - if (!ret) - return -ETIMEDOUT; + if (!nd_dev->bind_complete) { + ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ); + if (!ret && !nd_dev->bind_complete) + return -ETIMEDOUT; + } memset(&(gid->raw[0]), 0, sizeof(gid->raw)); memcpy(&(gid->raw[0]), nd_dev->mac_addr, 6); @@ -2752,8 +2754,8 @@ static int hvnd_try_bind_nic(unsigned char *mac, __be32 ip) /* if we reach here, this means bind_nic is a success */ hvnd_error("successfully bound to IP %pI4 MAC %pM\n", nd_dev->ip_addr, nd_dev->mac_addr); - complete(&nd_dev->addr_set); nd_dev->bind_complete = 1; + complete_all(&nd_dev->addr_set); mutex_unlock(&nd_dev->bind_mutex); ret = hvnd_register_device(nd_dev, nd_dev->ip_addr, nd_dev->mac_addr);