qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] target-i386: add a list of enforceable CPU mode


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH] target-i386: add a list of enforceable CPU models to the help output
Date: Wed, 26 Aug 2015 16:12:04 -0300
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Aug 26, 2015 at 08:38:35PM +0200, Peter Lieven wrote:
> Am 26.08.2015 um 17:54 schrieb Eduardo Habkost:
> > On Mon, Aug 24, 2015 at 11:17:04AM +0200, Peter Lieven wrote:
> >> this patch adds a probe that lists all enforceable and migrateable
> >> CPU models to the -cpu help output. The idea is to know a priory
> >> which CPU modules can be exposed to the user without loosing any
> >> feature flags.
> >>
> >> Signed-off-by: Peter Lieven <address@hidden>
> > [...]
> >> +/*
> >> + * Check if the CPU Definition is enforcable on the current host CPU
> >> + * and contains no unmigratable flags.
> >> + *
> >> + * Returns: true if the CPU can be enforced and migrated.
> >> + */
> >> +static bool x86_cpu_enforce_and_migratable(X86CPUDefinition *def)
> >> +{
> >> +    int i;
> >> +    for (i = 0; i < ARRAY_SIZE(feature_word_info); i++) {
> >> +        FeatureWordInfo *fw = &feature_word_info[i];
> >> +        uint32_t eax, ebx, ecx, edx, host;
> >> +        host_cpuid(fw->cpuid_eax, 0, &eax, &ebx, &ecx, &edx);
> > This isn't how you check if the CPU model can run in "enforce" mode.
> > Please read x86_cpu_filter_features().
> 
> I did, but will do again. The problem is that x86_cpu_filter_features
> requires enabled KVM to run.

You don't have any choice: you need to initialize KVM to be able to
report correct results.

See this:
http://article.gmane.org/gmane.comp.emulators.kvm.devel/133288
and the rest of the "s390x cpu model implementation" threads for some
information about accel object creation, and what's needed.

> I believed internally it does something
> similar to what I do here.

It doesn't. Please read the code.

> 
> >
> > Also, you can't tell if a CPU model is runnable in enforce mode unless
> > you know what's the accelerator being used (see
> > x86_cpu_filter_features()). How do you suggest we show
> > accelerator-specific information in help output?
> >
> 
> The subject was missing that the goal was to list enforceable models
> in KVM mode. The output of the help page mentions this.

There are zero mentions to KVM in x86_cpu_enforce_and_migratable(). If
the code is KVM-specific, please name functions and comment the code
accordingly.

> 
> Andreas suggested to make annotations to the list of CPU models.
> In theory it would be possible to have different annotations for different
> accelerators.

That's one possible way to implement it, but maybe there's no need to
make the code more complex for that. We can't check if the CPU model is
runnable at class_init time, anyway, and re-running the
runnability-check code in case the query is made multiple times won't be
be a problem.

-- 
Eduardo



reply via email to

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