* [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type
@ 2017-10-10 12:34 Igor Mammedov
2017-10-10 12:41 ` Paolo Bonzini
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Igor Mammedov @ 2017-10-10 12:34 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, groug
heterogeneous cpus are not supported and hotplugging different
cpu model crashes QEMU:
qemu-system-x86_64 -cpu qemu64 -smp 1,maxcpus=2
(qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
(qemu) info cpus
error: failed to get MSR 0x38d
qemu-system-x86_64: target/i386/kvm.c:2121: kvm_get_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
Aborted (core dumped)
Gracefully fail hotplug process in case of user mistake.
Reported-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
hw/i386/pc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 05985d4..8e307f7 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1876,8 +1876,15 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
CPUArchId *cpu_slot;
X86CPUTopoInfo topo;
X86CPU *cpu = X86_CPU(dev);
+ MachineState *ms = MACHINE(hotplug_dev);
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ if(!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
+ error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
+ ms->cpu_type);
+ return;
+ }
+
/* if APIC ID is not set, set it based on socket/core/thread properties */
if (cpu->apic_id == UNASSIGNED_APIC_ID) {
int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type
2017-10-10 12:34 [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type Igor Mammedov
@ 2017-10-10 12:41 ` Paolo Bonzini
2017-10-10 14:52 ` no-reply
2017-10-10 15:17 ` [Qemu-devel] [PATCH v2] " Igor Mammedov
2 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-10-10 12:41 UTC (permalink / raw)
To: Igor Mammedov, qemu-devel; +Cc: mst, rth, ehabkost, groug
On 10/10/2017 14:34, Igor Mammedov wrote:
> heterogeneous cpus are not supported and hotplugging different
> cpu model crashes QEMU:
>
> qemu-system-x86_64 -cpu qemu64 -smp 1,maxcpus=2
> (qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
> (qemu) info cpus
> error: failed to get MSR 0x38d
> qemu-system-x86_64: target/i386/kvm.c:2121: kvm_get_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
> Aborted (core dumped)
>
> Gracefully fail hotplug process in case of user mistake.
>
> Reported-by: Greg Kurz <groug@kaod.org>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/i386/pc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 05985d4..8e307f7 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1876,8 +1876,15 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
> CPUArchId *cpu_slot;
> X86CPUTopoInfo topo;
> X86CPU *cpu = X86_CPU(dev);
> + MachineState *ms = MACHINE(hotplug_dev);
> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>
> + if(!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
> + error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
> + ms->cpu_type);
> + return;
> + }
> +
> /* if APIC ID is not set, set it based on socket/core/thread properties */
> if (cpu->apic_id == UNASSIGNED_APIC_ID) {
> int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
>
Queued, thanks!
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type
2017-10-10 12:34 [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type Igor Mammedov
2017-10-10 12:41 ` Paolo Bonzini
@ 2017-10-10 14:52 ` no-reply
2017-10-10 15:17 ` [Qemu-devel] [PATCH v2] " Igor Mammedov
2 siblings, 0 replies; 6+ messages in thread
From: no-reply @ 2017-10-10 14:52 UTC (permalink / raw)
To: imammedo; +Cc: famz, qemu-devel, pbonzini, groug, rth, ehabkost, mst
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 1507638879-200718-1-git-send-email-imammedo@redhat.com
Subject: [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/20171010102418.13487-1-anthony.perard@citrix.com -> patchew/20171010102418.13487-1-anthony.perard@citrix.com
Switched to a new branch 'test'
606d6b2956 pc: make sure that plugged CPUs are of the same type
=== OUTPUT BEGIN ===
Checking PATCH 1/1: pc: make sure that plugged CPUs are of the same type...
ERROR: space required before the open parenthesis '('
#33: FILE: hw/i386/pc.c:1882:
+ if(!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
total: 1 errors, 0 warnings, 15 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2] pc: make sure that plugged CPUs are of the same type
2017-10-10 12:34 [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type Igor Mammedov
2017-10-10 12:41 ` Paolo Bonzini
2017-10-10 14:52 ` no-reply
@ 2017-10-10 15:17 ` Igor Mammedov
2017-10-10 15:22 ` Michael S. Tsirkin
2017-10-10 16:52 ` Greg Kurz
2 siblings, 2 replies; 6+ messages in thread
From: Igor Mammedov @ 2017-10-10 15:17 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, pbonzini, rth, ehabkost, groug
heterogeneous cpus are not supported and hotplugging different
cpu model crashes QEMU:
qemu-system-x86_64 -cpu qemu64 -smp 1,maxcpus=2
(qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
(qemu) info cpus
error: failed to get MSR 0x38d
qemu-system-x86_64: target/i386/kvm.c:2121: kvm_get_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
Aborted (core dumped)
Gracefully fail hotplug process in case of user mistake.
Reported-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v2:
fix checkpatch error
---
hw/i386/pc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 05985d4..8e307f7 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1876,8 +1876,15 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
CPUArchId *cpu_slot;
X86CPUTopoInfo topo;
X86CPU *cpu = X86_CPU(dev);
+ MachineState *ms = MACHINE(hotplug_dev);
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ if (!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
+ error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
+ ms->cpu_type);
+ return;
+ }
+
/* if APIC ID is not set, set it based on socket/core/thread properties */
if (cpu->apic_id == UNASSIGNED_APIC_ID) {
int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pc: make sure that plugged CPUs are of the same type
2017-10-10 15:17 ` [Qemu-devel] [PATCH v2] " Igor Mammedov
@ 2017-10-10 15:22 ` Michael S. Tsirkin
2017-10-10 16:52 ` Greg Kurz
1 sibling, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2017-10-10 15:22 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-devel, pbonzini, rth, ehabkost, groug
On Tue, Oct 10, 2017 at 05:17:40PM +0200, Igor Mammedov wrote:
> heterogeneous cpus are not supported and hotplugging different
> cpu model crashes QEMU:
>
> qemu-system-x86_64 -cpu qemu64 -smp 1,maxcpus=2
> (qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
> (qemu) info cpus
> error: failed to get MSR 0x38d
> qemu-system-x86_64: target/i386/kvm.c:2121: kvm_get_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
> Aborted (core dumped)
>
> Gracefully fail hotplug process in case of user mistake.
>
> Reported-by: Greg Kurz <groug@kaod.org>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
IIUC Paolo's merging this.
> ---
> v2:
> fix checkpatch error
> ---
> hw/i386/pc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 05985d4..8e307f7 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1876,8 +1876,15 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
> CPUArchId *cpu_slot;
> X86CPUTopoInfo topo;
> X86CPU *cpu = X86_CPU(dev);
> + MachineState *ms = MACHINE(hotplug_dev);
> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>
> + if (!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
> + error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
> + ms->cpu_type);
> + return;
> + }
> +
> /* if APIC ID is not set, set it based on socket/core/thread properties */
> if (cpu->apic_id == UNASSIGNED_APIC_ID) {
> int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
> --
> 2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pc: make sure that plugged CPUs are of the same type
2017-10-10 15:17 ` [Qemu-devel] [PATCH v2] " Igor Mammedov
2017-10-10 15:22 ` Michael S. Tsirkin
@ 2017-10-10 16:52 ` Greg Kurz
1 sibling, 0 replies; 6+ messages in thread
From: Greg Kurz @ 2017-10-10 16:52 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-devel, mst, pbonzini, rth, ehabkost
On Tue, 10 Oct 2017 17:17:40 +0200
Igor Mammedov <imammedo@redhat.com> wrote:
> heterogeneous cpus are not supported and hotplugging different
> cpu model crashes QEMU:
>
> qemu-system-x86_64 -cpu qemu64 -smp 1,maxcpus=2
> (qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
> (qemu) info cpus
> error: failed to get MSR 0x38d
> qemu-system-x86_64: target/i386/kvm.c:2121: kvm_get_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
> Aborted (core dumped)
>
> Gracefully fail hotplug process in case of user mistake.
>
> Reported-by: Greg Kurz <groug@kaod.org>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v2:
> fix checkpatch error
> ---
(qemu) device_add host-x86_64-cpu,socket-id=1,core-id=0,thread-id=0,id=foo
Invalid CPU type, expected cpu type: 'qemu64-x86_64-cpu'
Tested-by: Greg Kurz <groug@kaod.org>
> hw/i386/pc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 05985d4..8e307f7 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1876,8 +1876,15 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
> CPUArchId *cpu_slot;
> X86CPUTopoInfo topo;
> X86CPU *cpu = X86_CPU(dev);
> + MachineState *ms = MACHINE(hotplug_dev);
> PCMachineState *pcms = PC_MACHINE(hotplug_dev);
>
> + if (!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
> + error_setg(errp, "Invalid CPU type, expected cpu type: '%s'",
> + ms->cpu_type);
> + return;
> + }
> +
> /* if APIC ID is not set, set it based on socket/core/thread properties */
> if (cpu->apic_id == UNASSIGNED_APIC_ID) {
> int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-10 16:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 12:34 [Qemu-devel] [PATCH] pc: make sure that plugged CPUs are of the same type Igor Mammedov
2017-10-10 12:41 ` Paolo Bonzini
2017-10-10 14:52 ` no-reply
2017-10-10 15:17 ` [Qemu-devel] [PATCH v2] " Igor Mammedov
2017-10-10 15:22 ` Michael S. Tsirkin
2017-10-10 16:52 ` Greg Kurz
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.