From: "Cédric Le Goater" <clg@redhat.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
John Levon <levon@movementarian.org>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
"eric.auger@redhat.com" <eric.auger@redhat.com>,
"joao.m.martins@oracle.com" <joao.m.martins@oracle.com>
Subject: Re: [PATCH 1/2] vfio/container: Support unmap all in one ioctl()
Date: Wed, 8 Oct 2025 15:01:34 +0200 [thread overview]
Message-ID: <7256274c-ac20-4ef8-9841-48be7bfa2b91@redhat.com> (raw)
In-Reply-To: <IA3PR11MB91364A76C06D76B0E6ADBEBD92E1A@IA3PR11MB9136.namprd11.prod.outlook.com>
On 10/8/25 12:18, Duan, Zhenzhong wrote:
>
>
>> -----Original Message-----
>> From: Cédric Le Goater <clg@redhat.com>
>> Subject: Re: [PATCH 1/2] vfio/container: Support unmap all in one ioctl()
>>
>> On 10/1/25 00:04, John Levon wrote:
>>> On Tue, Sep 30, 2025 at 05:26:59PM +0200, Cédric Le Goater wrote:
>>>
>>>>> - }
>>>>> + ret = ioctl(container->fd, VFIO_CHECK_EXTENSION,
>> VFIO_UNMAP_ALL);
>>>>
>>>> Could we introduce an helper to test 'unmap_all' support in the host
>>>> kernel ? The result would be something like :
>>>>
>>>> if (unmap_all) {
>>>> if
>> (vfio_legacy_has_unmap_all(VFIO_IOMMU_LEGACY(bcontainer))) {
>>>> flags = VFIO_DMA_UNMAP_FLAG_ALL;
>>>> } else {
>>>> /* The unmap ioctl doesn't accept a full 64-bit span. */
>>>> Int128 llsize = int128_rshift(int128_2_64(), 1);
>>>> ...
>>>> }
>>>> }
>>>
>>> For reference/consideration, the previous approach taken in the vfio-user
>>> series:
>>>
>>>
>> https://lore.kernel.org/qemu-devel/20250219144858.266455-4-john.levon@
>> nutanix.com/
>>>
>>> @@ -533,6 +562,11 @@ static bool vfio_legacy_setup(VFIOContainerBase
>> *bcontainer, Error **errp)
>>> vfio_get_info_iova_range(info, bcontainer);
>>>
>>> vfio_get_iommu_info_migration(container, info);
>>> +
>>> + ret = ioctl(container->fd, VFIO_CHECK_EXTENSION,
>> VFIO_UNMAP_ALL);
>>> +
>>> + container->unmap_all_supported = (ret != 0);
>
> Good suggestion, thanks John.
>
>>>
>>> (I dropped this particular change as part of getting merged.)
>> Yes. I'm reconsidering now.
>>
>> Should we introduce a VFIOContainerBase attribute/flag
>> 'unmap_all_supported',
>> set in the vioc->setup handler ?
>
> Do you mean to check bcontainer->unmap_all_supported and do the split in vfio_listener_region_del()?
>
> If only checking it in legacy container, putting it in VFIOLegacyContainer sounds better?
It depends if vfio-user needs it too.
C.
next prev parent reply other threads:[~2025-10-08 13:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 7:02 [PATCH 0/2] Optimize unmap_all with one ioctl() Zhenzhong Duan
2025-09-24 7:02 ` [PATCH 1/2] vfio/container: Support unmap all in " Zhenzhong Duan
2025-09-30 15:26 ` Cédric Le Goater
2025-09-30 22:04 ` John Levon
2025-10-01 6:58 ` Cédric Le Goater
2025-10-08 10:18 ` Duan, Zhenzhong
2025-10-08 13:01 ` Cédric Le Goater [this message]
2025-10-08 13:11 ` John Levon
2025-10-08 13:26 ` Cédric Le Goater
2025-10-08 10:17 ` Duan, Zhenzhong
2025-09-24 7:02 ` [PATCH 2/2] vfio/iommufd: " Zhenzhong Duan
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=7256274c-ac20-4ef8-9841-48be7bfa2b91@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=eric.auger@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=levon@movementarian.org \
--cc=qemu-devel@nongnu.org \
--cc=zhenzhong.duan@intel.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;
as well as URLs for NNTP newsgroup(s).