Skip to content

Commit 91d0374

Browse files
committed
libqos/ahci: Swap memread/write with bufread/write
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 <jsnow@redhat.com> Message-id: 1430864578-22072-6-git-send-email-jsnow@redhat.com
1 parent 4d00796 commit 91d0374

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/ahci-test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,15 +874,15 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci, unsigned bufsize,
874874

875875
/* Write some indicative pattern to our buffer. */
876876
generate_pattern(tx, bufsize, AHCI_SECTOR_SIZE);
877-
memwrite(ptr, tx, bufsize);
877+
bufwrite(ptr, tx, bufsize);
878878

879879
/* Write this buffer to disk, then read it back to the DMA buffer. */
880880
ahci_guest_io(ahci, port, write_cmd, ptr, bufsize, sector);
881881
qmemset(ptr, 0x00, bufsize);
882882
ahci_guest_io(ahci, port, read_cmd, ptr, bufsize, sector);
883883

884884
/*** Read back the Data ***/
885-
memread(ptr, rx, bufsize);
885+
bufread(ptr, rx, bufsize);
886886
g_assert_cmphex(memcmp(tx, rx, bufsize), ==, 0);
887887

888888
ahci_free(ahci, ptr);
@@ -1018,7 +1018,7 @@ static void test_dma_fragmented(void)
10181018
/* Create a DMA buffer in guest memory, and write our pattern to it. */
10191019
ptr = guest_alloc(ahci->parent->alloc, bufsize);
10201020
g_assert(ptr);
1021-
memwrite(ptr, tx, bufsize);
1021+
bufwrite(ptr, tx, bufsize);
10221022

10231023
cmd = ahci_command_create(CMD_WRITE_DMA);
10241024
ahci_command_adjust(cmd, 0, ptr, bufsize, 32);
@@ -1035,7 +1035,7 @@ static void test_dma_fragmented(void)
10351035
g_free(cmd);
10361036

10371037
/* Read back the guest's receive buffer into local memory */
1038-
memread(ptr, rx, bufsize);
1038+
bufread(ptr, rx, bufsize);
10391039
guest_free(ahci->parent->alloc, ptr);
10401040

10411041
g_assert_cmphex(memcmp(tx, rx, bufsize), ==, 0);

tests/libqos/ahci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,13 +653,13 @@ void ahci_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
653653
qmemset(ptr, 0x00, bufsize);
654654

655655
if (props->write) {
656-
memwrite(ptr, buffer, bufsize);
656+
bufwrite(ptr, buffer, bufsize);
657657
}
658658

659659
ahci_guest_io(ahci, port, ide_cmd, ptr, bufsize, sector);
660660

661661
if (props->read) {
662-
memread(ptr, buffer, bufsize);
662+
bufread(ptr, buffer, bufsize);
663663
}
664664

665665
ahci_free(ahci, ptr);

0 commit comments

Comments
 (0)