* [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04
@ 2014-09-04 17:20 Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field Andreas Färber
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Andreas Färber @ 2014-09-04 17:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Andreas Färber, Eduardo Habkost
Hello Peter,
This is my QOM CPU patch queue. Please pull.
Regards,
Andreas
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>
The following changes since commit 01eb313907dda97313b8fea62e5632fca64f069c:
Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-09-03' into staging (2014-09-04 13:33:53 +0100)
are available in the git repository at:
git://github.com/afaerber/qemu-cpu.git tags/qom-cpu-for-peter
for you to fetch changes up to 295efacb5eaae69f0b69d91bb7e9f7b3ead9ca3e:
target-i386: Reject invalid CPU feature names on the command-line (2014-09-04 19:06:19 +0200)
----------------------------------------------------------------
X86CPU
* Fix -cpu *,migratable=foo
* Error out on unknown -cpu *,+foo,-bar
----------------------------------------------------------------
Eduardo Habkost (2):
target-i386: Support migratable=no properly
target-i386: Reject invalid CPU feature names on the command-line
Pavel Dovgaluk (1):
exec: Save CPUState::exception_index field
exec.c | 35 +++++++++++++++++++++++++++++++++++
target-i386/cpu-qom.h | 1 +
target-i386/cpu.c | 32 ++++++++++++++++++++------------
3 files changed, 56 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field
2014-09-04 17:20 [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Andreas Färber
@ 2014-09-04 17:20 ` Andreas Färber
2014-09-04 22:50 ` Peter Maydell
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 2/3] target-i386: Support migratable=no properly Andreas Färber
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2014-09-04 17:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Andreas Färber, Pavel Dovgalyuk
From: Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
This patch adds a subsection with exception_index field to the VMState for
correct saving the CPU state.
Without this patch, simulator could miss the pending exception in the saved
virtual machine state.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
exec.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/exec.c b/exec.c
index 5122a33..7dddcc8 100644
--- a/exec.c
+++ b/exec.c
@@ -430,15 +430,50 @@ static int cpu_common_post_load(void *opaque, int version_id)
return 0;
}
+static int cpu_common_pre_load(void *opaque)
+{
+ CPUState *cpu = opaque;
+
+ cpu->exception_index = 0;
+
+ return 0;
+}
+
+static bool cpu_common_exception_index_needed(void *opaque)
+{
+ CPUState *cpu = opaque;
+
+ return cpu->exception_index != 0;
+}
+
+static const VMStateDescription vmstate_cpu_common_exception_index = {
+ .name = "cpu_common/exception_index",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_INT32(exception_index, CPUState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
const VMStateDescription vmstate_cpu_common = {
.name = "cpu_common",
.version_id = 1,
.minimum_version_id = 1,
+ .pre_load = cpu_common_pre_load,
.post_load = cpu_common_post_load,
.fields = (VMStateField[]) {
VMSTATE_UINT32(halted, CPUState),
VMSTATE_UINT32(interrupt_request, CPUState),
VMSTATE_END_OF_LIST()
+ },
+ .subsections = (VMStateSubsection[]) {
+ {
+ .vmsd = &vmstate_cpu_common_exception_index,
+ .needed = cpu_common_exception_index_needed,
+ } , {
+ /* empty */
+ }
}
};
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PULL v2 2/3] target-i386: Support migratable=no properly
2014-09-04 17:20 [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field Andreas Färber
@ 2014-09-04 17:20 ` Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line Andreas Färber
2014-09-04 18:40 ` [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Peter Maydell
3 siblings, 0 replies; 9+ messages in thread
From: Andreas Färber @ 2014-09-04 17:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Eduardo Habkost, Andreas Färber, qemu-stable
From: Eduardo Habkost <ehabkost@redhat.com>
When the "migratable" property was implemented, the behavior was tested
by changing the default on the code, but actually using the option on
the command-line (e.g. "-cpu host,migratable=false") doesn't work as
expected. This is a regression for a common use case of "-cpu host",
which is to enable features that are supported by the host CPU + kernel
before feature-specific code is added to QEMU.
Fix this by initializing the feature words for "-cpu host" on
x86_cpu_parse_featurestr(), right after parsing the CPU options.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
target-i386/cpu-qom.h | 1 +
target-i386/cpu.c | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
index 71a1b97..7755466 100644
--- a/target-i386/cpu-qom.h
+++ b/target-i386/cpu-qom.h
@@ -92,6 +92,7 @@ typedef struct X86CPU {
bool enforce_cpuid;
bool expose_kvm;
bool migratable;
+ bool host_features;
/* if true the CPUID code directly forward host cache leaves to the guest */
bool cache_info_passthrough;
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index fa811a0..60d0dd5 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1318,18 +1318,18 @@ static void host_x86_cpu_initfn(Object *obj)
X86CPU *cpu = X86_CPU(obj);
CPUX86State *env = &cpu->env;
KVMState *s = kvm_state;
- FeatureWord w;
assert(kvm_enabled());
+ /* We can't fill the features array here because we don't know yet if
+ * "migratable" is true or false.
+ */
+ cpu->host_features = true;
+
env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX);
env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX);
env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX);
- for (w = 0; w < FEATURE_WORDS; w++) {
- env->features[w] =
- x86_cpu_get_supported_feature_word(w, cpu->migratable);
- }
object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort);
}
@@ -1828,6 +1828,13 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
featurestr = strtok(NULL, ",");
}
+ if (cpu->host_features) {
+ for (w = 0; w < FEATURE_WORDS; w++) {
+ env->features[w] =
+ x86_cpu_get_supported_feature_word(w, cpu->migratable);
+ }
+ }
+
for (w = 0; w < FEATURE_WORDS; w++) {
env->features[w] |= plus_features[w];
env->features[w] &= ~minus_features[w];
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line
2014-09-04 17:20 [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 2/3] target-i386: Support migratable=no properly Andreas Färber
@ 2014-09-04 17:20 ` Andreas Färber
2014-09-04 18:17 ` Eduardo Habkost
2014-09-04 18:40 ` [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Peter Maydell
3 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2014-09-04 17:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Eduardo Habkost, Andreas Färber
From: Eduardo Habkost <ehabkost@redhat.com>
Instead of simply printing a warning, report an error when invalid CPU
options are provided on the CPU model string.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
target-i386/cpu.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 60d0dd5..88b64d8 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -592,7 +592,8 @@ static bool lookup_feature(uint32_t *pval, const char *s, const char *e,
}
static void add_flagname_to_bitmaps(const char *flagname,
- FeatureWordArray words)
+ FeatureWordArray words,
+ Error **errp)
{
FeatureWord w;
for (w = 0; w < FEATURE_WORDS; w++) {
@@ -603,7 +604,7 @@ static void add_flagname_to_bitmaps(const char *flagname,
}
}
if (w == FEATURE_WORDS) {
- fprintf(stderr, "CPU feature %s not found\n", flagname);
+ error_setg(errp, "CPU feature %s not found", flagname);
}
}
@@ -1254,6 +1255,9 @@ void x86_cpu_compat_set_features(const char *cpu_model, FeatureWord w,
}
}
+static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
+ bool migratable_only);
+
#ifdef CONFIG_KVM
static int cpu_x86_fill_model_id(char *str)
@@ -1310,9 +1314,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
dc->props = host_x86_cpu_properties;
}
-static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
- bool migratable_only);
-
static void host_x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
@@ -1761,9 +1762,9 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
while (featurestr) {
char *val;
if (featurestr[0] == '+') {
- add_flagname_to_bitmaps(featurestr + 1, plus_features);
+ add_flagname_to_bitmaps(featurestr + 1, plus_features, &local_err);
} else if (featurestr[0] == '-') {
- add_flagname_to_bitmaps(featurestr + 1, minus_features);
+ add_flagname_to_bitmaps(featurestr + 1, minus_features, &local_err);
} else if ((val = strchr(featurestr, '='))) {
*val = 0; val++;
feat2prop(featurestr);
--
1.8.4.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line Andreas Färber
@ 2014-09-04 18:17 ` Eduardo Habkost
0 siblings, 0 replies; 9+ messages in thread
From: Eduardo Habkost @ 2014-09-04 18:17 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
On Thu, Sep 04, 2014 at 07:20:13PM +0200, Andreas Färber wrote:
[...]
> +static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
> + bool migratable_only);
> +
> #ifdef CONFIG_KVM
>
> static int cpu_x86_fill_model_id(char *str)
> @@ -1310,9 +1314,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc, void *data)
> dc->props = host_x86_cpu_properties;
> }
>
> -static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w,
> - bool migratable_only);
> -
This was supposed to be squashed into patch 1/2, not this one.
(That was my fault, as I mentioned the wrong patch when I submitted the
build error fix.)
--
Eduardo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04
2014-09-04 17:20 [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Andreas Färber
` (2 preceding siblings ...)
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line Andreas Färber
@ 2014-09-04 18:40 ` Peter Maydell
2014-09-05 14:45 ` Andreas Färber
3 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2014-09-04 18:40 UTC (permalink / raw)
To: Andreas Färber; +Cc: QEMU Developers, Eduardo Habkost
On 4 September 2014 18:20, Andreas Färber <afaerber@suse.de> wrote:
> Hello Peter,
>
> This is my QOM CPU patch queue. Please pull.
>
> Regards,
> Andreas
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
>
> The following changes since commit 01eb313907dda97313b8fea62e5632fca64f069c:
>
> Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-09-03' into staging (2014-09-04 13:33:53 +0100)
>
> are available in the git repository at:
>
>
> git://github.com/afaerber/qemu-cpu.git tags/qom-cpu-for-peter
>
> for you to fetch changes up to 295efacb5eaae69f0b69d91bb7e9f7b3ead9ca3e:
>
> target-i386: Reject invalid CPU feature names on the command-line (2014-09-04 19:06:19 +0200)
Hi; I'm dropping this from my to-process queue since
Eduardo says a fixup got squashed into the wrong patch
by mistake.
thanks
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field Andreas Färber
@ 2014-09-04 22:50 ` Peter Maydell
2014-09-05 12:16 ` Andreas Färber
0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2014-09-04 22:50 UTC (permalink / raw)
To: Andreas Färber; +Cc: Paolo Bonzini, QEMU Developers, Pavel Dovgalyuk
On 4 September 2014 18:20, Andreas Färber <afaerber@suse.de> wrote:
> From: Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
>
> This patch adds a subsection with exception_index field to the VMState for
> correct saving the CPU state.
> Without this patch, simulator could miss the pending exception in the saved
> virtual machine state.
>
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
Is this patch a worthwhile candidate for stable?
-- PMM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field
2014-09-04 22:50 ` Peter Maydell
@ 2014-09-05 12:16 ` Andreas Färber
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Färber @ 2014-09-05 12:16 UTC (permalink / raw)
To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers, Pavel Dovgalyuk
Am 05.09.2014 00:50, schrieb Peter Maydell:
> On 4 September 2014 18:20, Andreas Färber <afaerber@suse.de> wrote:
>> From: Pavel Dovgaluk <Pavel.Dovgaluk@ispras.ru>
>>
>> This patch adds a subsection with exception_index field to the VMState for
>> correct saving the CPU state.
>> Without this patch, simulator could miss the pending exception in the saved
>> virtual machine state.
>>
>> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>
> Is this patch a worthwhile candidate for stable?
Well, it came up in the context of reverse execution, but it wouldn't
hurt to have it backported, I guess. It's difficult to test though...
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04
2014-09-04 18:40 ` [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Peter Maydell
@ 2014-09-05 14:45 ` Andreas Färber
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Färber @ 2014-09-05 14:45 UTC (permalink / raw)
To: Peter Maydell, Eduardo Habkost; +Cc: QEMU Developers
Am 04.09.2014 20:40, schrieb Peter Maydell:
> On 4 September 2014 18:20, Andreas Färber <afaerber@suse.de> wrote:
>> Hello Peter,
>>
>> This is my QOM CPU patch queue. Please pull.
>>
>> Regards,
>> Andreas
>>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>>
>> The following changes since commit 01eb313907dda97313b8fea62e5632fca64f069c:
>>
>> Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-09-03' into staging (2014-09-04 13:33:53 +0100)
>>
>> are available in the git repository at:
>>
>>
>> git://github.com/afaerber/qemu-cpu.git tags/qom-cpu-for-peter
>>
>> for you to fetch changes up to 295efacb5eaae69f0b69d91bb7e9f7b3ead9ca3e:
>>
>> target-i386: Reject invalid CPU feature names on the command-line (2014-09-04 19:06:19 +0200)
>
> Hi; I'm dropping this from my to-process queue since
> Eduardo says a fixup got squashed into the wrong patch
> by mistake.
Yeah, v3 is out now. Thanks to both of you for catching this. I must've
screwed up my testing as I only noticed after the final patch...
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-05 14:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 17:20 [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 1/3] exec: Save CPUState::exception_index field Andreas Färber
2014-09-04 22:50 ` Peter Maydell
2014-09-05 12:16 ` Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 2/3] target-i386: Support migratable=no properly Andreas Färber
2014-09-04 17:20 ` [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line Andreas Färber
2014-09-04 18:17 ` Eduardo Habkost
2014-09-04 18:40 ` [Qemu-devel] [PULL 0/3] QOM CPUState patch queue 2014-09-04 Peter Maydell
2014-09-05 14:45 ` Andreas Färber
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).