From: Eric Auger <eric.auger@redhat.com>
To: "Cédric Le Goater" <clg@redhat.com>,
"Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "alex.williamson@redhat.com" <alex.williamson@redhat.com>,
"jgg@nvidia.com" <jgg@nvidia.com>,
"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
"Martins, Joao" <joao.m.martins@oracle.com>,
"peterx@redhat.com" <peterx@redhat.com>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
"Liu, Yi L" <yi.l.liu@intel.com>,
"Sun, Yi Y" <yi.y.sun@intel.com>,
"Peng, Chao P" <chao.p.peng@intel.com>,
Yi Sun <yi.y.sun@linux.intel.com>,
Daniel Henrique Barboza <danielhb413@gmail.com>,
David Gibson <david@gibson.dropbear.id.au>,
Greg Kurz <groug@kaod.org>,
Harsh Prateek Bora <harshpb@linux.ibm.com>,
"open list:sPAPR (pseries)" <qemu-ppc@nongnu.org>
Subject: Re: [PATCH v1 13/22] vfio: Add base container
Date: Wed, 20 Sep 2023 15:58:31 +0200 [thread overview]
Message-ID: <c2649acb-37cb-896c-266d-d3e42cf27fd1@redhat.com> (raw)
In-Reply-To: <4df735b7-addb-cc02-05dc-360752d5ae35@redhat.com>
Hi Cédric,
On 9/20/23 14:57, Cédric Le Goater wrote:
> On 9/20/23 10:48, Duan, Zhenzhong wrote:
>>
>>
>>> -----Original Message-----
>>> From: Cédric Le Goater <clg@redhat.com>
>>> Sent: Wednesday, September 20, 2023 1:24 AM
>>> Subject: Re: [PATCH v1 13/22] vfio: Add base container
>>>
>>> On 8/30/23 12:37, Zhenzhong Duan wrote:
>>>> From: Yi Liu <yi.l.liu@intel.com>
>>>>
>>>> Abstract the VFIOContainer to be a base object. It is supposed to be
>>>> embedded by legacy VFIO container and later on, into the new iommufd
>>>> based container.
>>>>
>>>> The base container implements generic code such as code related to
>>>> memory_listener and address space management. The VFIOContainerOps
>>>> implements callbacks that depend on the kernel user space being used.
>>>>
>>>> 'common.c' and vfio device code only manipulates the base container
>>>> with
>>>> wrapper functions that calls the functions defined in
>>>> VFIOContainerOpsClass.
>>>> Existing 'container.c' code is converted to implement the legacy
>>>> container
>>>> ops functions.
>>>>
>>>> Below is the base container. It's named as VFIOContainer, old
>>>> VFIOContainer
>>>> is replaced with VFIOLegacyContainer.
>>>
>>> Usualy, we introduce the new interface solely, port the current models
>>> on top of the new interface, wire the new models in the current
>>> implementation and remove the old implementation. Then, we can start
>>> adding extensions to support other implementations.
>>
>> Not sure if I understand your point correctly. Do you mean to introduce
>> a new type for the base container as below:
>>
>> static const TypeInfo vfio_container_info = {
>> .parent = TYPE_OBJECT,
>> .name = TYPE_VFIO_CONTAINER,
>> .class_size = sizeof(VFIOContainerClass),
>> .instance_size = sizeof(VFIOContainer),
>> .abstract = true,
>> .interfaces = (InterfaceInfo[]) {
>> { TYPE_VFIO_IOMMU_BACKEND_OPS },
>> { }
>> }
>> };
>>
>> and a new interface as below:
>>
>> static const TypeInfo nvram_info = {
>> .name = TYPE_VFIO_IOMMU_BACKEND_OPS,
>> .parent = TYPE_INTERFACE,
>> .class_size = sizeof(VFIOIOMMUBackendOpsClass),
>> };
>>
>> struct VFIOIOMMUBackendOpsClass {
>> InterfaceClass parent;
>> VFIODevice *(*dev_iter_next)(VFIOContainer *container,
>> VFIODevice *curr);
>> int (*dma_map)(VFIOContainer *container,
>> ......
>> };
>>
>> and legacy container on top of TYPE_VFIO_CONTAINER?
>>
>> static const TypeInfo vfio_legacy_container_info = {
>> .parent = TYPE_VFIO_CONTAINER,
>> .name = TYPE_VFIO_LEGACY_CONTAINER,
>> .class_init = vfio_legacy_container_class_init,
>> };
>>
>> This object style is rejected early in RFCv1.
>> See
>> https://lore.kernel.org/kvm/20220414104710.28534-8-yi.l.liu@intel.com/
>
> ouch. this is long ago and I was not aware :/ Bare with me, I will
> probably ask the same questions. Nevertheless, we could improve the
> cover and the flow of changes in the patchset to help the reader.
>
>>> spapr should be taken care of separatly following the principle above.
>>> With my PPC hat, I would not even read such a massive change, too risky
>>> for the subsystem. This path will need (much) further splitting to be
>>> understandable and acceptable.
>>
>> I'll digging into this and try to split it.
>
> I know I am asking for a lot of work. Thanks for that.
>
>> Meanwhile, there are many changes
>> just renaming the parameter or function name for code readability.
>> For example:
>>
>> -int vfio_dma_unmap(VFIOContainer *container, hwaddr iova,
>> - ram_addr_t size, IOMMUTLBEntry *iotlb)
>> +static int vfio_legacy_dma_unmap(VFIOContainer *bcontainer, hwaddr
>> iova,
>> + ram_addr_t size, IOMMUTLBEntry *iotlb)
>>
>> - ret = vfio_get_dirty_bitmap(container, iova, size,
>> + ret = vfio_get_dirty_bitmap(bcontainer, iova, size,
>>
>> Let me know if you think such changes are unnecessary which could reduce
>> this patch largely.
>
> Cleanups, renames, some code reshuffling, anything preparing ground for
> the new abstraction is good to have first and can be merged very quickly
> if there are no functional changes. It reduces the overall patchset and
> ease the coming reviews.
>
> You can send such series independently. That's fine.
>
>>
>>>
>>> Also, please include the .h file first, it helps in reading.
>>
>> Do you mean to put struct declaration earlier in patch description?
>
> Just add to your .gitconfig :
>
> [diff]
> orderFile = /path/to/qemu/scripts/git.orderfile
>
> It should be enough
>
>>> Have you considered using an InterfaceClass ?
>>
>> See above, with object style rejected, it looks hard to use
>> InterfaceClass.
>
> I am not convinced by the QOM approach. I will dig in the past arguments
> and let's see what we come with.
Here is the reference:
https://lore.kernel.org/all/YmuFv2s5TPuw7K%2Fu@yekko/
Eric
>
> Thanks,
>
> C.
>
>
>> Thanks
>> Zhenzhong
>>
>
next prev parent reply other threads:[~2023-09-20 13:59 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 10:37 [PATCH v1 00/22] vfio: Adopt iommufd Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 01/22] scripts/update-linux-headers: Add iommufd.h Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 02/22] Update linux-header to support iommufd cdev and hwpt alloc Zhenzhong Duan
2023-09-14 14:46 ` Eric Auger
2023-09-15 3:02 ` Duan, Zhenzhong
2023-09-20 11:04 ` Eric Auger
2023-09-20 11:15 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 03/22] vfio/common: Move IOMMU agnostic helpers to a separate file Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 04/22] vfio/common: Introduce vfio_container_add|del_section_window() Zhenzhong Duan
2023-09-20 11:23 ` Eric Auger
2023-09-20 12:18 ` Duan, Zhenzhong
2023-09-21 8:28 ` Cédric Le Goater
2023-09-21 10:14 ` Duan, Zhenzhong
2023-09-21 10:55 ` Cédric Le Goater
2023-09-27 2:08 ` Duan, Zhenzhong
2023-09-27 6:50 ` Cédric Le Goater
2023-08-30 10:37 ` [PATCH v1 05/22] vfio/common: Extract out vfio_kvm_device_[add/del]_fd Zhenzhong Duan
2023-09-20 11:49 ` Eric Auger
2023-09-21 2:04 ` Duan, Zhenzhong
2023-09-21 8:42 ` Cédric Le Goater
2023-09-21 10:22 ` Duan, Zhenzhong
2023-09-21 10:53 ` Cédric Le Goater
2023-09-20 21:39 ` Alex Williamson
2023-09-21 6:03 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 06/22] vfio/common: Add a vfio device iterator Zhenzhong Duan
2023-09-20 12:25 ` Eric Auger
2023-09-21 2:27 ` Duan, Zhenzhong
2023-09-20 22:16 ` Alex Williamson
2023-09-21 2:16 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 07/22] vfio/common: Refactor vfio_viommu_preset() to be group agnostic Zhenzhong Duan
2023-09-20 13:00 ` Eric Auger
2023-09-21 2:52 ` Duan, Zhenzhong
2023-09-20 22:51 ` Alex Williamson
2023-09-21 6:13 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 08/22] vfio/common: Move legacy VFIO backend code into separate container.c Zhenzhong Duan
2023-09-20 13:12 ` Eric Auger
2023-09-21 3:02 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 09/22] vfio/container: Introduce vfio_[attach/detach]_device Zhenzhong Duan
2023-09-20 13:33 ` Eric Auger
2023-09-21 3:08 ` Duan, Zhenzhong
2023-09-21 9:44 ` Cédric Le Goater
2023-09-21 10:26 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 10/22] vfio/platform: Use vfio_[attach/detach]_device Zhenzhong Duan
2023-09-21 12:17 ` Cédric Le Goater
2023-08-30 10:37 ` [PATCH v1 11/22] vfio/ap: " Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 12/22] vfio/ccw: " Zhenzhong Duan
2023-09-21 12:19 ` Cédric Le Goater
2023-09-21 13:00 ` Duan, Zhenzhong
2023-09-21 13:24 ` Cédric Le Goater
2023-08-30 10:37 ` [PATCH v1 13/22] vfio: Add base container Zhenzhong Duan
2023-09-19 17:23 ` Cédric Le Goater
2023-09-20 8:48 ` Duan, Zhenzhong
2023-09-20 12:57 ` Cédric Le Goater
2023-09-20 13:58 ` Eric Auger [this message]
2023-09-21 2:51 ` Duan, Zhenzhong
2023-09-20 13:53 ` Eric Auger
2023-09-21 3:12 ` Duan, Zhenzhong
2023-09-20 17:31 ` Eric Auger
2023-09-21 3:35 ` Duan, Zhenzhong
2023-09-21 6:28 ` Eric Auger
2023-09-21 17:20 ` Eric Auger
2023-09-22 2:52 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 14/22] vfio/common: Simplify vfio_viommu_preset() Zhenzhong Duan
2023-09-19 16:01 ` Cédric Le Goater
2023-09-20 2:59 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 15/22] Add iommufd configure option Zhenzhong Duan
2023-09-19 17:07 ` Cédric Le Goater
2023-09-20 3:42 ` Duan, Zhenzhong
2023-09-20 12:19 ` Cédric Le Goater
2023-09-20 12:51 ` Jason Gunthorpe
2023-09-20 13:01 ` Daniel P. Berrangé
2023-09-20 13:07 ` Jason Gunthorpe
2023-09-20 13:02 ` Cédric Le Goater
2023-09-20 17:37 ` Eric Auger
2023-09-20 17:49 ` Jason Gunthorpe
2023-09-20 18:17 ` Alex Williamson
2023-09-20 18:19 ` Jason Gunthorpe
2023-09-21 3:43 ` Duan, Zhenzhong
2023-09-26 6:05 ` Tian, Kevin
2023-09-21 4:00 ` Duan, Zhenzhong
2023-09-21 2:11 ` Duan, Zhenzhong
2023-09-20 18:01 ` Alex Williamson
2023-09-20 18:12 ` Jason Gunthorpe
2023-09-20 20:29 ` Alex Williamson
2023-09-20 18:15 ` Daniel P. Berrangé
2023-08-30 10:37 ` [PATCH v1 16/22] backends/iommufd: Introduce the iommufd object Zhenzhong Duan
2023-09-22 7:15 ` Cédric Le Goater
2023-09-22 8:39 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 17/22] util/char_dev: Add open_cdev() Zhenzhong Duan
2023-09-20 12:39 ` Daniel P. Berrangé
2023-09-20 12:53 ` Jason Gunthorpe
2023-09-20 12:56 ` Daniel P. Berrangé
2023-09-21 2:37 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 18/22] vfio/iommufd: Implement the iommufd backend Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 19/22] vfio/iommufd: Add vfio device iterator callback for iommufd Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 20/22] vfio/pci: Adapt vfio pci hot reset support with iommufd BE Zhenzhong Duan
2023-08-30 10:37 ` [PATCH v1 21/22] vfio/pci: Allow the selection of a given iommu backend Zhenzhong Duan
2023-09-06 18:10 ` Jason Gunthorpe
2023-09-06 19:09 ` Alex Williamson
2023-09-07 1:10 ` Jason Gunthorpe
2023-09-07 2:27 ` Duan, Zhenzhong
2023-08-30 10:37 ` [PATCH v1 22/22] vfio/pci: Make vfio cdev pre-openable by passing a file handle Zhenzhong Duan
2023-09-14 9:04 ` [PATCH v1 00/22] vfio: Adopt iommufd Eric Auger
2023-09-14 9:27 ` Duan, Zhenzhong
2023-09-15 12:42 ` Cédric Le Goater
2023-09-15 13:14 ` Duan, Zhenzhong
2023-09-18 11:51 ` Jason Gunthorpe
2023-09-18 12:23 ` Cédric Le Goater
2023-09-18 17:56 ` Jason Gunthorpe
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=c2649acb-37cb-896c-266d-d3e42cf27fd1@redhat.com \
--to=eric.auger@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=chao.p.peng@intel.com \
--cc=clg@redhat.com \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=harshpb@linux.ibm.com \
--cc=jasowang@redhat.com \
--cc=jgg@nvidia.com \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=nicolinc@nvidia.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=yi.l.liu@intel.com \
--cc=yi.y.sun@intel.com \
--cc=yi.y.sun@linux.intel.com \
--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).