kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>, <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/1] vfio/spapr_tce: convert get_user_pages() --> pin_user_pages()
Date: Tue, 26 May 2020 12:45:18 -0700	[thread overview]
Message-ID: <40a4e26f-b89b-a3db-6936-f94b9bb4fc9d@nvidia.com> (raw)
In-Reply-To: <CAFqt6zYmYQ93jbKNAjDpiH7exjyGv8E-2xHW++yV5CiYMyL5ew@mail.gmail.com>

On 2020-05-26 12:28, Souptick Joarder wrote:
>> @@ -486,7 +486,7 @@ static int tce_iommu_use_page(unsigned long tce, unsigned long *hpa)
>>          struct page *page = NULL;
>>          enum dma_data_direction direction = iommu_tce_direction(tce);
>>
>> -       if (get_user_pages_fast(tce & PAGE_MASK, 1,
>> +       if (pin_user_pages_fast(tce & PAGE_MASK, 1,
>>                          direction != DMA_TO_DEVICE ? FOLL_WRITE : 0,
>>                          &page) != 1)
>>                  return -EFAULT;
> 
> There are few places where nr_pages is passed as 1 to get_user_pages_fast().
> With similar conversion those will be changed to pin_user_pages_fast().
> 
> Does it make sense to add an inline like - pin_user_page_fast(), similar to
> get_user_page_fast_only() ( now merged in linux-next) ?
> 

Perhaps not *just* yet, IMHO. There are only two places so far: here, and
dax_lock_page(). And we don't expect that many places, either, because
pin_user_pages*(), unlike get_user_pages(), is more likely to operate on
a bunch of pages at once. Although, that could change if we look into the
remaining call sites and find more single-page cases that need a gup-to-pup
conversion.

get_user_pages*() has a few more situations (Case 4, in
Documentation/core-api/pin_user_pages.rst: struct page manipulation) in
which it operates on single pages. Those will remain get_user_pages*()
calls, or perhaps change to get_user_page().


thanks,
-- 
John Hubbard
NVIDIA

      reply	other threads:[~2020-05-26 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23  1:43 [PATCH 1/1] vfio/spapr_tce: convert get_user_pages() --> pin_user_pages() John Hubbard
2020-05-26 19:28 ` Souptick Joarder
2020-05-26 19:45   ` John Hubbard [this message]

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=40a4e26f-b89b-a3db-6936-f94b9bb4fc9d@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).