Received: by 10.223.185.116 with SMTP id b49csp1025508wrg; Wed, 21 Feb 2018 10:46:50 -0800 (PST) X-Google-Smtp-Source: AH8x227x3erogOzZnmFP/a2jQqsUgm39q/WXEJWSDwN7MJ5XJqsm5GXKIA2WWWdXPo8bUWXWjcF9 X-Received: by 10.99.7.15 with SMTP id 15mr3351030pgh.388.1519238810560; Wed, 21 Feb 2018 10:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238810; cv=none; d=google.com; s=arc-20160816; b=K81ZSotc2WZnCSpRlE5SNg+qu4SVU2y9+63PCjULQR6VbbYnICuSAP9dpRgi3ohE7R eXc/b/Aea21bjYkgLDgh3kEAJryPDXE9OJp4ElI96WXYsGvIlR0m3e8Z+uMPM+Me/nP7 nhIfMpdjeow82wqA22y4UGfA37Ih5QUU4BzkjFogQ8HRGveGWeHN38tlMqRgDdCM8JJ0 8l+ST/G2+/cB48VNBj0/9cr3Um6D95UqfTFOpMNLn7CIYm2ZPfr5/23pNws5NrMCDP4g u7sCYobAOWiibUr0Axzc88xVBg1jHIsde1uwx3yc5qSS0fiWq7nCR7+5Scu9Jo5bBRxr mWRQ== 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=6sqRf1xPkMcjwtTJITTkiQ3m38rDbCLHUJxD2a7cixM=; b=0VJ6j0odQfsX3DsHS0lEbb76OyKdMPUBhfa5wtZk7SQdOW6KX+EpLaOkMp8lA0GOk1 XzBP/kaSnOL3/1C/rz9+WopxBjdJm8a6t8aWjCtF6+nrsUjTetC0MLWxqMxlymdSmXYH VayCn+ekWzQfv1l79Yr2HVkDWMoeBjRombeT2p4aaComdqh5kwRI8Md4urnhT4qnwm8e FpIC832eUHbdHcOsG0RuMyASaYmA9XZvqyMv9KrvRL/7t6s5IBJhBNmZ7ThwIKvcVUW8 wsixJVAcAHEst+C0vZAUFCGkOD+S9omDPBwzVLM/LyPgKIM61axieQVGo+RYjhIj7CQp 3rRg== 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 m73si1632082pfj.131.2018.02.21.10.46.35; Wed, 21 Feb 2018 10:46:50 -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 S965857AbeBUNrP (ORCPT + 99 others); Wed, 21 Feb 2018 08:47:15 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40718 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936041AbeBUNGV (ORCPT ); Wed, 21 Feb 2018 08:06:21 -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 0CF9D9C; Wed, 21 Feb 2018 13:06:20 +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.15 004/163] IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports Date: Wed, 21 Feb 2018 13:47:13 +0100 Message-Id: <20180221124530.180604006@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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 @@ -2995,9 +2995,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]); @@ -3102,11 +3101,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 @@ -287,6 +287,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);