qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-i386: Improve x86_cpu_list output


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH] target-i386: Improve x86_cpu_list output
Date: Wed, 27 Feb 2013 00:26:38 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Feb 26, 2013 at 10:57:56PM +0100, Igor Mammedov wrote:
> On Sat, 23 Feb 2013 16:45:00 +0100
> Jan Kiszka <address@hidden> wrote:
> 
> > From: Jan Kiszka <address@hidden>
> > 
> > Several issues fixed:
> >  - We were missing a bunch of feature lists. Fix this by simply dumping
> >    the meta list feature_word_info.
> >  - kvm_enabled() cannot be true at this point because accelerators are
> >    initialized much later during init. Simply dump unconditionally.
> Why not to move list_cpu after accelerators are initialized?

Because help output is simply documentation and shouldn't depend on any
other config option parsing or accelerator initialization at all?

> 
> >  - Add explanation for "host" CPU type.
> > 
> > Signed-off-by: Jan Kiszka <address@hidden>
> > ---
> >  target-i386/cpu.c |   20 +++++++++-----------
> >  1 files changed, 9 insertions(+), 11 deletions(-)
> > 
> > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > index dfcf86e..6e742f0 100644
> > --- a/target-i386/cpu.c
> > +++ b/target-i386/cpu.c
> > @@ -1453,18 +1453,16 @@ void x86_cpu_list(FILE *f, fprintf_function 
> > cpu_fprintf)
> >          snprintf(buf, sizeof(buf), "%s", def->name);
> >          (*cpu_fprintf)(f, "x86 %16s  %-48s\n", buf, def->model_id);
> >      }
> > -    if (kvm_enabled()) {
> > -        (*cpu_fprintf)(f, "x86 %16s\n", "[host]");
> > -    }
> > +    (*cpu_fprintf)(f, "x86 %16s  %-48s\n", "host",
> > +                   "KVM processor with all supported host features");
> > +
> that would make 'host' visible to users even if QEMU compiled without KVM
> support. No big harm, but autotest could get confused when it gets 'host' CPU
> but QEMU doesn't run because it's not really supported.

Then we have to fix the autotest test code to not try it without KVM.
:-)

Help output is not a probing mechanism (although we often misuse it as
if it were), and I expect help output to be static and not depend on any
subsystem initialization.

For example: an user without permission to open /dev/kvm should be still
able to see help text explaining that "-cpu host" is available when KVM
is enabled and working.


> 
> >      (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
> > -    listflags(buf, sizeof(buf), (uint32_t)~0, feature_name, 1);
> > -    (*cpu_fprintf)(f, "  %s\n", buf);
> > -    listflags(buf, sizeof(buf), (uint32_t)~0, ext_feature_name, 1);
> > -    (*cpu_fprintf)(f, "  %s\n", buf);
> > -    listflags(buf, sizeof(buf), (uint32_t)~0, ext2_feature_name, 1);
> > -    (*cpu_fprintf)(f, "  %s\n", buf);
> > -    listflags(buf, sizeof(buf), (uint32_t)~0, ext3_feature_name, 1);
> > -    (*cpu_fprintf)(f, "  %s\n", buf);
> > +    for (i = 0; i < ARRAY_SIZE(feature_word_info); i++) {
> > +        FeatureWordInfo *fw = &feature_word_info[i];
> > +
> > +        listflags(buf, sizeof(buf), (uint32_t)~0, fw->feat_names, 1);
> > +        (*cpu_fprintf)(f, "  %s\n", buf);
> > +    }
> >  }
> >  
> >  CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
> > -- 
> > 1.7.3.4
> > 
> 
> 
> -- 
> Regards,
>   Igor

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]