All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: libvir-list@redhat.com, Jiri Denemark <jdenemar@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Gleb Natapov <gleb@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [libvirt] Modern CPU models cannot be used with libvirt
Date: Sun, 25 Mar 2012 09:59:04 -0500	[thread overview]
Message-ID: <4F6F32B8.7050401@codemonkey.ws> (raw)
In-Reply-To: <4F6F2FB4.5060405@redhat.com>

On 03/25/2012 09:46 AM, Avi Kivity wrote:
> On 03/25/2012 04:36 PM, Anthony Liguori wrote:
>>> Apart from the command line length, it confuses configuration with
>>> definition.
>>
>>
>> There is no distinction with what we have today.  Our configuration
>> file basically corresponds to command line options and as there is no
>> distinction in command line options, there's no distinction in the
>> configuration format.
>
> We don't have command line options for defining, only configuring.

That's an oversight.  There should be a -cpudef option.  It's a QemuOptsList.

> Again, defining = #define

I think -global fits your definition of #define...

> Configuring = modifying current instance
>
>>
>>> target-x86_64-cpus.cfg does not configure qemu for anything, it's merely
>>> the equivalent of
>>>
>>>     #define westmere (x86_def_t) { ... }
>>>     #define nehalem (x86_def_t) { ... }
>>>     #define bulldozer (x86_def_t) { ... } // for PC
>>>
>>> so it should be read at each invocation.  On the other hand, pc.cfg and
>>> westmere.cfg (as used previously) are shorthand for
>>>
>>>      machine = (QEMUMachine) { ... };
>>>      cpu = (x86_def_t) { ... };
>>>
>>> so they should only be read if requested explicitly (or indirectly).
>>
>> This doesn't make a lot of sense to me.  Here's what I'm proposing:
>>
>> 1) QEMU would have a target-x86_64-cpu.cfg.in that is installed by
>> default in /etc/qemu.  It would contain:
>>
>> [system]
>> # Load default CPU definitions
>> readconfig = @DATADIR@/target-x86_64-cpus.cfg
>>
>> 2) target-x86_64-cpus.cfg would be installed to @DATADIR@ and would
>> contain:
>>
>> [cpudef]
>>    name = "Westmere"
>>    ...
>>
>> This has the following properties:
>>
>> A) QEMU has no builtin notion of CPU definitions.  It just has a "cpu
>> factory".  -cpudef will create a new class called Westmere that can
>> then be enumerated through qom-type-list and created via qom-create.
>>
>> B) A management tool has complete control over cpu definitions without
>> modifying the underlying filesystem.  -nodefconfig will prevent it
>> from loading and the management tool can explicitly load the QEMU
>> definition (via -readconfig, potentially using a /dev/fd/N path) or it
>> can define it's own cpu definitions.
>
> Why does -nodefconfig affect anything?

Because -nodefconfig means "don't load *any* default configuration files".

> The file defines westmere as an alias for a grab bag of options.
> Whether it's loaded or not is immaterial, unless someone uses one of the
> names within.

But you would agree, a management tool should be able to control whether class 
factories get loaded, right?  So what's the mechanism to do this?

>> C) This model maps to any other type of class factory.  Machines will
>> eventually be expressed as a class factory.  When we implement this,
>> we would change the default target-x86_64-cpu.cfg to:
>>
>> [system]
>> # Load default CPU definitions
>> readconfig = @DATADIR@/target-x86_64-cpus.cfg
>> # Load default machines
>> readconfig = @DATADIR@/target-x86_64-machines.cfg
>>
>> A machine definition would look like:
>>
>> [machinedef]
>>   name = pc-0.15
>>   virtio-blk.class_code = 32
>>   ...
>>
>> Loading a file based on -cpu doesn't generalize well unless we try to
>> load a definition for any possible QOM type to find the class factory
>> for it.  I don't think this is a good idea.
>
> Why not load all class factories?  Just don't instantiate any objects.

Unless we have two different config syntaxes, I think it will lead to a lot of 
confusion.  Having some parts of a config file be parsed and others not is 
fairly strange.

> Otherwise, the meaning of -nodefconfig changes as more stuff is moved
> out of .c and into .cfg.

What's the problem with this?

