Fix a racing condition in multi-thread qemu dma, which cause guest ide interrupt lost. Signed-off-by: Ke Yu <ke.yu@intel.com> # HG changeset patch # User ke.yu@intel.com # 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@intel.com> 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; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel