All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@suse.de>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] qemu-xen: Fix PV segfault
Date: Wed, 02 Jul 2008 13:30:53 +0200	[thread overview]
Message-ID: <486B66ED.4060207@suse.de> (raw)
In-Reply-To: <18539.22171.11790.948574@mariner.uk.xensource.com>

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

Ian Jackson schrieb:
> Kevin Wolf writes ("Re: [PATCH] qemu-xen: Fix PV segfault"):
>> Ian Jackson schrieb:
>>> Kevin Wolf writes ("[PATCH] qemu-xen: Fix PV segfault"):
>>>> Don't access cur_cpu with CONFIG_DM, for PV machines it is NULL.
>>> I'm not sure I understand the execution context here properly.  Is
>>> this for blktap ?  It would be better to make cur_cpu be set to some
>>> sensible value.
>> No, this is completely independent of blktap. Currently, PV machines
>> just don't have a virtual cpu in qemu - in contrary to FV machines which
>> call a complete pc_machine.init() during their initialization.
> 
> Evidently this is a configuration I haven't tested.  My PV machines
> don't use a qemu-dm at all.

AFAIK, you automatically get qemu-dm as soon as you use VNC. So this is
probably the most common use case.

While I'm at it: There's another problem with qemu-xen, I can establish
a VNC connection only if I was connected via xm console before. Maybe I
can take a look at this later this week.

> I would very much prefer an answer which didn't make any additional
> changes to vl.c (or other code shared with upstream).  If such changes
> are necessary they should be textually small.  This will make keeping
> us up to date with qemu upstream much easier.

Yes, I couldn't agree more.

Attached is a new version of the patch which creates a dummy CPU for PV
machines. Now it touches no upstream code any more.

Kevin

[-- Attachment #2: fix-pv-segfault.patch --]
[-- Type: text/x-patch, Size: 1456 bytes --]

>From acd73e1af736e0b0e6fe4af234f828b6a572a841 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@suse.de>
Date: Wed, 2 Jul 2008 13:23:49 +0200
Subject: [PATCH] qemu-xen: Fix PV segfault

Create a dummy CPU during PV machine initialization. This avoids NULL pointer accesses.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
---
 hw/xen_machine_pv.c |    5 ++++-
 i386-dm/helper2.c   |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index 0fec0aa..e51addb 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -45,13 +45,16 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
 {
     struct xenfb *xenfb;
     extern int domid;
-
+    CPUState *env;
 
 #ifndef CONFIG_STUBDOM
     /* Initialize tapdisk client */
     init_blktap();
 #endif
 
+    /* Initialize a dummy CPU */
+    env = cpu_init(NULL);
+
     /* Connect to text console */
     if (serial_hds[0]) {
         if (xencons_init(domid, serial_hds[0]) < 0) {
diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index 44bed2b..6437c37 100644
--- a/i386-dm/helper2.c
+++ b/i386-dm/helper2.c
@@ -112,6 +112,10 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
         return NULL;
     cpu_exec_init(env);
 
+    /* There is no shared_page for PV, we're done now */
+    if (shared_page == NULL)
+        return env;
+
     /* init various static tables */
     if (!inited) {
         inited = 1;
-- 
1.5.4.5


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

      reply	other threads:[~2008-07-02 11:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 18:37 [PATCH] qemu-xen: Fix PV segfault Kevin Wolf
2008-07-01 11:42 ` Kevin Wolf
2008-07-01 17:31 ` Ian Jackson
2008-07-02  7:54   ` Kevin Wolf
2008-07-02  8:38     ` Gerd Hoffmann
2008-07-02 14:19       ` John Levon
2008-07-02 14:32         ` Ian Jackson
2008-07-02 14:35           ` Stefan de Konink
2008-07-02 14:38           ` John Levon
2008-07-02 14:50             ` Ian Jackson
2008-07-02 14:55               ` Kevin Wolf
2008-07-02 14:59               ` Stefan de Konink
2008-07-02 15:14                 ` Ian Jackson
2008-07-02 15:28                   ` Stefan de Konink
2008-07-02 15:39                     ` Daniel P. Berrange
2008-07-02 16:00                   ` John Levon
2008-07-02 17:14                     ` Ian Jackson
2008-07-02 15:00               ` Daniel P. Berrange
2008-07-02 15:05               ` Daniel P. Berrange
2008-07-02 15:08               ` John Levon
2008-07-02 14:46           ` Kevin Wolf
2008-07-02 14:52           ` Daniel P. Berrange
2008-07-02 15:59           ` Gerd Hoffmann
2008-07-03  8:01         ` Gerd Hoffmann
2008-07-03  8:16           ` Kevin Wolf
2008-07-03 10:55             ` Gerd Hoffmann
2008-07-03 11:05               ` Kevin Wolf
2008-07-03 11:17                 ` Kevin Wolf
2008-07-03 11:18                 ` Gerd Hoffmann
2008-07-03  9:32           ` Ian Jackson
2008-07-03 11:13             ` Gerd Hoffmann
2008-07-02 10:21     ` Ian Jackson
2008-07-02 11:30       ` Kevin Wolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486B66ED.4060207@suse.de \
    --to=kwolf@suse.de \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.