[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 13/14] libqos/ahci: Swap memread/write with bufrea
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL v2 13/14] libqos/ahci: Swap memread/write with bufread/write |
Date: |
Tue, 12 May 2015 14:46:25 -0400 |
Where it makes sense, use the new faster primitives.
For generally small reads/writes such as for the PRDT
and FIS packets, stick with the more wasteful but
easier to debug memread/memwrite.
For ahci-test (before migration tests):
With this patch:
real 0m3.675s
user 0m2.582s
sys 0m1.718s
Without any qtest protocol improvements:
real 0m14.171s
user 0m12.072s
sys 0m12.527s
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
---
tests/ahci-test.c | 8 ++++----
tests/libqos/ahci.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 1a967c3..6e3fa81 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -874,7 +874,7 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci,
unsigned bufsize,
/* Write some indicative pattern to our buffer. */
generate_pattern(tx, bufsize, AHCI_SECTOR_SIZE);
- memwrite(ptr, tx, bufsize);
+ bufwrite(ptr, tx, bufsize);
/* Write this buffer to disk, then read it back to the DMA buffer. */
ahci_guest_io(ahci, port, write_cmd, ptr, bufsize, sector);
@@ -882,7 +882,7 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci,
unsigned bufsize,
ahci_guest_io(ahci, port, read_cmd, ptr, bufsize, sector);
/*** Read back the Data ***/
- memread(ptr, rx, bufsize);
+ bufread(ptr, rx, bufsize);
g_assert_cmphex(memcmp(tx, rx, bufsize), ==, 0);
ahci_free(ahci, ptr);
@@ -1018,7 +1018,7 @@ static void test_dma_fragmented(void)
/* Create a DMA buffer in guest memory, and write our pattern to it. */
ptr = guest_alloc(ahci->parent->alloc, bufsize);
g_assert(ptr);
- memwrite(ptr, tx, bufsize);
+ bufwrite(ptr, tx, bufsize);
cmd = ahci_command_create(CMD_WRITE_DMA);
ahci_command_adjust(cmd, 0, ptr, bufsize, 32);
@@ -1035,7 +1035,7 @@ static void test_dma_fragmented(void)
g_free(cmd);
/* Read back the guest's receive buffer into local memory */
- memread(ptr, rx, bufsize);
+ bufread(ptr, rx, bufsize);
guest_free(ahci->parent->alloc, ptr);
g_assert_cmphex(memcmp(tx, rx, bufsize), ==, 0);
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 95bfb3d..7e17bb6 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -653,13 +653,13 @@ void ahci_io(AHCIQState *ahci, uint8_t port, uint8_t
ide_cmd,
qmemset(ptr, 0x00, bufsize);
if (props->write) {
- memwrite(ptr, buffer, bufsize);
+ bufwrite(ptr, buffer, bufsize);
}
ahci_guest_io(ahci, port, ide_cmd, ptr, bufsize, sector);
if (props->read) {
- memread(ptr, buffer, bufsize);
+ bufread(ptr, buffer, bufsize);
}
ahci_free(ahci, ptr);
--
2.1.0
- [Qemu-devel] [PULL v2 01/14] libqos/ahci: Add halted command helpers, (continued)
- [Qemu-devel] [PULL v2 01/14] libqos/ahci: Add halted command helpers, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 02/14] libqos/ahci: Fix sector set method, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 04/14] ich9/ahci: Enable Migration, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 07/14] qtest/ahci: add flush migrate test, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 06/14] qtest/ahci: add migrate dma test, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 12/14] qtest: add memset to qtest protocol, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 05/14] qtest/ahci: Add migration test, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 03/14] libqos: Add migration helpers, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 14/14] qtest: pre-buffer hex nibs, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 09/14] qtest/ahci: add migrate halted dma test, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 13/14] libqos/ahci: Swap memread/write with bufread/write,
John Snow <=
- [Qemu-devel] [PULL v2 10/14] qtest: allow arbitrarily long sends, John Snow, 2015/05/12
- [Qemu-devel] [PULL v2 11/14] qtest: Add base64 encoded read/write, John Snow, 2015/05/12
- Re: [Qemu-devel] [PULL v2 00/14] Ide patches, Peter Maydell, 2015/05/12