Re: [PATCH] RDMA/mlx5: return the EFAULT per ibv_advise_mr(3)
From: Leon Romanovsky
Date: Thu Aug 05 2021 - 02:43:39 EST
On Wed, Aug 04, 2021 at 03:50:22PM -0300, Jason Gunthorpe wrote:
> On Wed, Aug 04, 2021 at 08:35:30AM +0300, Leon Romanovsky wrote:
> > On Tue, Aug 03, 2021 at 03:13:41PM -0300, Jason Gunthorpe wrote:
> > > On Tue, Aug 03, 2021 at 08:56:54PM +0300, Leon Romanovsky wrote:
> > > > On Tue, Aug 03, 2021 at 01:25:07PM -0300, Jason Gunthorpe wrote:
> > > > > On Sun, Aug 01, 2021 at 05:20:50PM +0800, Li Zhijian wrote:
> > > > > > ibv_advise_mr(3) says:
> > > > > > EFAULT In one of the following: o When the range requested is out of the MR bounds,
> > > > > > or when parts of it are not part of the process address space. o One of the
> > > > > > lkeys provided in the scatter gather list is invalid or with wrong write access
> > > > > >
> > > > > > Actually get_prefetchable_mr() will return NULL if it see above conditions
> > > > >
> > > > > No, get_prefetchable_mr() returns NULL if the mkey is invalid
> > > >
> > > > And what is this?
> > > > 1701 static struct mlx5_ib_mr *
> > > > 1702 get_prefetchable_mr(struct ib_pd *pd, enum ib_uverbs_advise_mr_advice advice,
> > > > 1703 u32 lkey)
> > > >
> > > > ...
> > > >
> > > > 1721 /* prefetch with write-access must be supported by the MR */
> > > > 1722 if (advice == IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE &&
> > > > 1723 !mr->umem->writable) {
> > > > 1724 mr = NULL;
> > > > 1725 goto end;
> > > > 1726 }
> > >
> > > I would say that is an invalid mkey
> >
> > I see it is as wrong write access.
>
> It just means the man page is wrong
ok, it can be a solution too.
Thanks
>
> Jason