Received: by 10.223.185.116 with SMTP id b49csp765149wrg; Wed, 21 Feb 2018 06:36:10 -0800 (PST) X-Google-Smtp-Source: AH8x2271WonrwOOu7WX7xLwEzelsaQyMeRXc16TI/hzaDCdLGegGXpW6LBRTFZZJXYjDTAngIuAM X-Received: by 10.98.49.7 with SMTP id x7mr3550648pfx.101.1519223770806; Wed, 21 Feb 2018 06:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519223770; cv=none; d=google.com; s=arc-20160816; b=Zjt1LtXq6BN3rDaC116bTtNTNs+senS+LVq5FBRaGMjyi0DS+F0u2i4fpoy3zwq346 jXMDUHuLM5CJUPfOm32vHL2AaPcLr/oTDyFlTTZdRLfDF3Im/1l1MrAlXU9wcsdIn14Q fMd4Tg+5Bwszg8eoUjLE1QRwkqrK5/6efsL5wDkGi4D9MwM89q3m73UJlQ7VXWR+8Jwn BBXTdF/gq6rC2qP+JbkkshiVcAbN0UP5a+Umwpgjn35WleerN1JcVnbMcYjYt3aR2NiG VJPDkq+TuSUsA740+t9/oY0fv3n8qNiDtisyKV1zXfvK8zqCoMYq3kRoLo4pSKU2mWk8 SiKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=d3qtNRPfD+ZF6rwYpvz81E14UtHRhKnti8Rul1fGPqE=; b=Vp3KhmTdM8XzO/KbV+S4izkzKOTf32C11e/upu3n6e3RQilfHYHc9zN5DfWOfuTmyW HySrLG0C2wMdDCi+B+F5e/GdLgv7WkNomfffVXoAJa5NaWw8hLBh2bB8ztwoMm0qPh6e c3hDPCyLL613LICh1xlpPfDMLvokHROhAkdzqa1oqu7TFdkR68k7kW0UY7/t80cC//Jd gzWh484TwTQ9kLPTG3WLBjWAN3Kq5ZNUyVYR3492FgFtJDzGVMJ6oM3VBKBO7um52GH8 vM5Xlfn3/TqSls0/wm1QN5f4IvXWKxU1neyhPUvRU0GvN4fWEuY+86Idz6266rly8X0y 3Y2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si7442173pla.564.2018.02.21.06.35.56; Wed, 21 Feb 2018 06:36:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934323AbeBUMzk (ORCPT + 99 others); Wed, 21 Feb 2018 07:55:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34504 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934283AbeBUMzi (ORCPT ); Wed, 21 Feb 2018 07:55:38 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 708621180; Wed, 21 Feb 2018 12:55:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Morgenstein , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 4.9 36/77] IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports Date: Wed, 21 Feb 2018 13:48:45 +0100 Message-Id: <20180221124433.700079464@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jack Morgenstein commit 852f6927594d0d3e8632c889b2ab38cbc46476ad upstream. Allocating steerable UD QPs depends on having at least one IB port, while releasing those QPs does not. As a result, when there are only ETH ports, the IB (RoCE) driver requests releasing a qp range whose base qp is zero, with qp count zero. When SR-IOV is enabled, and the VF driver is running on a VM over a hypervisor which treats such qp release calls as errors (rather than NOPs), we see lines in the VM message log like: mlx4_core 0002:00:02.0: Failed to release qp range base:0 cnt:0 Fix this by adding a check for a zero count in mlx4_release_qp_range() (which thus treats releasing 0 qps as a nop), and eliminating the check for device managed flow steering when releasing steerable UD QPs. (Freeing ib_uc_qpns_bitmap unconditionally is also OK, since it remains NULL when steerable UD QPs are not allocated). Fixes: 4196670be786 ("IB/mlx4: Don't allocate range of steerable UD QPs for Ethernet-only device") Signed-off-by: Jack Morgenstein Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx4/main.c | 13 +++++-------- drivers/net/ethernet/mellanox/mlx4/qp.c | 3 +++ 2 files changed, 8 insertions(+), 8 deletions(-) --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -2928,9 +2928,8 @@ err_steer_free_bitmap: kfree(ibdev->ib_uc_qpns_bitmap); err_steer_qp_release: - if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED) - mlx4_qp_release_range(dev, ibdev->steer_qpn_base, - ibdev->steer_qpn_count); + mlx4_qp_release_range(dev, ibdev->steer_qpn_base, + ibdev->steer_qpn_count); err_counter: for (i = 0; i < ibdev->num_ports; ++i) mlx4_ib_delete_counters_table(ibdev, &ibdev->counters_table[i]); @@ -3035,11 +3034,9 @@ static void mlx4_ib_remove(struct mlx4_d ibdev->iboe.nb.notifier_call = NULL; } - if (ibdev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED) { - mlx4_qp_release_range(dev, ibdev->steer_qpn_base, - ibdev->steer_qpn_count); - kfree(ibdev->ib_uc_qpns_bitmap); - } + mlx4_qp_release_range(dev, ibdev->steer_qpn_base, + ibdev->steer_qpn_count); + kfree(ibdev->ib_uc_qpns_bitmap); iounmap(ibdev->uar_map); for (p = 0; p < ibdev->num_ports; ++p) --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c @@ -286,6 +286,9 @@ void mlx4_qp_release_range(struct mlx4_d u64 in_param = 0; int err; + if (!cnt) + return; + if (mlx4_is_mfunc(dev)) { set_param_l(&in_param, base_qpn); set_param_h(&in_param, cnt);