Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2522224pxv; Sun, 27 Jun 2021 00:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/D+BptKt3RaqWTn8+xY8hPvzAgwv5SzLZr13Thbg3eJnMXLwuENzmDlZU0LI4JyVq9HsW X-Received: by 2002:a17:906:e28f:: with SMTP id gg15mr19311492ejb.302.1624779140654; Sun, 27 Jun 2021 00:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624779140; cv=none; d=google.com; s=arc-20160816; b=yu97WrU8fd9RU+fYwoi1Gx5W7VUumKp7mwF+wbFyWdogK0XIeqXWemOtPFO6QFeRRd GmRKr6ZIzXePftoqlN5hBJs0FU+0+ybI8JSs1OSlaaSahAUOFS+zZ8ueAPFr+Sbs4B0P uusBIbi/yl+OSYUb2Q74pVxiPLSr44X1XVnQzIQAvgottCKKVcQN2cdASm5zxLcAY0Q6 OA4joo+8K1plj7S3H4B+3GuaGTP8kIHiSpPrDh9DORAoizkX9wflpy/aG0mFSuNY4imM QLkT+UcB21BHAdYEsWpvlohiTihG9tH+8iYvw7keK2yNve7DYgG6R6/XBFDRvUfInEK6 yV7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BkFngJoQ02FWQtwTHMzfCCNG9IYgHHsm9ZFYuWMKT3Y=; b=agLxzCmTXRRs7T1Vb3zGGgD5mXKIWWJnskOFmIfRZxG8KZnxcK7blNtVEuU5ZqoIFT c2COFC39GGUjPB3aYLoH+EO14wfGnJBKFUEK7G1D1J2FgAVq+0NnbJBK53329Mo/FWIH M1sjZUELeHtwoMUpn81ny7zO2/7ygM/ZLrrvIKgpTQeAgO+7Pfsbf6Aoi+TEtHUhjidX Tdp4eIhXZslB3Y4IxPrxHjDbbEGOnbEezyYgwXQpITF6b/RRLZAckj/Z8z00+Wj1q+we lJB4cF/QaZjT5Wua35R8W5HawoCooNDg8qD0fAGMajLn7YUTTN18q1qjl8t9jNG0PkXa 3gmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTi7MMqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si11220291edv.519.2021.06.27.00.31.57; Sun, 27 Jun 2021 00:32:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTi7MMqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbhF0Hd2 (ORCPT + 99 others); Sun, 27 Jun 2021 03:33:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:34452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbhF0Hd1 (ORCPT ); Sun, 27 Jun 2021 03:33:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1161161C17; Sun, 27 Jun 2021 07:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624779063; bh=q511T8tgjpycuiF9Uy6fhTCaiui1eZRwQqAaYLuYPHI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DTi7MMqm994FZasb0KBvnViTAYDjvgalW3uQMP37UhaxINo+drUsz7i13KxO2koA/ Z+FnoTWBwkeuEdeCtizvZjTpUAaOW71xbf3EAYrQuPA3jFwCZuK/6FWvEfd4MgPTsn x/bVvkdP7gAhEbE5Aagkfy3AaRhbApzU6Fm5F9oKuMu5nyPT0Q3e2lbk4B/k661HH9 8Sht+f5uLw+A/98pmSgdssMxBV7YllkjcjOibmy3c/i1X5BbADXd6R2yWMezhs+KsN jyYrjApk5YlGtmfjpu6xcX4tbAiQmcqQQUU9xyzgvlsK/UdOjP8RHHTdCHdVjL7TLu T6AdM87DvAfwQ== Date: Sun, 27 Jun 2021 10:30:59 +0300 From: Leon Romanovsky To: Max Gurtovoy Cc: Doug Ledford , Jason Gunthorpe , Avihai Horon , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tom Talpey , Santosh Shilimkar , Chuck Lever III , Keith Busch , David Laight , Honggang LI Subject: Re: [PATCH v2 rdma-next] RDMA/mlx5: Enable Relaxed Ordering by default for kernel ULPs Message-ID: References: <9c5b7ae5-8578-3008-5e78-02e77e121cda@nvidia.com> <1ef0ac51-4c7d-d79d-cb30-2e219f74c8c1@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ef0ac51-4c7d-d79d-cb30-2e219f74c8c1@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 10:39:16AM +0300, Max Gurtovoy wrote: > > On 6/24/2021 9:38 AM, Leon Romanovsky wrote: > > On Thu, Jun 24, 2021 at 02:06:46AM +0300, Max Gurtovoy wrote: > > > On 6/9/2021 2:05 PM, Leon Romanovsky wrote: > > > > From: Avihai Horon > > > > > > > > Relaxed Ordering is a capability that can only benefit users that support > > > > it. All kernel ULPs should support Relaxed Ordering, as they are designed > > > > to read data only after observing the CQE and use the DMA API correctly. > > > > > > > > Hence, implicitly enable Relaxed Ordering by default for kernel ULPs. > > > > > > > > Signed-off-by: Avihai Horon > > > > Signed-off-by: Leon Romanovsky > > > > --- > > > > Changelog: > > > > v2: > > > > * Dropped IB/core patch and set RO implicitly in mlx5 exactly like in > > > > eth side of mlx5 driver. > > > > v1: https://lore.kernel.org/lkml/cover.1621505111.git.leonro@nvidia.com > > > > * Enabled by default RO in IB/core instead of changing all users > > > > v0: https://lore.kernel.org/lkml/20210405052404.213889-1-leon@kernel.org > > > > --- > > > > drivers/infiniband/hw/mlx5/mr.c | 10 ++++++---- > > > > drivers/infiniband/hw/mlx5/wr.c | 5 ++++- > > > > 2 files changed, 10 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c > > > > index 3363cde85b14..2182e76ae734 100644 > > > > --- a/drivers/infiniband/hw/mlx5/mr.c > > > > +++ b/drivers/infiniband/hw/mlx5/mr.c > > > > @@ -69,6 +69,7 @@ static void set_mkc_access_pd_addr_fields(void *mkc, int acc, u64 start_addr, > > > > struct ib_pd *pd) > > > > { > > > > struct mlx5_ib_dev *dev = to_mdev(pd->device); > > > > + bool ro_pci_enabled = pcie_relaxed_ordering_enabled(dev->mdev->pdev); > > > > MLX5_SET(mkc, mkc, a, !!(acc & IB_ACCESS_REMOTE_ATOMIC)); > > > > MLX5_SET(mkc, mkc, rw, !!(acc & IB_ACCESS_REMOTE_WRITE)); > > > > @@ -78,10 +79,10 @@ static void set_mkc_access_pd_addr_fields(void *mkc, int acc, u64 start_addr, > > > > if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_write)) > > > > MLX5_SET(mkc, mkc, relaxed_ordering_write, > > > > - !!(acc & IB_ACCESS_RELAXED_ORDERING)); > > > > + acc & IB_ACCESS_RELAXED_ORDERING && ro_pci_enabled); > > > > if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_read)) > > > > MLX5_SET(mkc, mkc, relaxed_ordering_read, > > > > - !!(acc & IB_ACCESS_RELAXED_ORDERING)); > > > > + acc & IB_ACCESS_RELAXED_ORDERING && ro_pci_enabled); > > > Jason, > > > > > > If it's still possible to add small change, it will be nice to avoid > > > calculating "acc & IB_ACCESS_RELAXED_ORDERING && ro_pci_enabled" twice. > > The patch is part of for-next now, so feel free to send followup patch. > > > > Thanks > > > > diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c > > index c1e70c99b70c..c4f246c90c4d 100644 > > --- a/drivers/infiniband/hw/mlx5/mr.c > > +++ b/drivers/infiniband/hw/mlx5/mr.c > > @@ -69,7 +69,8 @@ static void set_mkc_access_pd_addr_fields(void *mkc, int acc, u64 start_addr, > > struct ib_pd *pd) > > { > > struct mlx5_ib_dev *dev = to_mdev(pd->device); > > - bool ro_pci_enabled = pcie_relaxed_ordering_enabled(dev->mdev->pdev); > > + bool ro_pci_enabled = acc & IB_ACCESS_RELAXED_ORDERING && > > + pcie_relaxed_ordering_enabled(dev->mdev->pdev); > > > > MLX5_SET(mkc, mkc, a, !!(acc & IB_ACCESS_REMOTE_ATOMIC)); > > MLX5_SET(mkc, mkc, rw, !!(acc & IB_ACCESS_REMOTE_WRITE)); > > @@ -78,11 +79,9 @@ static void set_mkc_access_pd_addr_fields(void *mkc, int acc, u64 start_addr, > > MLX5_SET(mkc, mkc, lr, 1); > > > > if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_write)) > > - MLX5_SET(mkc, mkc, relaxed_ordering_write, > > - (acc & IB_ACCESS_RELAXED_ORDERING) && ro_pci_enabled); > > + MLX5_SET(mkc, mkc, relaxed_ordering_write, ro_pci_enabled); > > if (MLX5_CAP_GEN(dev->mdev, relaxed_ordering_read)) > > - MLX5_SET(mkc, mkc, relaxed_ordering_read, > > - (acc & IB_ACCESS_RELAXED_ORDERING) && ro_pci_enabled); > > + MLX5_SET(mkc, mkc, relaxed_ordering_read, ro_pci_enabled); > > > > MLX5_SET(mkc, mkc, pd, to_mpd(pd)->pdn); > > MLX5_SET(mkc, mkc, qpn, 0xffffff); > > (END) > > > Yes this looks good. > > Can you/Avihai create a patch from this ? or I'll do it ? Feel free to send it directly. Thanks > > > > >