Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp327752pxt; Thu, 5 Aug 2021 00:16:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRKsjzLGHGJkETLfJgp0X8d08zTIHtcLs8j8tIfYEu2ukvVUgMs43NpXY78UQSS7SoRxGM X-Received: by 2002:a5e:d80e:: with SMTP id l14mr276472iok.79.1628147797647; Thu, 05 Aug 2021 00:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628147797; cv=none; d=google.com; s=arc-20160816; b=sfdM/SCicEValV7owis6L4HHPu0SuMk+oVRKp+/kIw0r6dGv8EXOVHDYnjjJugSwi2 hj0zVsxUZcF3YcJlCxHMthEMtjAbmLXHEwTGxuK2aTNFkXEUNGxFf3+qOixZM2OwPpYK 7KkGF/3VYRgvmgSa3t+iKozbUpcUv1gm1uXpRjEDPd9mNXX5JcOy6mcrFygGUsU/BMf2 7jNq58PKzBQvjWP6BPHReXgPwkpf5hKuy+x8Ab1/8eV3x96qX6xWTB3EO6wyz7voHT93 hyRB+EhJiUMEYSsOBsjWGS5PwmFgONyAlB5st3JrKT5qp8sIcMIufTSksWEs9MD8h4b9 a3Ww== 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=15w2EZ1UKUPVq+qhr7n7unf4gf57kLFqV2kvGW7EY0M=; b=QG5e+9RDE7z2ldYfG3/xbIknXZ/qLpCo+1jtfnYiP8YMeT7EnfYK8HtQRTR5of2FGc NqXhZdSGfzGdOOREDtcy8iEQi1m3aALyUEsnarriXdXZ5yRJJZSRgEypxA1bc6M0CN/4 Z2YYX1LEUzpdsnUADwKPjoU4B/ufcN8G0I81gpDPHmd2iccb7dVtqfhp/eQ0iFoNvG/X SX4qnysB3DpAWx4v8HM1Sb5lF7/iFIF2PORr/ReCB5RBGJrKQt7ARCNIG/DtQa3vySV8 W2sSRBleWMJLJ3Ej30zWzXbJeKiZ3e3HRwZJLBz2SxpG6L2pI5MQwp0qI2K6CCnuNCob m+aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j7neluQD; 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 o15si4686086ilf.79.2021.08.05.00.16.24; Thu, 05 Aug 2021 00:16:37 -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=j7neluQD; 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 S237738AbhHEGnv (ORCPT + 99 others); Thu, 5 Aug 2021 02:43:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:40300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231418AbhHEGnu (ORCPT ); Thu, 5 Aug 2021 02:43:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 62BF460462; Thu, 5 Aug 2021 06:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628145817; bh=VJd3dRzsYJ2FfUYxQrivjngv0CEl6bodWlWAEugcJRo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j7neluQDnMex0X+f/p2QgZB9pQ2LdnmtHPm+ah+7iwczNeN6J6CHL5OnKc1ACL6Vc VePonkSTqVdV9E43syKf7CnntbdUKWj55yYWhbBpDG46T+aW83j/uA64vYeIcS9UaU 1YgaU83ji2vNK/je2adaGu3py7flEw8sDIyyOWP/ISIVz0jE+WgYS1GxGojsyRqWNS 43A/QGJug0Pf82JAON30YLwFqBMbfqPNlGUsxbeEM8U4ksTseyZwV2xqBbpz5aguW1 fvJWRxEQ1XHxtmNSkqZYggxojUffq2VHGBPbWnh350o9A9+MfH2KrOFTqdLG6My3Qb NQE5trcKuB7Cw== Date: Thu, 5 Aug 2021 09:43:33 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Li Zhijian , dledford@redhat.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/mlx5: return the EFAULT per ibv_advise_mr(3) Message-ID: References: <20210801092050.6322-1-lizhijian@cn.fujitsu.com> <20210803162507.GA2892108@nvidia.com> <20210803181341.GE1721383@nvidia.com> <20210804185022.GM1721383@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210804185022.GM1721383@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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