Received: from eggs.gnu.org ([2001:4830:134:3::10]:50207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V23qI-0007Yj-8X for qemu-devel@nongnu.org; Wed, 24 Jul 2013 14:31:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V23qF-0000nZ-RS for qemu-devel@nongnu.org; Wed, 24 Jul 2013 14:31:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V23qF-0000nU-J2 for qemu-devel@nongnu.org; Wed, 24 Jul 2013 14:31:15 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6OIVEdc016712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Jul 2013 14:31:15 -0400 Date: Wed, 24 Jul 2013 15:31:12 -0300 From: Eduardo Habkost Message-ID: <20130724183112.GC3573@otherpad.lan.raisama.net> References: <00920fe1cd728db02fa4c81602b359986a3cf2a1.1374595782.git.jdenemar@redhat.com> <20130723163242.GQ2477@redhat.com> <20130723172838.GJ4718@orkuz.home> <20130724100302.GK30336@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130724100302.GK30336@redhat.com> Subject: Re: [Qemu-devel] [libvirt] [PATCH 4/7] qemu: Add monitor APIs to fetch CPUID data from QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: libvir-list@redhat.com, qemu-devel@nongnu.org On Wed, Jul 24, 2013 at 11:03:03AM +0100, Daniel P. Berrange wrote: > On Tue, Jul 23, 2013 at 07:28:38PM +0200, Jiri Denemark wrote: > > On Tue, Jul 23, 2013 at 17:32:42 +0100, Daniel Berrange wrote: > > > On Tue, Jul 23, 2013 at 06:11:33PM +0200, Jiri Denemark wrote: > > > > --- > > > > src/qemu/qemu_monitor.c | 21 +++ > > > > src/qemu/qemu_monitor.h | 3 + > > > > src/qemu/qemu_monitor_json.c | 162 +++++++++++++++++++++ > > > > src/qemu/qemu_monitor_json.h | 6 + > > > > tests/Makefile.am | 1 + > > > > .../qemumonitorjson-getcpu-empty.data | 2 + > > > > .../qemumonitorjson-getcpu-empty.json | 46 ++++++ > > > > .../qemumonitorjson-getcpu-filtered.data | 4 + > > > > .../qemumonitorjson-getcpu-filtered.json | 46 ++++++ > > > > .../qemumonitorjson-getcpu-full.data | 4 + > > > > .../qemumonitorjson-getcpu-full.json | 46 ++++++ > > > > .../qemumonitorjson-getcpu-host.data | 5 + > > > > .../qemumonitorjson-getcpu-host.json | 45 ++++++ > > > > tests/qemumonitorjsontest.c | 74 ++++++++++ > > > > 14 files changed, 465 insertions(+) > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-empty.data > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-empty.json > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-filtered.data > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-filtered.json > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.json > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data > > > > create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.json > > > > > > ACK, though I believe the design of this monitor API is flawed > > > because it requires you to re-launch QEMU with different accel > > > args > > > > Not really, this can be used in tcg too. It's just when we want to get > > the data for "host" CPU, we need to enable kvm as tcg knows nothing > > about that CPU. Which makes sense as kvm (the kernel module) influences > > how the "host" CPU will look like. > > Is there no ioctl() for the KVM module we can just invoke directly to > discover what CPU flag filtering it will perform. Presumably QEMU is > using some ioctl to discover this, so libvirt ought to be able to > too. > Yes, there is: GET_SUPPORTED_CPUID. But availability of some features may depend on QEMU capabilities as well. On those cases libvirt may need to combine the GET_SUPPORTED_CPUID results with what it knows about QEMU capabilities. But this should work as long as we report and document QEMU capabilities/options that affect CPU features very clearly. That may be an appropriate way to go to, if you don't mind having low-level KVM ioctl() code inside libvirt, that duplicates some QEMU logic. (But we still have the problem of querying/reporting CPU feature details that depend on machine-type+CPU-model [that is not addressed by this series yet]. See my previous message about it) -- Eduardo