[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Fix qemu IDE interrupt lost issue


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Yu, Ke" <ke.yu@xxxxxxxxx>
  • Date: Tue, 29 Nov 2005 11:24:38 +0800
  • Delivery-date: Tue, 29 Nov 2005 03:24:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcX0jZ8wKntC7m0rQIG5qs38BU9ADAABb0Tg
  • Thread-topic: [PATCH] Fix qemu IDE interrupt lost issue

Fix a racing condition in multi-thread qemu dma, which cause guest ide
interrupt lost.

Signed-off-by: Ke Yu <ke.yu@xxxxxxxxx>

# HG changeset patch
# User ke.yu@xxxxxxxxx
# Node ID 2d698a2fd63b609e782285cf30e2b29f5cfc8dd3
# Parent  243265ade4045314ee4170436cc704afafda54cf

This patch fix a racing condition for multi-thread qemu dma.

phenomena: vmx guest linux show warning "dma interrupt lost" and dma
become very slow

root cause: In the time between set ide irq and set dma status, if guest
receive the irq and query the status, it will find the status is not
ready and therefore treat it as pseudo interrupt. Change the order of
set irq and set dma status will fix this issue.

Signoff-by Yu,Ke <ke.yu@xxxxxxxxx>

diff -r 243265ade404 -r 2d698a2fd63b tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c      Mon Nov 28 17:22:02 2005 +0000
+++ b/tools/ioemu/hw/ide.c      Tue Nov 29 10:12:17 2005 +0800
@@ -669,6 +669,8 @@
     }
     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);
@@ -736,6 +738,8 @@
             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;
             }
@@ -983,6 +987,8 @@
     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);
@@ -2065,8 +2071,6 @@
     }
     /* end of transfer */
  the_end:
-    bm->status &= ~BM_STATUS_DMAING;
-    bm->status |= BM_STATUS_INT;
     bm->dma_cb = NULL;
     bm->ide_if = NULL;
 }

Attachment: ide_interrupt.patch
Description: ide_interrupt.patch

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.