Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2647304pxy; Tue, 3 Aug 2021 11:21:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHSkIjt+/dy9Ll0nGBFqqOxwFvcMe6r/IFQILh9yif3uwMG29mkMYWg6bQ/QnmXZjNH0jF X-Received: by 2002:a92:da86:: with SMTP id u6mr2258017iln.265.1628014912414; Tue, 03 Aug 2021 11:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628014912; cv=none; d=google.com; s=arc-20160816; b=sxrgh+1u+caDW1/oHadjruYknXlq25+fAi2Hi8EmJbOUPqaxqbAkqen6KDEdHspdm2 8Lv0qjqTs7nBVyAlBG4TvT/nrYGs5HgketDosWiOaGQz4heyJngtjD8AXctIi2et2Of9 GTeerQa6NBZrvG7LW/nX0tTsrysJChJ2UugZpGeLuqWCUWGNbDWqJE2wF+0uJ8kmLNFN AfyP4owHHfaEqDdDrtIUyoqKO6srTXoOfniWFd1wAsTsiL3rfLDuiylWN2EZ4O9XHe6W 2I+JC85zxEHSvmlFfaqCVPdyEs+ZTAz+4Qn96C5I5QSCF339Ij+fFPGlxR0JwWWy1ClP FZjg== 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=lPqGtDRRwKTpi9Fws/gf8A3ixxvQOgOai0JmStnqzPU=; b=e1VUjQoqXYhH+dibThtZc1CiY5gzWoqIhQsOge64K1Rw3KMjZGc7BiXwc3jy+IVFXv 9E0FaSwjtkykn/jaQfgIUfZT4pnkKg0SBaYmxE6nD6v64e6rc16EftoWrq75z/L2BoKC T3OIVqMMSCydcuf8TKa4Pk/ejW0x2E8s0uH+1KK0dnRw2m2Fx/7r4RFZV0vITK4TSbhQ sW8NKh9qYOjHgHkVddqIGJWGe9hVGCncrW813Rdplv3hy20weEOB9ILmDtmC36IqiOZ7 9p8usgQDkCPV8BfEtW2CjumStUviNeYo/efAYaYIZ0pKx6YrzGK3RRTcMKwU0g9UFzjg VyKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lhw38K4t; 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 u12si14932770iot.101.2021.08.03.11.21.38; Tue, 03 Aug 2021 11:21:52 -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=lhw38K4t; 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 S238497AbhHCR5K (ORCPT + 99 others); Tue, 3 Aug 2021 13:57:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:49112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbhHCR5J (ORCPT ); Tue, 3 Aug 2021 13:57:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C458F60EE9; Tue, 3 Aug 2021 17:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628013418; bh=otxBD+W8br1qAlPGK0SncEhzdtcUQKKIHlh6UHZyLfk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lhw38K4tL11M/lh4pwWznrPoaZd2gBJdCWZq9ndQWobV4sb09fz6I3kYXuIchqyZy diCyclbOg3yYofB1q/6ZlIM9BC/q+7mYElSt6Ng3sjO3iSOb+lpV4IMVr8gBeiq/5q 47Ex0edUSEDPk3cMB1ZCUo1HvmzYWiSuWOOCSrocDc5kXiTs7xc1Csnk6t2+DmYIP6 9b0EX2XABw7yhvb1gtz5oi5z3h750VqIZRV3CApJwyD3zAiRVWHYp2Yl/h6FN6ovVm jtyx6Y2+QQwMmfjrkYQY0tlai3m584goy/5ItWVjBGjXIzrbYJNR2i7pbCc6K2nALF zW37x9AVJDY/Q== Date: Tue, 3 Aug 2021 20:56:54 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210803162507.GA2892108@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 } > > The above is talking about the address, which is checked inside > pagefault_mr() and does return EFAULT for all the cases I can see? > > Jason