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: Mon, 18 Nov 2024 12:24:41 +1100	[thread overview]
Message-ID: <95807b05-d9f8-4e18-aa52-f40c2e45aedc@amd.com> (raw)
In-Reply-To: <20241114161723.GO35230@nvidia.com>



On 15/11/24 03:17, Jason Gunthorpe wrote:
> On Thu, Nov 14, 2024 at 03:03:36PM +1100, Alexey Kardashevskiy wrote:
>>>> 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.
> 
> I'm surprised given how forceful people were that pinning should not
> be done there. Please confirm with guestmemfd experts..
> 
>> 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,
> 
> I think that is not possible, the entire point of guest memfd is that
> private memory is never mapped.

It was like that but recently the approach changed to allow mappings. I 
do not think the interface is finalized yet though.

> For the AMD case we still need to program the address of private
> memory into the hypervisor iommu page tables, so the FD path will have
> to used to make that connection.

Right, using it now in my working tree, with this new vdevice thingy 
https://github.com/aik/linux/commits/tsm/
Thanks,

-- 
Alexey


  reply	other threads:[~2024-11-18  1:24 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
2024-11-14 16:17                 ` Jason Gunthorpe
2024-11-18  1:24                   ` Alexey Kardashevskiy [this message]
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=95807b05-d9f8-4e18-aa52-f40c2e45aedc@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