All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Li Zhijian <lizhijian@fujitsu.com>,
	Zhu Yanjun <zyjzyj2000@gmail.com>,
	Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ira Weiny <ira.weiny@intel.com>
Subject: Re: [for-next PATCH 4/5] RDMA/rxe: refactor iova_to_vaddr
Date: Wed, 23 Nov 2022 00:24:26 +0100	[thread overview]
Message-ID: <2158152.NgBsaNRSFp@suse> (raw)
In-Reply-To: <Y3vJQkc40o5zfM5v@ziepe.ca>

On lunedì 21 novembre 2022 19:53:54 CET Jason Gunthorpe wrote:
> On Wed, Nov 16, 2022 at 01:37:14PM +0100, Fabio M. De Francesco wrote:
> > > -     return (void *)(uintptr_t)mr->map[m]->buf[n].addr + offset;
> > > +     if (mr->ibmr.type == IB_MR_TYPE_USER) {
> > > +             char *paddr;
> > > +             struct page *pg = mr->map[m]->buf[n].page;
> > > +
> > > +             paddr = kmap_local_page(pg);
> > > +             if (paddr == NULL) {
> > > +                     pr_warn("Failed to map page");
> > > +                     return NULL;
> > > +             }
> > 
> > I know nothing about this code but I am here as a result of regular checks
> > for changes to HIGHMEM mappings across the entire kernel. So please 
forgive
> > me if I'm objecting to the correct changes.
> > 
> > 1) It looks like this code had a call to page_address() and you converted 
it
> > to mapping with kmap_local_page().
> 
> It only worked properly because the kconfig is blocking CONFIG_HIGHMEM
> so ZONE_HIGHMEM doesn't exist. These pages are obtained from GUP and
> could be anything.
> 
> This is done indirectly through
> 
> config INFINIBAND_VIRT_DMA
>         def_bool !HIGHMEM
> But this patch is undoing parts of what are causing that restriction
> by using the proper APIs. Though I'm not sure if we can eventually get
> to remove it for RXE completely.
> Jason

Ah, OK. This code was for !HIGHMEM kernels...

I understand but, FWIW I doubt that the use of page_address(), instead of 
kmapping, should ever be made on the bases that kconfig is blocking HIGHMEM.  

However, if I understand correctly, that restriction (!HIGHMEM) is going to be 
removed. Therefore, page_address() will break on HIGHMEM and Jason is 
correctly converting to kmap_local_page().

There is only one thing left... I think that he missed another mail from me. 
The one you responded to was missing the final paragraph, so I sent another 
message few minutes later.

kmap_local_page() returns always valid pointers to kernel virtual addresses. I 
can't see any ways for kmap_local_page() to return NULL. Therefore, I was 
asking for the reason to check for NULL.

Thanks,

Fabio




  reply	other threads:[~2022-11-22 23:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11  4:30 [for-next PATCH 0/5] iova_to_vaddr refactor Li Zhijian
2022-11-11  4:30 ` [for-next PATCH 1/5] RDMA/rxe: Remove rxe_phys_buf.size Li Zhijian
2022-11-18 16:38   ` Jason Gunthorpe
2022-11-11  4:30 ` [for-next PATCH 2/5] RDMA/rxe: use iova_to_vaddr to transform iova for rxe_mr_copy Li Zhijian
2022-11-18 16:41   ` Jason Gunthorpe
2022-11-11  4:30 ` [for-next PATCH 3/5] RDMA/rxe: iova_to_vaddr cleanup Li Zhijian
2022-11-11  4:30 ` [for-next PATCH 4/5] RDMA/rxe: refactor iova_to_vaddr Li Zhijian
2022-11-16 12:37   ` Fabio M. De Francesco
2022-11-18  1:32     ` lizhijian
2022-11-21 18:53     ` Jason Gunthorpe
2022-11-22 23:24       ` Fabio M. De Francesco [this message]
2022-11-22 23:55         ` Fabio M. De Francesco
2022-11-16 12:49   ` Fabio M. De Francesco
2022-11-18 17:33   ` Jason Gunthorpe
2022-11-11  4:32 ` [for-next PATCH 5/5] RDMA/rxe: Rename iova_to_vaddr to rxe_map_iova Li Zhijian
2022-11-11  6:13 ` [for-next PATCH 0/5] iova_to_vaddr refactor lizhijian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2158152.NgBsaNRSFp@suse \
    --to=fmdefrancesco@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.