qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, minyard@acm.org,
	Corey Minyard <cminyard@mvista.com>
Subject: Re: [Qemu-devel] [PATCH v2] Sort the fw_cfg file list
Date: Tue, 15 Mar 2016 09:45:18 +0200	[thread overview]
Message-ID: <20160315093529-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1458027249.13231.27.camel@redhat.com>

On Tue, Mar 15, 2016 at 08:34:09AM +0100, Gerd Hoffmann wrote:
> On Di, 2016-03-15 at 09:17 +0200, Michael S. Tsirkin wrote:
> > On Tue, Mar 15, 2016 at 08:04:48AM +0100, Gerd Hoffmann wrote:
> > >   Hi,
> > > 
> > > > > Don't add a new machine type in this version, just use the 2.6 one.
> > > > 
> > > > Unfortunately this patch won't help any, as your next patch reorders fw
> > > > cfg files which will affect the old machine types.
> > > 
> > > We can make that depend on dont_sort_fw_cfgs too, to keep things as-is
> > > on old machine types.
> > 
> > Yes, except the name is a bit off then. It's more "legacy_fw_cfg_order"
> > than "dont_sort_fw_cfgs".
> > 
> > > Which probably implies only new machine types
> > > will see the new smbios entries.
> > > 
> > > cheers,
> > >   Gerd
> > 
> > Not really I think.
> > If there's a new device triggering a new smbios entry, we don't care how
> > it's sorted since by then there's no question of cross-version migration
> > with old QEMU.
> 
> As I understand things the smbios fw_cfg file must be created later to
> make new entries (created by devices) are actually visible.  So we can
> make that initialization order change depend on dont_sort_fw_cfgs (or
> legacy_fw_cfg_order) too.  That way we maintain the ordering for old
> machine types. 

Yes.

> But old machine types then will also not see the entries
> added by devices.  Which isn't a problem I think, old qemu versions
> don't have support for that device in the first place ...

Depends on how you code it up.  We have a list, we look each file
there and sort accordingly.  Fine.
New devices will not be on this list, I guess you can just ignore them
and guests will not see them. OK but I think it is better to make old
machine types see them.  It's trivially easy and more user-friendly.
Simply sort anything that is not on the list alphabetically and
add it at the end.

> Corey, can you please send all this in a patch series?  This should make
> those dependencies more clear ...
> 
> thanks,
>   Gerd
> 
> > 

So like this:

fw_cfg_find(a) {
    for (index = 0; index < fw_cfg_legacy_array_size; ++index)
        if (!strcmp(a, ...))
            break;
    return index;
}

fw_cfg_cmp(a, b) {
    in cmp;
    if (legacy_fw_cfg_order) {
        int list1 = find(a);
        int list2 = find(b);

        if (list1 < list2)
            return -1;
        if (list1 > list2)
            return 1;
    }

    return strcmp(a, b);
}


This way anything not on list is sorted,
with !legacy_fw_cfg_order list is assumed empty.

-- 
MST

  reply	other threads:[~2016-03-15  7:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 16:55 [Qemu-devel] [PATCH v2] Sort the fw_cfg file list minyard
2016-03-15  6:57 ` Michael S. Tsirkin
2016-03-15  7:04   ` Gerd Hoffmann
2016-03-15  7:17     ` Michael S. Tsirkin
2016-03-15  7:34       ` Gerd Hoffmann
2016-03-15  7:45         ` Michael S. Tsirkin [this message]
2016-03-15  8:45           ` Gerd Hoffmann
2016-03-15  9:37             ` Michael S. Tsirkin
2016-03-15 12:38               ` Corey Minyard
2016-03-15 12:45                 ` Michael S. Tsirkin
2016-03-15 12:56                   ` Corey Minyard
2016-03-15 13:47                     ` Michael S. Tsirkin
2016-03-15 14:43                     ` Michael S. Tsirkin
2016-03-15 16:36                   ` Corey Minyard
2016-03-15 17:01                     ` Michael S. Tsirkin
2016-03-16 15:21                       ` Corey Minyard
2016-03-16 15:34                         ` Paolo Bonzini
2016-03-16 15:37                         ` Michael S. Tsirkin
2016-03-15 13:03               ` Gerd Hoffmann
2016-03-15 13:19                 ` Michael S. Tsirkin

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=20160315093529-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=cminyard@mvista.com \
    --cc=kraxel@redhat.com \
    --cc=minyard@acm.org \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).