* [PATCH] ioemu: improve DMA transfers
@ 2008-03-20 16:29 Samuel Thibault
2008-03-20 16:31 ` Samuel Thibault
0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2008-03-20 16:29 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 2930 bytes --]
Hello,
I was wondering about the not so good performances of the IDE emulation
even in the case of DMA transfers. It happens that qemu is actually
limiting the qemu / dom0 kernel reads/writes to 8KB at a time, which is
not very big (the SCSI emulation uses 64KB). Increasing it provides a
very good improvement, as the attached graph shows. On my test machine,
55MB/s can be achieved with a buffer of 128KB, to be compared to the
native 65MB/s. The stubdomain approach is limited to 44KB because of
the limit in the PV blk interface.
Samuel
ioemu: improve DMA transfers
by increasing the size of DMA buffers.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
diff -r dc1fe3bd1393 tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c Thu Mar 20 10:53:10 2008 +0000
+++ b/tools/ioemu/hw/ide.c Thu Mar 20 16:11:03 2008 +0000
@@ -189,6 +189,15 @@
/* set to 1 set disable mult support */
#define MAX_MULT_SECTORS 16
+#ifdef CONFIG_STUBDOM
+#include <xen/io/blkif.h>
+#define IDE_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
+#else
+#define IDE_DMA_BUF_SIZE 131072
+#endif
+#if (IDE_DMA_BUF_SIZE < MAX_MULT_SECTORS * 512)
+#error "IDE_DMA_BUF_SIZE must be bigger or equal to MAX_MULT_SECTORS * 512"
+#endif
/* ATAPI defines */
@@ -932,8 +941,8 @@
/* launch next transfer */
n = s->nsector;
- if (n > MAX_MULT_SECTORS)
- n = MAX_MULT_SECTORS;
+ if (n > IDE_DMA_BUF_SIZE)
+ n = IDE_DMA_BUF_SIZE;
s->io_buffer_index = 0;
s->io_buffer_size = n * 512;
#ifdef DEBUG_AIO
@@ -1041,8 +1050,8 @@
/* launch next transfer */
n = s->nsector;
- if (n > MAX_MULT_SECTORS)
- n = MAX_MULT_SECTORS;
+ if (n > IDE_DMA_BUF_SIZE)
+ n = IDE_DMA_BUF_SIZE;
s->io_buffer_index = 0;
s->io_buffer_size = n * 512;
@@ -1336,8 +1345,8 @@
data_offset = 16;
} else {
n = s->packet_transfer_size >> 11;
- if (n > (MAX_MULT_SECTORS / 4))
- n = (MAX_MULT_SECTORS / 4);
+ if (n > (IDE_DMA_BUF_SIZE / 4))
+ n = (IDE_DMA_BUF_SIZE / 4);
s->io_buffer_size = n * 2048;
data_offset = 0;
}
@@ -2306,7 +2315,7 @@
for(i = 0; i < 2; i++) {
s = ide_state + i;
- s->io_buffer = qemu_memalign(getpagesize(), MAX_MULT_SECTORS*512 + 4);
+ s->io_buffer = qemu_memalign(getpagesize(), IDE_DMA_BUF_SIZE*512 + 4);
if (i == 0)
s->bs = hd0;
else
--- a/tools/ioemu/hw/scsi-disk.c Thu Mar 20 10:53:10 2008 +0000
+++ b/tools/ioemu/hw/scsi-disk.c Thu Mar 20 16:11:03 2008 +0000
@@ -34,9 +34,10 @@
#define SENSE_ILLEGAL_REQUEST 5
#ifdef CONFIG_STUBDOM
-#define SCSI_DMA_BUF_SIZE 32768
+#include <xen/io/blkif.h>
+#define SCSI_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
#else
-#define SCSI_DMA_BUF_SIZE 65536
+#define SCSI_DMA_BUF_SIZE 131072
#endif
typedef struct SCSIRequest {
[-- Attachment #2: hda-perfs.eps --]
[-- Type: application/postscript, Size: 20188 bytes --]
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ioemu: improve DMA transfers
2008-03-20 16:29 [PATCH] ioemu: improve DMA transfers Samuel Thibault
@ 2008-03-20 16:31 ` Samuel Thibault
2008-03-20 16:39 ` Samuel Thibault
0 siblings, 1 reply; 3+ messages in thread
From: Samuel Thibault @ 2008-03-20 16:31 UTC (permalink / raw)
To: xen-devel
Samuel Thibault, le Thu 20 Mar 2008 16:29:15 +0000, a écrit :
> ioemu: improve DMA transfers
> by increasing the size of DMA buffers.
Ooops, don't apply it, my late conversion from sectors to bytes went
wrong (but the graph it correct).
Samuel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ioemu: improve DMA transfers
2008-03-20 16:31 ` Samuel Thibault
@ 2008-03-20 16:39 ` Samuel Thibault
0 siblings, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2008-03-20 16:39 UTC (permalink / raw)
To: xen-devel
Samuel Thibault, le Thu 20 Mar 2008 16:31:45 +0000, a écrit :
> Ooops, don't apply it, my late conversion from sectors to bytes went
> wrong (but the graph it correct).
This one is correct
Samuel
ioemu: improve DMA transfers
by increasing the size of DMA buffers.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
diff -r dc1fe3bd1393 tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c Thu Mar 20 10:53:10 2008 +0000
+++ b/tools/ioemu/hw/ide.c Thu Mar 20 16:33:05 2008 +0000
@@ -189,6 +189,15 @@
/* set to 1 set disable mult support */
#define MAX_MULT_SECTORS 16
+#ifdef CONFIG_STUBDOM
+#include <xen/io/blkif.h>
+#define IDE_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
+#else
+#define IDE_DMA_BUF_SIZE 131072
+#endif
+#if (IDE_DMA_BUF_SIZE < MAX_MULT_SECTORS * 512)
+#error "IDE_DMA_BUF_SIZE must be bigger or equal to MAX_MULT_SECTORS * 512"
+#endif
/* ATAPI defines */
@@ -932,8 +941,8 @@
/* launch next transfer */
n = s->nsector;
- if (n > MAX_MULT_SECTORS)
- n = MAX_MULT_SECTORS;
+ if (n > IDE_DMA_BUF_SIZE / 512)
+ n = IDE_DMA_BUF_SIZE / 512;
s->io_buffer_index = 0;
s->io_buffer_size = n * 512;
#ifdef DEBUG_AIO
@@ -1041,8 +1050,8 @@
/* launch next transfer */
n = s->nsector;
- if (n > MAX_MULT_SECTORS)
- n = MAX_MULT_SECTORS;
+ if (n > IDE_DMA_BUF_SIZE / 512)
+ n = IDE_DMA_BUF_SIZE / 512;
s->io_buffer_index = 0;
s->io_buffer_size = n * 512;
@@ -1336,8 +1345,8 @@
data_offset = 16;
} else {
n = s->packet_transfer_size >> 11;
- if (n > (MAX_MULT_SECTORS / 4))
- n = (MAX_MULT_SECTORS / 4);
+ if (n > (IDE_DMA_BUF_SIZE / 2048))
+ n = (IDE_DMA_BUF_SIZE / 2048);
s->io_buffer_size = n * 2048;
data_offset = 0;
}
@@ -2306,7 +2315,7 @@
for(i = 0; i < 2; i++) {
s = ide_state + i;
- s->io_buffer = qemu_memalign(getpagesize(), MAX_MULT_SECTORS*512 + 4);
+ s->io_buffer = qemu_memalign(getpagesize(), IDE_DMA_BUF_SIZE + 4);
if (i == 0)
s->bs = hd0;
else
--- a/tools/ioemu/hw/scsi-disk.c Thu Mar 20 10:53:10 2008 +0000
+++ b/tools/ioemu/hw/scsi-disk.c Thu Mar 20 16:33:05 2008 +0000
@@ -34,9 +34,10 @@
#define SENSE_ILLEGAL_REQUEST 5
#ifdef CONFIG_STUBDOM
-#define SCSI_DMA_BUF_SIZE 32768
+#include <xen/io/blkif.h>
+#define SCSI_DMA_BUF_SIZE (BLKIF_MAX_SEGMENTS_PER_REQUEST * TARGET_PAGE_SIZE)
#else
-#define SCSI_DMA_BUF_SIZE 65536
+#define SCSI_DMA_BUF_SIZE 131072
#endif
typedef struct SCSIRequest {
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-20 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20 16:29 [PATCH] ioemu: improve DMA transfers Samuel Thibault
2008-03-20 16:31 ` Samuel Thibault
2008-03-20 16:39 ` Samuel Thibault
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.