netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@mellanox.com>
Cc: Doug Ledford <dledford@redhat.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Haggai Eran <haggaie@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	linux-netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH rdma-next 2/5] RDMA/core: Don't depend device ODP capabilities on kconfig option
Date: Thu, 20 Dec 2018 19:50:20 +0200	[thread overview]
Message-ID: <20181220175020.GD3940@mtr-leonro.mtl.com> (raw)
In-Reply-To: <20181220173306.GI29267@mellanox.com>

[-- Attachment #1: Type: text/plain, Size: 3929 bytes --]

On Thu, Dec 20, 2018 at 05:33:11PM +0000, Jason Gunthorpe wrote:
> On Thu, Dec 20, 2018 at 07:29:56PM +0200, Leon Romanovsky wrote:
> > On Thu, Dec 20, 2018 at 05:20:51PM +0000, Jason Gunthorpe wrote:
> > > On Thu, Dec 20, 2018 at 11:23:15AM +0200, Leon Romanovsky wrote:
> > > > From: Leon Romanovsky <leonro@mellanox.com>
> > > >
> > > > Device capability bits are exposing what specific device supports from
> > > > HW perspective. Those bits are not dependent on kernel configurations
> > > > and RDMA/core should ensure that proper interfaces to users will be
> > > > disabled if CONFIG_INFINIBAND_ON_DEMAND_PAGING is not set.
> > > >
> > > > Fixes: f4056bfd8ccf ("IB/core: Add on demand paging caps to ib_uverbs_ex_query_device")
> > > > Fixes: 8cdd312cfed7 ("IB/mlx5: Implement the ODP capability query verb")
> > > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > > >  drivers/infiniband/core/uverbs_cmd.c | 2 --
> > > >  drivers/infiniband/hw/mlx5/main.c    | 2 --
> > > >  2 files changed, 4 deletions(-)
> > > >
> > > > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> > > > index 6b12cc5f97b2..549d9eedf62e 100644
> > > > +++ b/drivers/infiniband/core/uverbs_cmd.c
> > > > @@ -3609,7 +3609,6 @@ static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs)
> > > >
> > > >  	copy_query_dev_fields(ucontext, &resp.base, &attr);
> > > >
> > > > -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
> > > >  	resp.odp_caps.general_caps = attr.odp_caps.general_caps;
> > > >  	resp.odp_caps.per_transport_caps.rc_odp_caps =
> > > >  		attr.odp_caps.per_transport_caps.rc_odp_caps;
> > > > @@ -3617,7 +3616,6 @@ static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs)
> > > >  		attr.odp_caps.per_transport_caps.uc_odp_caps;
> > > >  	resp.odp_caps.per_transport_caps.ud_odp_caps =
> > > >  		attr.odp_caps.per_transport_caps.ud_odp_caps;
> > > > -#endif
> > >
> > > This one is maybe OK, assuming the driver fills in 0..
> > >
> > > >  	resp.timestamp_mask = attr.timestamp_mask;
> > > >  	resp.hca_core_clock = attr.hca_core_clock;
> > > > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> > > > index 6584e638387a..d7e5ba5034aa 100644
> > > > +++ b/drivers/infiniband/hw/mlx5/main.c
> > > > @@ -923,11 +923,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
> > > >  	props->hca_core_clock = MLX5_CAP_GEN(mdev, device_frequency_khz);
> > > >  	props->timestamp_mask = 0x7FFFFFFFFFFFFFFFULL;
> > > >
> > > > -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
> > > >  	if (MLX5_CAP_GEN(mdev, pg))
> > > >  		props->device_cap_flags |= IB_DEVICE_ON_DEMAND_PAGING;
> > > >  	props->odp_caps = dev->odp_caps;
> > > > -#endif
> > >
> > > But shouldn't this be protected? If the driver has compiled out ODP it
> > > shouldn't set the cap flag...
> >
> > I see those capabilities as device properties and not as kernel ones.
> >
> > Current situation looks bad for me, when I have same device which
> > reports differently information depends on some compilation flag.
>
> It is not device capabilities, it is a kernel API capability if the
> API is not available the bit should not be set.

Is it better? Should I resend the series?

diff --git a/drivers/infiniband/hw/mlx5/main.c
b/drivers/infiniband/hw/mlx5/main.c
index 0b68795fb04e..c95c2f545b8f 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -925,7 +925,8 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,

        if (MLX5_CAP_GEN(mdev, pg))
                props->device_cap_flags |=  IB_DEVICE_ON_DEMAND_PAGING;
-       props->odp_caps = dev->odp_caps;
+       if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING))
+               props->odp_caps =  dev->odp_caps;

        if (MLX5_CAP_GEN(mdev, cd))
                props->device_cap_flags |= IB_DEVICE_CROSS_CHANNEL;


>
> The field is badly named.
>
> Jason

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2018-12-20 17:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  9:23 [PATCH rdma-next 0/5] Cleanup of CONFIG_INFINIBAND_ON_DEMAND_PAGING usage Leon Romanovsky
2018-12-20  9:23 ` [PATCH rdma-next 1/5] RDMA: Clean structures from CONFIG_INFINIBAND_ON_DEMAND_PAGING Leon Romanovsky
2018-12-20  9:23 ` [PATCH rdma-next 2/5] RDMA/core: Don't depend device ODP capabilities on kconfig option Leon Romanovsky
2018-12-20 17:20   ` Jason Gunthorpe
2018-12-20 17:29     ` Leon Romanovsky
2018-12-20 17:33       ` Jason Gunthorpe
2018-12-20 17:50         ` Leon Romanovsky [this message]
2018-12-20 23:22           ` Jason Gunthorpe
2018-12-20  9:23 ` [PATCH rdma-next 3/5] RDMA/mlx5: Introduce and reuse helper to identify ODP MR Leon Romanovsky
2018-12-20  9:23 ` [PATCH rdma-next 4/5] RDMA/mlx5: Embed into the code flow the ODP config option Leon Romanovsky
2018-12-20  9:23 ` [PATCH mlx5-next 5/5] RDMA/mlx5: Delete declaration of already removed function Leon Romanovsky
2018-12-21  3:32 ` [PATCH rdma-next 0/5] Cleanup of CONFIG_INFINIBAND_ON_DEMAND_PAGING usage Jason Gunthorpe
2018-12-21 13:59   ` Leon Romanovsky
2018-12-21 16:59     ` Jason Gunthorpe
2018-12-22  9:18       ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181220175020.GD3940@mtr-leonro.mtl.com \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=haggaie@mellanox.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).