All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] target-i386: "custom" CPU model + script to dump existing CPU models
@ 2015-06-08 19:07 Eduardo Habkost
  2015-06-08 19:07 ` [Qemu-devel] [PATCH 1/2] target-i386: Introduce "-cpu custom" Eduardo Habkost
                   ` (3 more replies)
  0 siblings, 4 replies; 81+ messages in thread
From: Eduardo Habkost @ 2015-06-08 19:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: mimu, borntraeger, Igor Mammedov, Paolo Bonzini, Jiri Denemark,
	Andreas Färber, rth

The problem:

The existing libvirt APIs assume that if a given CPU model is runnable in a
host kernel+hardware combination, it will be always runnable on that host even
if the machine-type changes.

That assumption is implied in some of libvirt interfaces, for example, at:

1) Host capabilities, which let callers know the set of CPU models
   that can run in a host:
   https://libvirt.org/formatcaps.html#elementHost

   "virsh capabilities" returns a CPU model name + CPU feature list, assuming
   that a CPU model name has a meaning that's independent from the
   machine-type.

2) The function that checks if a given CPU model definition
   is compatible with a host (virConnectCompareCPU()),
   which does not take the machine-type as argument:
   http://libvirt.org/html/libvirt-libvirt-host.html#virConnectCompareCPU

But that assumption is not true, as QEMU changes CPU models in new
machine-types when fixing bugs, or when new features (previously unsupported by
QEMU, TCG or KVM) get implemented.

The solution:

libvirt can solve this problem partially by making sure every feature in a CPU
model is explicitly configured, instead of (incorrectly) expecting that a named
CPU model will never change in QEMU. But this doesn't solve the problem
completely, because it is still possible that new features unknown to libvirt
get enabled in the default CPU model in future machine-types (that's very
likely to happen when we introduce new KVM features, for example).

So, to make sure no new feature will be ever enabled without the knowledge of
libvirt, add a "-cpu custom" mode, where no CPU model data is loaded at all,
and everything needs to be configured explicitly using CPU properties. That
means no CPU features will ever change depending on machine-type or accelerator
capabilities when using "-cpu custom".

                              * * *

I know that this is basically the opposite of what we were aiming at in the
last few month^Wyears, where we were struggling to implement probing interfaces
to expose machine-type-dependent data for libvirt. But, at least the fact that
we could implement the new approach using a 9-line patch means we were still
going in the right direction. :)

To help libvirt in the transition, a x86-cpu-model-dump script is provided,
that will generate a config file that can be loaded using -readconfig, based on
the -cpu and -machine options provided in the command-line.

                              * * *

This is basically the same version I sent as an RFC in April. A git tree is
available at:

  git://github.com/ehabkost/qemu-hacks.git work/x86-cpu-custom-model

Eduardo Habkost (2):
  target-i386: Introduce "-cpu custom"
  scripts: x86-cpu-model-dump script

 scripts/x86-cpu-model-dump | 322 +++++++++++++++++++++++++++++++++++++++++++++
 target-i386/cpu.c          |  10 +-
 2 files changed, 331 insertions(+), 1 deletion(-)
 create mode 100755 scripts/x86-cpu-model-dump

-- 
2.1.0

^ permalink raw reply	[flat|nested] 81+ messages in thread

