Re: [for-next PATCH v6 04/10] RDMA/rxe: Allow registering persistent flag for pmem MR only

From: lizhijian@xxxxxxxxxxx
Date: Wed Nov 23 2022 - 01:13:23 EST




On 22/11/2022 22:46, Jason Gunthorpe wrote:
> On Wed, Nov 16, 2022 at 04:19:45PM +0800, Li Zhijian wrote:
>> int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>> int access, struct rxe_mr *mr)
>> {
>> @@ -148,16 +157,25 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>> num_buf = 0;
>> map = mr->map;
>> if (length > 0) {
>> - buf = map[0]->buf;
>> + bool persistent_access = access & IB_ACCESS_FLUSH_PERSISTENT;
>>
>> + buf = map[0]->buf;
>> for_each_sgtable_page (&umem->sgt_append.sgt, &sg_iter, 0) {
>> + struct page *pg = sg_page_iter_page(&sg_iter);
>> +
>> + if (persistent_access && !is_pmem_page(pg)) {
>> + pr_debug("Unable to register persistent access to non-pmem device\n");
>> + err = -EINVAL;
>> + goto err_release_umem;
>
> This should use rxe_dbg_mr()
>

Good catch, thanks

Zhijian

> Jason