Linux IOMMU Development
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@amd.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Steven Sistare <steven.sistare@oracle.com>,
	iommu@lists.linux.dev, Kevin Tian <kevin.tian@intel.com>,
	Nicolin Chen <nicolinc@nvidia.com>
Subject: Re: [PATCH V7 6/9] iommufd: pfn reader for file mappings
Date: Thu, 14 Nov 2024 15:03:36 +1100	[thread overview]
Message-ID: <71e700f2-178d-4847-8266-af285fd5f524@amd.com> (raw)
In-Reply-To: <987fe758-de45-44b1-843c-63f3f82fd864@amd.com>



On 8/11/24 11:01, Alexey Kardashevskiy wrote:
> 
> 
> On 8/11/24 01:08, Jason Gunthorpe wrote:
>> On Thu, Nov 07, 2024 at 09:00:50PM +1100, Alexey Kardashevskiy wrote:
>>> I was initially pointed at this patchset as an example of how my 
>>> guest_memfd
>>> pinning of private memory (CoCo VM) should look like. And so far it's 
>>> been
>>> good except the actual pinning part - memfd_pin_folios() - expects 
>>> the file
>>> to be shmem or hugetlbfs and guest_memfd is neither (well, last 
>>> couple of
>>> months). Is there any plan to add those? If none, I will then, just 
>>> wanted
>>> to check. At the moment I do what KVM does which is calling
>>> filemap_grab_folio(). Thanks,
>>
>> I understood that the guestmemfd folks really don't want typical
>> pinning behavior, you'll probably have to negotiate with them on
>> exactly what the interface is?
> 
> Yup I will, just checking the plans here.
> 
>> I though KVM had its own private interface to guestmemfd?
> 
> At the moment it is essentially this:
> 
> folio = filemap_grab_folio(file_inode(file)->i_mapping, index);

Turns out the complete sequence is:

folio = filemap_grab_folio(file_inode(file)->i_mapping, index);
folio_add_pins(folio, 1);
folio_put(folio);

so then unpin_user_page_range_dirty_lock() => 
gup_fast_unpin_user_pages() => gup_put_folio() work properly.

Later on, hopefully, guest_memfd will developed ability to mmap() and 
then the existing iommufd mapping API will "just work", I suppose. I'll 
carry on the above for now. Thanks,



> 
> Thanks,
> 

-- 
Alexey


  reply	other threads:[~2024-11-14  4:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 13:11 [PATCH V7 0/9] iommu_ioas_map_file Steve Sistare
2024-10-25 13:11 ` [PATCH V7 1/9] mm/gup: folio_add_pins Steve Sistare
2024-10-25 13:11 ` [PATCH V7 2/9] iommufd: rename uptr in iopt_alloc_iova Steve Sistare
2024-10-25 13:11 ` [PATCH V7 3/9] iommufd: generalize iopt_pages address Steve Sistare
2024-10-25 13:11 ` [PATCH V7 4/9] iommufd: pfn reader local variables Steve Sistare
2024-10-25 13:11 ` [PATCH V7 5/9] iommufd: folio subroutines Steve Sistare
2024-10-25 13:11 ` [PATCH V7 6/9] iommufd: pfn reader for file mappings Steve Sistare
2024-10-31  3:34   ` Alexey Kardashevskiy
2024-11-06  3:18     ` Alexey Kardashevskiy
2024-11-06 13:19       ` Steven Sistare
2024-11-07 10:00         ` Alexey Kardashevskiy
2024-11-07 13:21           ` Steven Sistare
2024-11-07 14:08           ` Jason Gunthorpe
2024-11-08  0:01             ` Alexey Kardashevskiy
2024-11-14  4:03               ` Alexey Kardashevskiy [this message]
2024-11-14 16:17                 ` Jason Gunthorpe
2024-11-18  1:24                   ` Alexey Kardashevskiy
2024-10-25 13:11 ` [PATCH V7 7/9] iommufd: IOMMU_IOAS_MAP_FILE Steve Sistare
2024-10-25 13:11 ` [PATCH V7 8/9] iommufd: file mappings for mdev Steve Sistare
2024-10-25 13:11 ` [PATCH V7 9/9] iommufd: map file selftest Steve Sistare
2024-10-25 13:14   ` Steven Sistare
2024-10-25 17:00     ` Nicolin Chen
2024-10-25 17:04   ` Nicolin Chen
2024-10-25 17:58     ` Steven Sistare
2024-10-25 18:39       ` Nicolin Chen
2024-10-25 23:58         ` Jason Gunthorpe
2024-10-26 19:13           ` Steven Sistare
2024-10-26 19:16             ` Steven Sistare
2024-10-26 23:09               ` Nicolin Chen
2024-10-27 14:38                 ` Steven Sistare
2024-10-30  0:11 ` [PATCH V7 0/9] iommu_ioas_map_file Jason Gunthorpe
2024-10-30 12:43   ` Steven Sistare
2024-11-04 13:58     ` Steven Sistare
2024-11-04 14:18       ` Jason Gunthorpe
2024-11-04 14:24         ` Steven Sistare

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=71e700f2-178d-4847-8266-af285fd5f524@amd.com \
    --to=aik@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=nicolinc@nvidia.com \
    --cc=steven.sistare@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox