From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [RFC PATCH v1 1/1] vGPU core driver : to provide common interface for vGPU. Date: Wed, 03 Feb 2016 09:28:31 +0100 Message-ID: <1454488111.4967.39.camel@redhat.com> References: <56AFD231.3010404@nvidia.com> <56B00AD7.6070103@nvidia.com> <1454400043.9300.31.camel@redhat.com> <20160202081312.GA9895@nvidia.com> <20160202083114.GB9895@nvidia.com> <1454433079.30910.3.camel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Cc: Alex Williamson , Neo Jia , Kirti Wankhede , Paolo Bonzini , "Ruan, Shuai" , "Song, Jike" , "Lv, Zhiyuan" , "kvm@vger.kernel.org" , qemu-devel To: "Tian, Kevin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44368 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755166AbcBCI2e convert rfc822-to-8bit (ORCPT ); Wed, 3 Feb 2016 03:28:34 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Hi, > Actually I have a long puzzle in this area. Definitely libvirt will use UUID to > mark a VM. And obviously UUID is not recorded within KVM. Then how does > libvirt talk to KVM based on UUID? It could be a good reference to this design. libvirt keeps track which qemu instance belongs to which vm. qemu also gets started with "-uuid ...", so one can query qemu via monitor ("info uuid") to figure what the uuid is. It is also in the smbios tables so the guest can see it in the system information table. The uuid is not visible to the kernel though, the kvm kernel driver doesn't know what the uuid is (and neither does vfio). qemu uses file handles to talk to both kvm and vfio. qemu notifies both kvm and vfio about anything relevant events (guest address space changes etc) and connects file descriptors (eventfd -> irqfd). qemu needs a sysfs node as handle to the vfio device, something like /sys/devices/virtual/vgpu/. can be a uuid if you want have it that way, but it could be pretty much anything. The sysfs node will probably show up as-is in the libvirt xml when assign a vgpu to a vm. So the name should be something stable (i.e. when using a uuid as name you should better not generate a new one on each boot). cheers, Gerd