[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZPsv98Mr6ogzchCL@ziepe.ca>
Date: Fri, 8 Sep 2023 11:30:15 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Daisuke Matsuda <matsuda-daisuke@...itsu.com>
Cc: linux-rdma@...r.kernel.org, leon@...nel.org, zyjzyj2000@...il.com,
linux-kernel@...r.kernel.org, rpearsonhpe@...il.com,
yangx.jy@...itsu.com, lizhijian@...itsu.com, y-goto@...itsu.com
Subject: Re: [PATCH for-next v6 6/7] RDMA/rxe: Add support for
Send/Recv/Write/Read with ODP
On Fri, Sep 08, 2023 at 03:26:47PM +0900, Daisuke Matsuda wrote:
> +static inline bool rxe_odp_check_pages(struct rxe_mr *mr, u64 iova,
> + int length, u32 flags)
> +{
> + unsigned long lower, upper, idx;
> + unsigned long hmm_flags = HMM_PFN_VALID;
> + struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
> + struct page *page;
> + bool need_fault = false;
> +
> + lower = rxe_mr_iova_to_index(mr, iova);
> + upper = rxe_mr_iova_to_index(mr, iova + length - 1);
> +
> + if (!(flags & RXE_PAGEFAULT_RDONLY))
> + hmm_flags |= HMM_PFN_WRITE;
> +
> + /* xarray is protected by umem_mutex */
> + for (idx = lower; idx <= upper; idx++) {
> + page = xa_load(&mr->page_list, idx);
> +
> + if (!page || !(umem_odp->pfn_list[idx] & hmm_flags)) {
> + need_fault = true;
Again you don't need the pfn_list and rxe should perhaps ideally find
some way to disable it since we store struct pages in the xarray.
This could also be a xas loop
Jason
Powered by blists - more mailing lists