From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kirti Wankhede Subject: Re: [Qemu-devel] [PATCH v7 0/4] Add Mediated device support Date: Fri, 2 Sep 2016 22:45:54 +0530 Message-ID: References: <1472097235-6332-1-git-send-email-kwankhede@nvidia.com> <20160830101638.49df467d@t450s.home> <78fedd65-6d62-e849-ff3b-d5105b2da816@redhat.com> <20160901105948.62f750aa@t450s.home> <98bbdbbf-c388-9120-3306-64f0cfb820a7@nvidia.com> <8682faeb-0331-f014-c13e-03c20f3f2bdf@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: "Song, Jike" , "cjia@nvidia.com" , "kvm@vger.kernel.org" , "libvir-list@redhat.com" , "Tian, Kevin" , "qemu-devel@nongnu.org" , "kraxel@redhat.com" , Laine Stump , "bjsdjshi@linux.vnet.ibm.com" To: Paolo Bonzini , Michal Privoznik , Alex Williamson Return-path: Received: from hqemgate16.nvidia.com ([216.228.121.65]:10062 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932236AbcIBRQO (ORCPT ); Fri, 2 Sep 2016 13:16:14 -0400 In-Reply-To: <8682faeb-0331-f014-c13e-03c20f3f2bdf@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 9/2/2016 3:35 PM, Paolo Bonzini wrote: > > > On 02/09/2016 07:21, Kirti Wankhede wrote: >> On 9/2/2016 10:18 AM, Michal Privoznik wrote: >>> Okay, maybe I'm misunderstanding something. I just thought that users >>> will consult libvirt's nodedev driver (e.g. virsh nodedev-list && virsh >>> nodedev-dumpxml $id) to fetch vGPU capabilities and then use that info >>> to construct domain XML. >> >> I'm not familiar with libvirt code, curious how libvirt's nodedev driver >> enumerates devices in the system? > > It looks at sysfs and/or the udev database and transforms what it finds > there to XML. > > I think people would consult the nodedev driver to fetch vGPU > capabilities, use "virsh nodedev-create" to create the vGPU device on > the host, and then somehow refer to the nodedev in the domain XML. > > There isn't very much documentation on nodedev-create, but it's used > mostly for NPIV (virtual fibre channel adapter) and the XML looks like this: > > > scsi_host6 > scsi_host5 > > > 2001001b32a9da5e > 2101001b32a9da5e > > > > > so I suppose for vGPU it would look like this: > > > my-vgpu > pci_0000_86_00_0 > > > 0695d332-7831-493f-9e71-1c85c8911a08 > > > > while the parent would have: > > > pci_0000_86_00_0 > > 0 > 134 > 0 > 0 > > > > > GRID M60-0B > 2 > 45 > 524288 > 2560 > 1600 > > > GRID M60 > NVIDIA > > > > After creating the vGPU, if required by the host driver, all the other > type ids would disappear from "virsh nodedev-dumpxml pci_0000_86_00_0" too. > Thanks Paolo for details. 'nodedev-create' parse the xml file and accordingly write to 'create' file in sysfs to create mdev device. Right? At this moment, does libvirt know which VM this device would be associated with? > When dumping the mdev with nodedev-dumpxml, it could show more complete > info, again taken from sysfs: > > > my-vgpu > pci_0000_86_00_0 > > 0695d332-7831-493f-9e71-1c85c8911a08 > > > GRID M60-0B > 2 > 45 > 524288 > 2560 > 1600 > > > > > ... > NVIDIA > > > > > Notice how the parent has mdev inside pci; the vGPU, if it has to have > pci at all, would have it inside mdev. This represents the difference > between the mdev provider and the mdev device. > Parent of mdev device might not always be a PCI device. I think we shouldn't consider it as PCI capability. > Random proposal for the domain XML too: > > > > > 0695d332-7831-493f-9e71-1c85c8911a08 > >
> > When user wants to assign two mdev devices to one VM, user have to add such two entries or group the two devices in one entry? On other mail thread with same subject we are thinking of creating group of mdev devices to assign multiple mdev devices to one VM. Libvirt don't have to know about group number but libvirt should add all mdev devices in a group. Is that possible to do before starting QEMU process? Thanks, Kirti > Paolo >