>>>>> The reasoning is, loading target-x86_64-cpus.cfg does not alter the
>>>>> current instance's configuration, so reading it doesn't violate
>>>>> -nodefconfig.
>>>>
>>>> I think we have a different view of what -nodefconfig does.
>>>>
>>>> We have a couple options today:
>>>>
>>>> -nodefconfig
>>>>
>>>> Don't read the default configuration files.  By default, we read
>>>> /etc/qemu/qemu.cfg and /etc/qemu/target-$(ARCH).cfg
>>>>
>>>
>>> The latter seems meaningless to avoid reading.  It's just a set of
>>> #defines, what do you get by not reading it?
>>
>> In my target-$(ARCH).cfg, I have:
>>
>> [machine]
>> enable-kvm = "on"
>>
>> Which means I don't have to use -enable-kvm anymore.  But if you look
>> at a tool like libguestfs, start up time is the most important thing
>> so avoiding unnecessary I/O and processing is critical.
>
> So this is definitely configuration (applies to the current instance) as
> opposed to target-x86_64.cfg, which doesn't.

I'm not sure which part you're responding to..

>>
>>>> -nodefaults
>>>>
>>>> Don't create default devices.
>>>>
>>>> -vga none
>>>>
>>>> Don't create the default VGA device (not covered by -nodefaults).
>>>>
>>>> With these two options, the semantics you get an absolutely
>>>> minimalistic instance of QEMU.  Tools like libguestfs really want to
>>>> create the simplest guest and do the least amount of processing so the
>>>> guest runs as fast as possible.
>>>>
>>>> It does suck a lot that this isn't a single option.  I would much
>>>> prefer -nodefaults to be implied by -nodefconfig.  Likewise, I would
>>>> prefer that -nodefaults implied -vga none.
>>>
>>> I don't have a qemu.cfg so can't comment on it, but in what way does
>>> reading target-x86_64.cfg affect the current instance (that is, why is
>>> -nodefconfig needed over -nodefaults -vga look-at-the-previous-option?)
>>
>> It depends on what the user configures it to do.
>
> How?
>
> As far as I can tell, the only difference is that -nodefconfig -cpu
> westmere will error out instead of working.  But if you don't supply
> -cpu westmere, the configuration is identical.

What configuration?

Let me ask, what do you think the semantics of -nodefconfig should be?  I'm not 
sure I understand what you're advocating for.

Regards,

