[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200210003436.GA3520@joy-OptiPlex-7040>
Date: Sun, 9 Feb 2020 19:34:36 -0500
From: Yan Zhao <yan.y.zhao@...el.com>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"cohuck@...hat.com" <cohuck@...hat.com>,
"zhenyuw@...ux.intel.com" <zhenyuw@...ux.intel.com>,
"Wang, Zhi A" <zhi.a.wang@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
"He, Shaopeng" <shaopeng.he@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>
Subject: Re: [RFC PATCH v2 1/9] vfio/pci: split vfio_pci_device into public
and private parts
On Sat, Feb 08, 2020 at 03:48:31AM +0800, Alex Williamson wrote:
> On Thu, 30 Jan 2020 21:09:56 -0500
> Yan Zhao <yan.y.zhao@...el.com> wrote:
>
> > split vfio_pci_device into two parts:
> > (1) a public part,
> > including pdev, num_region, irq_type which are accessible from
> > outside of vfio.
> > (2) a private part,
> > a pointer to vfio_pci_device_private, only accessible within vfio
> >
> > Cc: Kevin Tian <kevin.tian@...el.com>
> > Signed-off-by: Yan Zhao <yan.y.zhao@...el.com>
> > ---
> > drivers/vfio/pci/vfio_pci.c | 209 +++++++++++++++-------------
> > drivers/vfio/pci/vfio_pci_config.c | 157 +++++++++++----------
> > drivers/vfio/pci/vfio_pci_igd.c | 16 +--
> > drivers/vfio/pci/vfio_pci_intrs.c | 171 ++++++++++++-----------
> > drivers/vfio/pci/vfio_pci_nvlink2.c | 16 +--
> > drivers/vfio/pci/vfio_pci_private.h | 5 +-
> > drivers/vfio/pci/vfio_pci_rdwr.c | 36 ++---
> > include/linux/vfio.h | 7 +
> > 8 files changed, 321 insertions(+), 296 deletions(-)
>
> I think the typical solution to something like this would be...
>
> struct vfio_pci_device {
> ...
> };
>
> struct vfio_pci_device_private {
> struct vfio_pci_device vdev;
> ...
> };
>
> External code would be able to work with the vfio_pci_device and
> internal code would do a container_of() to get access to the private
> fields. What's done here is pretty ugly and not very cache friendly.
> Thanks,
>
got it, it's much better!
will change it. Thanks!
Yan
Powered by blists - more mailing lists