qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc: push setting default cpu_model down a level
@ 2010-06-01 23:03 Alex Williamson
  2010-06-02 16:46 ` [Qemu-devel] " Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2010-06-01 23:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, kvm

Not that CPU hotplug currently works, but if you make the mistake of
trying it on a VM started without specifying a -cpu value, you hit
a segfault from trying to strdup(NULL) in cpu_x86_find_by_name().

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 hw/pc.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 9b85c42..a79586c 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -771,6 +771,14 @@ static CPUState *pc_new_cpu(const char *cpu_model)
 {
     CPUState *env;
 
+    if (cpu_model == NULL) {
+#ifdef TARGET_X86_64
+        cpu_model = "qemu64";
+#else
+        cpu_model = "qemu32";
+#endif
+    }
+
     env = cpu_init(cpu_model);
     if (!env) {
         fprintf(stderr, "Unable to find x86 CPU definition\n");
@@ -791,14 +799,6 @@ void pc_cpus_init(const char *cpu_model)
     int i;
 
     /* init CPUs */
-    if (cpu_model == NULL) {
-#ifdef TARGET_X86_64
-        cpu_model = "qemu64";
-#else
-        cpu_model = "qemu32";
-#endif
-    }
-
     for(i = 0; i < smp_cpus; i++) {
         pc_new_cpu(cpu_model);
     }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] pc: push setting default cpu_model down a level
  2010-06-01 23:03 [Qemu-devel] [PATCH] pc: push setting default cpu_model down a level Alex Williamson
@ 2010-06-02 16:46 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2010-06-02 16:46 UTC (permalink / raw)
  To: Alex Williamson; +Cc: qemu-devel, kvm

On Tue, Jun 01, 2010 at 05:03:00PM -0600, Alex Williamson wrote:
> Not that CPU hotplug currently works, but if you make the mistake of
> trying it on a VM started without specifying a -cpu value, you hit
> a segfault from trying to strdup(NULL) in cpu_x86_find_by_name().
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-02 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-01 23:03 [Qemu-devel] [PATCH] pc: push setting default cpu_model down a level Alex Williamson
2010-06-02 16:46 ` [Qemu-devel] " Marcelo Tosatti

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).