From: Alex Williamson <alex.williamson@redhat.com>
To: Kirti Wankhede <kwankhede@nvidia.com>, Neo Jia <cjia@nvidia.com>,
"Tian, Kevin" <kevin.tian@intel.com>
Cc: "Song, Jike" <jike.song@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Lv, Zhiyuan" <zhiyuan.lv@intel.com>,
"Ruan, Shuai" <shuai.ruan@intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
qemu-devel <qemu-devel@nongnu.org>,
"igvt-g@lists.01.org" <igvt-g@ml01.01.org>
Subject: Re: VFIO based vGPU(was Re: [Announcement] 2015-Q3 release of XenGT - a Mediated ...)
Date: Wed, 27 Jan 2016 14:58:28 -0700 [thread overview]
Message-ID: <1453931908.18221.5.camel@redhat.com> (raw)
In-Reply-To: <56A92EC4.5050105@nvidia.com>
On Thu, 2016-01-28 at 02:25 +0530, Kirti Wankhede wrote:
>
> On 1/27/2016 9:30 PM, Alex Williamson wrote:
> > On Wed, 2016-01-27 at 13:36 +0530, Kirti Wankhede wrote:
> > >
> > > On 1/27/2016 1:36 AM, Alex Williamson wrote:
> > > > On Tue, 2016-01-26 at 02:20 -0800, Neo Jia wrote:
> > > > > On Mon, Jan 25, 2016 at 09:45:14PM +0000, Tian, Kevin wrote:
> > > > > > > From: Alex Williamson [mailto:alex.williamson@redhat.com]
> > > > >
> > > > > Hi Alex, Kevin and Jike,
> > > > >
> > > > > (Seems I shouldn't use attachment, resend it again to the list, patches are
> > > > > inline at the end)
> > > > >
> > > > > Thanks for adding me to this technical discussion, a great opportunity
> > > > > for us to design together which can bring both Intel and NVIDIA vGPU solution to
> > > > > KVM platform.
> > > > >
> > > > > Instead of directly jumping to the proposal that we have been working on
> > > > > recently for NVIDIA vGPU on KVM, I think it is better for me to put out couple
> > > > > quick comments / thoughts regarding the existing discussions on this thread as
> > > > > fundamentally I think we are solving the same problem, DMA, interrupt and MMIO.
> > > > >
> > > > > Then we can look at what we have, hopefully we can reach some consensus soon.
> > > > >
> > > > > > Yes, and since you're creating and destroying the vgpu here, this is
> > > > > > where I'd expect a struct device to be created and added to an IOMMU
> > > > > > group. The lifecycle management should really include links between
> > > > > > the vGPU and physical GPU, which would be much, much easier to do with
> > > > > > struct devices create here rather than at the point where we start
> > > > > > doing vfio "stuff".
> > > > >
> > > > > Infact to keep vfio-vgpu to be more generic, vgpu device creation and management
> > > > > can be centralized and done in vfio-vgpu. That also include adding to IOMMU
> > > > > group and VFIO group.
> > > > Is this really a good idea? The concept of a vgpu is not unique to
> > > > vfio, we want vfio to be a driver for a vgpu, not an integral part of
> > > > the lifecycle of a vgpu. That certainly doesn't exclude adding
> > > > infrastructure to make lifecycle management of a vgpu more consistent
> > > > between drivers, but it should be done independently of vfio. I'll go
> > > > back to the SR-IOV model, vfio is often used with SR-IOV VFs, but vfio
> > > > does not create the VF, that's done in coordination with the PF making
> > > > use of some PCI infrastructure for consistency between drivers.
> > > >
> > > > It seems like we need to take more advantage of the class and driver
> > > > core support to perhaps setup a vgpu bus and class with vfio-vgpu just
> > > > being a driver for those devices.
> > >
> > > For device passthrough or SR-IOV model, PCI devices are created by PCI
> > > bus driver and from the probe routine each device is added in vfio group.
> >
> > An SR-IOV VF is created by the PF driver using standard interfaces
> > provided by the PCI core. The IOMMU group for a VF is added by the
> > IOMMU driver when the device is created on the pci_bus_type. The probe
> > routine of the vfio bus driver (vfio-pci) is what adds the device into
> > the vfio group.
> >
> > > For vgpu, there should be a common module that create vgpu device, say
> > > vgpu module, add vgpu device to an IOMMU group and then add it to vfio
> > > group. This module can handle management of vgpus. Advantage of keeping
> > > this module a separate module than doing device creation in vendor
> > > modules is to have generic interface for vgpu management, for example,
> > > files /sys/class/vgpu/vgpu_start and /sys/class/vgpu/vgpu_shudown and
> > > vgpu driver registration interface.
> >
> > But you're suggesting something very different from the SR-IOV model.
> > If we wanted to mimic that model, the GPU specific driver should create
> > the vgpu using services provided by a common interface. For instance
> > i915 could call a new vgpu_device_create() which creates the device,
> > adds it to the vgpu class, etc. That vgpu device should not be assumed
> > to be used with vfio though, that should happen via a separate probe
> > using a vfio-vgpu driver. It's that vfio bus driver that will add the
> > device to a vfio group.
> >
>
> In that case vgpu driver should provide a driver registration interface
> to register vfio-vgpu driver.
>
> struct vgpu_driver {
> const char *name;
> int (*probe) (struct vgpu_device *vdev);
> void (*remove) (struct vgpu_device *vdev);
> }
>
> int vgpu_register_driver(struct vgpu_driver *driver)
> {
> ...
> }
> EXPORT_SYMBOL(vgpu_register_driver);
>
> int vgpu_unregister_driver(struct vgpu_driver *driver)
> {
> ...
> }
> EXPORT_SYMBOL(vgpu_unregister_driver);
>
> vfio-vgpu driver registers to vgpu driver. Then from
> vgpu_device_create(), after creating the device it calls
> vgpu_driver->probe(vgpu_device) and vfio-vgpu driver adds the device to
> vfio group.
>
> +--------------+ vgpu_register_driver()+---------------+
> > __init() +------------------------->+ |
> > | | |
> > +<-------------------------+ vgpu.ko |
> > vfio_vgpu.ko | probe()/remove() | |
> > | +---------+ +---------+
> +--------------+ | +-------+-------+ |
> | ^ |
> | callback | |
> | +-------+--------+ |
> | |vgpu_register_device() |
> | | | |
> +---^-----+-----+ +-----+------+-+
> | nvidia.ko | | i915.ko |
> | | | |
> +-----------+ +------------+
>
> Is my understanding correct?
We have an entire driver core subsystem in Linux for the purpose of
matching devices to drivers, I don't think we should be re-inventing
that. That's why I'm suggesting that we should have infrastructure
which facilitates GPU drivers to create vGPU devices in a common way,
perhaps even placing the devices on a virtual vgpu bus, and then allow a
vfio-vgpu driver to register as a driver for devices of that bus/class
and use the existing driver callbacks. Thanks,
Alex
next prev parent reply other threads:[~2016-01-27 21:58 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 2:39 VFIO based vGPU(was Re: [Announcement] 2015-Q3 release of XenGT - a Mediated ...) Jike Song
2016-01-18 4:47 ` Alex Williamson
2016-01-18 8:56 ` Jike Song
2016-01-18 19:05 ` Alex Williamson
2016-01-20 8:59 ` Jike Song
2016-01-20 9:05 ` Tian, Kevin
2016-01-25 11:34 ` Jike Song
2016-01-25 21:30 ` Alex Williamson
2016-01-25 21:45 ` Tian, Kevin
2016-01-25 21:48 ` Tian, Kevin
2016-01-26 9:48 ` Neo Jia
2016-01-26 10:20 ` Neo Jia
2016-01-26 19:24 ` Tian, Kevin
2016-01-26 19:29 ` Neo Jia
2016-01-26 20:06 ` Alex Williamson
2016-01-26 21:38 ` Tian, Kevin
2016-01-26 22:28 ` Neo Jia
2016-01-26 23:30 ` Alex Williamson
2016-01-27 9:14 ` Neo Jia
2016-01-27 16:10 ` Alex Williamson
2016-01-27 21:48 ` Neo Jia
2016-01-27 8:06 ` Kirti Wankhede
2016-01-27 16:00 ` Alex Williamson
2016-01-27 20:55 ` Kirti Wankhede
2016-01-27 21:58 ` Alex Williamson [this message]
2016-01-28 3:01 ` Kirti Wankhede
2016-01-26 7:41 ` Jike Song
2016-01-26 14:05 ` Yang Zhang
2016-01-26 16:37 ` Alex Williamson
2016-01-26 21:21 ` Tian, Kevin
2016-01-26 21:30 ` Neo Jia
2016-01-26 21:43 ` Tian, Kevin
2016-01-26 21:43 ` Alex Williamson
2016-01-26 21:50 ` Tian, Kevin
2016-01-26 22:07 ` Alex Williamson
2016-01-26 22:15 ` Tian, Kevin
2016-01-26 22:27 ` Alex Williamson
2016-01-26 22:39 ` Tian, Kevin
2016-01-26 22:56 ` Alex Williamson
2016-01-27 1:47 ` Jike Song
2016-01-27 3:07 ` Alex Williamson
2016-01-27 5:43 ` Jike Song
2016-01-27 16:19 ` Alex Williamson
2016-01-28 6:00 ` Jike Song
2016-01-28 15:23 ` Alex Williamson
2016-01-29 7:20 ` Jike Song
2016-01-29 8:49 ` [iGVT-g] " Jike Song
2016-01-29 18:50 ` Alex Williamson
2016-02-01 13:10 ` Gerd Hoffmann
2016-02-01 21:44 ` Alex Williamson
2016-02-02 7:28 ` Gerd Hoffmann
2016-02-02 7:35 ` Zhiyuan Lv
2016-01-27 1:52 ` Yang Zhang
2016-01-27 3:37 ` Alex Williamson
2016-01-27 0:06 ` Jike Song
2016-01-27 1:34 ` Yang Zhang
2016-01-27 1:51 ` Jike Song
2016-01-26 16:12 ` Alex Williamson
2016-01-26 21:57 ` Tian, Kevin
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=1453931908.18221.5.camel@redhat.com \
--to=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=igvt-g@ml01.01.org \
--cc=jike.song@intel.com \
--cc=kevin.tian@intel.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shuai.ruan@intel.com \
--cc=zhiyuan.lv@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).