end of thread, other threads:[~2015-06-24 16:15 UTC | newest]

Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-08 19:07 [Qemu-devel] [PATCH 0/2] target-i386: "custom" CPU model + script to dump existing CPU models Eduardo Habkost
2015-06-08 19:07 ` [Qemu-devel] [PATCH 1/2] target-i386: Introduce "-cpu custom" Eduardo Habkost
2015-06-08 19:07 ` [Qemu-devel] [PATCH 2/2] scripts: x86-cpu-model-dump script Eduardo Habkost
2015-06-08 20:18 ` [Qemu-devel] [PATCH 0/2] target-i386: "custom" CPU model + script to dump existing CPU models Jiri Denemark
2015-06-09  8:56   ` Daniel P. Berrange
2015-06-09 13:16     ` Eduardo Habkost
2015-06-23 12:32   ` Andreas Färber
2015-06-23 15:08     ` Eduardo Habkost
2015-06-23 15:32       ` Michael S. Tsirkin
2015-06-23 15:58         ` Eduardo Habkost
2015-06-23 16:15           ` Andreas Färber
2015-06-23 16:25             ` Daniel P. Berrange
2015-06-23 16:33               ` Michael S. Tsirkin
2015-06-23 16:38                 ` Eduardo Habkost
2015-06-23 16:44                   ` Andreas Färber
2015-06-23 17:08                     ` Eduardo Habkost
2015-06-23 17:18                       ` Andreas Färber
2015-06-23 17:27                         ` Daniel P. Berrange
2015-06-23 17:41                           ` Andreas Färber
2015-06-23 17:45                             ` Eduardo Habkost
2015-06-23 17:58                               ` Andreas Färber
2015-06-23 18:05                                 ` Daniel P. Berrange
2015-06-23 18:11                                 ` Eduardo Habkost
2015-06-23 17:55                             ` Daniel P. Berrange
2015-06-23 17:39                         ` Eduardo Habkost
2015-06-23 18:35                           ` Andreas Färber
2015-06-23 19:25                             ` Eduardo Habkost
2015-06-23 19:41                               ` Andreas Färber
2015-06-23 19:53                                 ` Eduardo Habkost
2015-06-23 20:26                                 ` Eduardo Habkost
2015-06-23 21:38                                   ` Michael S. Tsirkin
2015-06-23 16:42                 ` Daniel P. Berrange
2015-06-23 16:47                   ` Andreas Färber
2015-06-23 17:11                     ` Eduardo Habkost
2015-06-23 21:34                       ` Michael S. Tsirkin
2015-06-24 14:24                         ` Eduardo Habkost
2015-06-24 14:37                           ` Michael S. Tsirkin
2015-06-24 15:44                             ` [Qemu-devel] Not introducing new host-side requirements on new machine-type versions (was Re: [PATCH 0/2] target-i386: "custom" CPU model + script to dump existing CPU models) Eduardo Habkost
2015-06-24 15:58                               ` Andreas Färber
2015-06-24 16:08                                 ` Eduardo Habkost
2015-06-24 16:15                                   ` Andreas Färber
2015-06-24 15:59                               ` Paolo Bonzini
2015-06-23 17:13                     ` [Qemu-devel] [PATCH 0/2] target-i386: "custom" CPU model + script to dump existing CPU models Daniel P. Berrange
2015-06-23 17:29                       ` Andreas Färber
2015-06-23 17:42                         ` Eduardo Habkost
2015-06-23 17:55                           ` Andreas Färber
2015-06-23 17:58                             ` Daniel P. Berrange
2015-06-23 21:28                           ` Michael S. Tsirkin
2015-06-24 14:18                             ` Eduardo Habkost
2015-06-24 14:24                               ` Michael S. Tsirkin
2015-06-23 21:26                       ` Michael S. Tsirkin
2015-06-23 21:23                   ` Michael S. Tsirkin
2015-06-24  8:52                     ` Daniel P. Berrange
2015-06-24 10:31                       ` Michael S. Tsirkin
2015-06-24 14:16                     ` Eduardo Habkost
2015-06-24 14:19                       ` Michael S. Tsirkin
2015-06-24 14:35                         ` Andreas Färber
2015-06-24 14:57                           ` Michael S. Tsirkin
2015-06-24 15:43                             ` Andreas Färber
2015-06-24 14:38                       ` Paolo Bonzini
2015-06-24 14:54                         ` Peter Maydell
2015-06-24 14:56                           ` Paolo Bonzini
2015-06-24 15:58                         ` Eduardo Habkost
2015-06-24 16:00                           ` Paolo Bonzini
2015-06-23 16:40               ` Andreas Färber
2015-06-23 16:53                 ` Daniel P. Berrange
2015-06-23 17:10                   ` Andreas Färber
2015-06-23 17:24                     ` Eduardo Habkost
2015-06-23 17:31                       ` Daniel P. Berrange
2015-06-23 16:32             ` Eduardo Habkost
2015-06-23 17:01               ` Andreas Färber
2015-06-23 15:51       ` Daniel P. Berrange
2015-06-23 15:56         ` Michael S. Tsirkin
2015-06-23 16:00           ` Daniel P. Berrange
2015-06-23 16:30             ` Michael S. Tsirkin
2015-06-24  9:20     ` Jiri Denemark
2015-06-24 10:21       ` Michael S. Tsirkin
2015-06-24 10:31         ` Daniel P. Berrange
2015-06-24 10:40           ` Michael S. Tsirkin
2015-06-24 10:32         ` Paolo Bonzini
2015-06-16 17:40 ` Eduardo Habkost

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.