Anthony Liguori

  reply	other threads:[~2012-03-25 14:59 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 14:54 [Qemu-devel] Modern CPU models cannot be used with libvirt Jiri Denemark
2011-12-15 14:58 ` Anthony Liguori
2011-12-15 15:30   ` Jiri Denemark
2011-12-18 10:07     ` Dor Laor
2011-12-15 15:42 ` [Qemu-devel] [libvirt] " Daniel P. Berrange
2011-12-18  9:58   ` Gleb Natapov
2012-03-09 20:56     ` Eduardo Habkost
2012-03-09 21:04       ` Daniel P. Berrange
2012-03-09 21:15         ` Anthony Liguori
2012-03-10  4:37           ` Eduardo Habkost
2012-03-11 11:45           ` Gleb Natapov
2012-03-10 12:42         ` Daniel P. Berrange
2012-03-10 15:58           ` Eduardo Habkost
2012-03-10 18:24             ` Anthony Liguori
2012-03-10 18:37               ` Andreas Färber
2012-03-10 22:39               ` Doug Goldstein
2012-03-11  0:55               ` Andrew Cathrow
2012-03-11 13:27               ` Gleb Natapov
2012-03-11 14:12                 ` Anthony Liguori
2012-03-11 14:56                   ` Gleb Natapov
2012-03-11 15:33                     ` Anthony Liguori
2012-03-11 16:16                       ` Gleb Natapov
2012-03-12 14:48                         ` Anthony Liguori
2012-03-12 15:16                           ` Eduardo Habkost
2012-03-12 15:49                         ` Andreas Färber
2012-03-12 16:50                           ` Eduardo Habkost
2012-03-12 17:41                             ` Andreas Färber
2012-03-12 17:47                               ` Peter Maydell
2012-03-12 17:53                                 ` Andreas Färber
2012-03-12 17:55                                   ` Gleb Natapov
2012-03-12 17:59                                   ` Alexander Graf
2012-03-12 17:52                               ` Gleb Natapov
2012-03-12 18:30                               ` Eduardo Habkost
2012-03-12 18:42                                 ` Anthony Liguori
2012-03-12 18:53                       ` Itamar Heim
2012-03-12 19:01                         ` Anthony Liguori
2012-03-12 19:12                           ` Itamar Heim
2012-03-12 19:50                             ` Anthony Liguori
2012-03-12 20:00                               ` Itamar Heim
2012-03-12 20:19                               ` Ayal Baron
2012-03-13  8:32                                 ` Itamar Heim
2012-03-14  0:11                                   ` Ayal Baron
2012-03-12 12:52                   ` Eduardo Habkost
2012-03-12 13:04                     ` Daniel P. Berrange
2012-03-12 13:15                       ` Gleb Natapov
2012-03-12 13:32                         ` Eduardo Habkost
2012-03-12 13:34                           ` Gleb Natapov
2012-03-12 13:50                         ` Daniel P. Berrange
2012-03-12 13:53                           ` Gleb Natapov
2012-03-12 13:55                             ` Daniel P. Berrange
2012-03-12 14:01                               ` Gleb Natapov
2012-03-25 13:21                   ` Avi Kivity
2012-03-25 13:26                     ` Anthony Liguori
2012-03-25 16:06                       ` Avi Kivity
2012-03-11 12:41             ` Gleb Natapov
2012-03-11 14:16               ` Anthony Liguori
2012-03-11 15:12                 ` Gleb Natapov
2012-03-11 15:41                   ` Anthony Liguori
2012-03-11 16:27                     ` Gleb Natapov
2012-03-12 13:08                     ` Eduardo Habkost
2012-03-13 14:53                       ` Eduardo Habkost
2012-03-22  9:32                         ` Gleb Natapov
2012-03-22 13:31                           ` Eduardo Habkost
2012-03-22 14:30                             ` Gleb Natapov
2012-03-22 15:50                               ` Eduardo Habkost
2012-03-25 10:19                                 ` Gleb Natapov
2012-03-25 13:09                                   ` Anthony Liguori
2012-03-25 14:46                                     ` Gleb Natapov
2012-03-25 15:06                                       ` Anthony Liguori
2012-03-25 16:34                                         ` Gleb Natapov
2012-03-26 16:00                                   ` Eduardo Habkost
2012-03-22 16:37                           ` Anthony Liguori
2012-03-22 17:14                             ` Eduardo Habkost
2012-03-22 20:01                               ` Anthony Liguori
2012-03-25  9:49                                 ` Gleb Natapov
2012-03-25 12:55                                   ` Anthony Liguori
2012-03-25 13:08                                     ` Avi Kivity
2012-03-25 13:12                                       ` Anthony Liguori
2012-03-25 13:14                                         ` Avi Kivity
2012-03-25 13:22                                           ` Anthony Liguori
2012-03-25 13:34                                             ` Avi Kivity
2012-03-25 14:36                                               ` Anthony Liguori
2012-03-25 14:46                                                 ` Avi Kivity
2012-03-25 14:59                                                   ` Anthony Liguori [this message]
2012-03-25 15:16                                                     ` Avi Kivity
2012-03-25 15:26                                                       ` Anthony Liguori
2012-03-25 15:40                                                         ` Avi Kivity
2012-03-25 18:11                                                           ` Anthony Liguori
2012-03-26  9:08                                                             ` Avi Kivity
2012-03-26  9:53                                                               ` Gleb Natapov
2012-03-26 19:03                                                               ` Anthony Liguori
2012-03-28  9:55                                                                 ` Avi Kivity
2012-03-26 16:34                                                             ` Eduardo Habkost
2012-03-26 11:24                                                         ` Jiri Denemark
2012-03-26 11:59                                                           ` Avi Kivity
2012-03-26 12:03                                                             ` Gleb Natapov
2012-03-26 16:14                                                               ` Eduardo Habkost
2012-03-26 19:04                                                                 ` Anthony Liguori
2012-03-25 14:58                                           ` Gleb Natapov
2012-03-25 15:07                                             ` Anthony Liguori
2012-03-25 15:18                                               ` Avi Kivity
2012-03-25 15:30                                                 ` Anthony Liguori
2012-03-25 15:45                                                   ` Avi Kivity
2012-03-25 18:01                                                     ` Anthony Liguori
2012-03-25 18:09                                                       ` Avi Kivity
2012-03-26 19:00                                                         ` Anthony Liguori
2012-03-28  9:59                                                           ` Avi Kivity
2012-03-20 18:59       ` Eduardo Habkost

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=4F6F32B8.7050401@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 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.