From: Yan Zhao <yan.y.zhao@intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"cohuck@redhat.com" <cohuck@redhat.com>,
"zhenyuw@linux.intel.com" <zhenyuw@linux.intel.com>,
"Wang, Zhi A" <zhi.a.wang@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
"He, Shaopeng" <shaopeng.he@intel.com>,
"Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [RFC PATCH v2 1/9] vfio/pci: split vfio_pci_device into public and private parts
Date: Sun, 9 Feb 2020 19:34:36 -0500 [thread overview]
Message-ID: <20200210003436.GA3520@joy-OptiPlex-7040> (raw)
In-Reply-To: <20200207124831.391d5f70@w520.home>
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@intel.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@intel.com>
> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.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
next prev parent reply other threads:[~2020-02-10 0:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 2:08 [RFC PATCH v2 0/9] Introduce vendor ops in vfio-pci Yan Zhao
2020-01-31 2:09 ` [RFC PATCH v2 1/9] vfio/pci: split vfio_pci_device into public and private parts Yan Zhao
2020-02-07 19:48 ` Alex Williamson
2020-02-10 0:34 ` Yan Zhao [this message]
2020-01-31 2:10 ` [RFC PATCH v2 2/9] vfio/pci: export functions in vfio_pci_ops Yan Zhao
2020-01-31 2:11 ` [RFC PATCH v2 3/9] vfio/pci: register/unregister vfio_pci_vendor_driver_ops Yan Zhao
2020-01-31 2:11 ` [RFC PATCH v2 4/9] vfio/pci: macros to generate module_init and module_exit for vendor modules Yan Zhao
2020-01-31 2:12 ` [RFC PATCH v2 5/9] vfio/pci: let vfio_pci know how many vendor regions are registered Yan Zhao
2020-01-31 2:12 ` [RFC PATCH v2 6/9] vfio/pci: export vfio_pci_setup_barmap Yan Zhao
2020-01-31 2:13 ` [RFC PATCH v2 7/9] samples/vfio-pci: add a sample vendor module of vfio-pci for IGD devices Yan Zhao
2020-01-31 2:13 ` [RFC PATCH v2 8/9] vfio: header for vfio live migration region Yan Zhao
2020-01-31 2:13 ` [RFC PATCH v2 9/9] i40e/vf_migration: vfio-pci vendor driver for VF live migration Yan Zhao
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=20200210003436.GA3520@joy-OptiPlex-7040 \
--to=yan.y.zhao@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaopeng.he@intel.com \
--cc=yi.l.liu@intel.com \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@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