Skip to contentSkip to conversation

Fix qemu-dm segfault when multiple HVM domains ---Was: qemu-dm segfault with multiple HVM domains?

PATCH In review Jiang, Yunhong 2 participants 2 messages Feb 27, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix qemu-dm segfault when multiple HVM domains ---Was: qemu-dm segfault with multiple HVM domains?

Hi, John
Can you try the attached patch ?

This issue can be reproduced on SMP platform, while the domain 0
is UP. The reason is, after finishing a dma request, the dma thread will trigger the interrupt and then clear the call back function. When guest get the interrupt , it will try to check the call back function, if it is set, then it will trigger a dma request again. So if the checking for the callbackfunction happens between trigger interrupt and clear callback function on dma thread, it will cause NULL function calling. After with domain 0 UP and smp platform, this situation can be reproduced easily.

Thanks
Yunhong Jiang

This patch fix this issue by placing the interupt request in the end of dma thread.

Quoted 55 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of John Clemens
Sent: Thursday, February 23, 2006 6:12 AM
To: Li, Xin B
Cc: [email protected]
Subject: RE: [Xen-devel] qemu-dm segfault with multiple HVM domains?

Thanks, glad to know I'm not the only one seeing this... I've opened bug 542.

http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=542

john.c

- --
John Clemens [email protected]

Quoted 15 lines · Xin B
Quoted 9 lines

Just verifying that with cs 8932 I still see this problem. I'm able to
start multiple windows domains, but either immediately or over time all
but one qemu-dm processes segfaults. This only appears to be a problem
when I start multiple windows domains, a single domain seems to work fine.

Quoted 5 lines

qemu-dm[4961]: segfault at 0000000000000000 rip 0000000000000000 rsp 0000000040800198 error 14
qemu-dm[4963]: segfault at 0000000000000000 rip 0000000000000000 rsp 0000000040800198 error 14

Quoted 17 lines

Thanks, I ever met this issue too, but did not pay much attention to this :-(
Can you pls fire a bug?
-Xin

Quoted 11 lines

john.c

- --
John Clemens [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

# HG changeset patch
# User [email protected]
# Node ID ea0aa829ceabf80c3a9c7ac12acd7492e326f7a9 # Parent 175ad739d8bc42a32fc293bc38057823038a0cc4 fix the multi vmx domain issue

tools/ioemu/hw/ide.c +13 -12
diff -r 175ad739d8bc -r ea0aa829ceab tools/ioemu/hw/ide.c
@@ -669,9 +669,6 @@
     }
     if (s->io_buffer_index >= s->io_buffer_size && s->nsector == 0) {
         s->status = READY_STAT | SEEK_STAT;
-        s->bmdma->status &= ~BM_STATUS_DMAING;
-        s->bmdma->status |= BM_STATUS_INT;
-        ide_set_irq(s);
 #ifdef DEBUG_IDE_ATAPI
         printf("dma status=0x%x\n", s->status);
 #endif
@@ -738,9 +735,6 @@
             if (n == 0) {
                 /* end of transfer */
                 s->status = READY_STAT | SEEK_STAT;
-                s->bmdma->status &= ~BM_STATUS_DMAING;
-                s->bmdma->status |= BM_STATUS_INT;
-                ide_set_irq(s);
                 return 0;
             }
             if (n > MAX_MULT_SECTORS)
@@ -987,9 +981,6 @@
     if (s->packet_transfer_size <= 0) {
         s->status = READY_STAT;
         s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
-        s->bmdma->status &= ~BM_STATUS_DMAING;
-        s->bmdma->status |= BM_STATUS_INT;
-        ide_set_irq(s);
 #ifdef DEBUG_IDE_ATAPI
         printf("dma status=0x%x\n", s->status);
 #endif
@@ -2025,6 +2016,17 @@
     }
 }
 
+static void ide_dma_finish(BMDMAState *bm)
+{
+    IDEState *s = bm->ide_if;
+
+    bm->status &= ~BM_STATUS_DMAING;
+    bm->status |= BM_STATUS_INT;
+    bm->dma_cb = NULL;
+    bm->ide_if = NULL;
+    ide_set_irq(s);
+}
+
 /* XXX: full callback usage to prepare non blocking I/Os support -
    error handling */
 #ifdef DMA_MULTI_THREAD
@@ -2070,9 +2072,8 @@
         cur_addr += 8;
     }
     /* end of transfer */
- the_end:
-    bm->dma_cb = NULL;
-    bm->ide_if = NULL;
+the_end:
+    ide_dma_finish(bm);
 }
 
 static void ide_dma_start(IDEState *s, IDEDMAFunc *dma_cb)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Re: [PATCH] Fix qemu-dm segfault when multiple HVM domains

So far, so good.. This patch seems to fix things for me.. I have 4 domains running right now, 2 mostly idle, one running an 'ls -R /' loop in cygwin, and the fourth trudging through a chkdsk so it too is hitting the disk hard. Domains have been up for about an hour now without any problems, which is a lot longer than before.

Please check it in when you can, and thanks.
john.c

- --
John Clemens [email protected]

Quoted 80 lines · Yunhong

Hi, John
Can you try the attached patch ?

This issue can be reproduced on SMP platform, while the domain 0
is UP. The reason is, after finishing a dma request, the dma thread will trigger the interrupt and then clear the call back function. When guest get the interrupt , it will try to check the call back function, if it is set, then it will trigger a dma request again. So if the checking for the callbackfunction happens between trigger interrupt and clear callback function on dma thread, it will cause NULL function calling. After with domain 0 UP and smp platform, this situation can be reproduced easily.

Thanks
Yunhong Jiang

This patch fix this issue by placing the interupt request in the end of dma thread.

Quoted 60 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of John Clemens
Sent: Thursday, February 23, 2006 6:12 AM
To: Li, Xin B
Cc: [email protected]
Subject: RE: [Xen-devel] qemu-dm segfault with multiple HVM domains?

Thanks, glad to know I'm not the only one seeing this... I've opened bug 542.

http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=542

john.c

- --
John Clemens [email protected]

Quoted 15 lines · Xin B
Quoted 9 lines

Just verifying that with cs 8932 I still see this problem. I'm able to
start multiple windows domains, but either immediately or over time all
but one qemu-dm processes segfaults. This only appears to be a problem
when I start multiple windows domains, a single domain seems to work fine.

Quoted 5 lines

qemu-dm[4961]: segfault at 0000000000000000 rip 0000000000000000 rsp 0000000040800198 error 14
qemu-dm[4963]: segfault at 0000000000000000 rip 0000000000000000 rsp 0000000040800198 error 14

Quoted 17 lines

Thanks, I ever met this issue too, but did not pay much attention to this :-(
Can you pls fire a bug?
-Xin

Quoted 11 lines

john.c

- --
John Clemens [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel