From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: marc.mari.barcelo@gmail.com, pbonzini@redhat.com,
John Snow <jsnow@redhat.com>,
afaerber@suse.de, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 4/4] libqos/ahci: Swap memread/write with bufread/write
Date: Fri, 1 May 2015 15:55:12 -0400 [thread overview]
Message-ID: <1430510112-30474-5-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1430510112-30474-1-git-send-email-jsnow@redhat.com>
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;
With this patch:
real 0m4.802s
user 0m3.506s
sys 0m2.393s
Without this series:
real 0m14.171s
user 0m12.072s
sys 0m12.527s
Signed-off-by: John Snow <jsnow@redhat.com>
---
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 7c23bb2..bbcb52a 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -806,7 +806,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);
@@ -814,7 +814,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);
@@ -950,7 +950,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);
@@ -967,7 +967,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 843cf72..e9b8bde 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -625,13 +625,13 @@ void ahci_io(AHCIQState *ahci, uint8_t port, uint8_t ide_cmd,
g_assert(ptr);
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
next prev parent reply other threads:[~2015-05-01 19:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 19:55 [Qemu-devel] [PATCH v2 0/4] qtest: base64 r/w and faster memset John Snow
2015-05-01 19:55 ` [Qemu-devel] [PATCH v2 1/4] qtest: allow arbitrarily long sends John Snow
2015-05-01 19:55 ` [Qemu-devel] [PATCH v2 2/4] qtest: Add base64 encoded read/write John Snow
2015-05-01 19:55 ` [Qemu-devel] [PATCH v2 3/4] qtest: add memset to qtest protocol John Snow
2015-05-01 19:55 ` John Snow [this message]
2015-05-01 20:48 ` [Qemu-devel] [PATCH v2 4/4] libqos/ahci: Swap memread/write with bufread/write Paolo Bonzini
2015-05-01 21:04 ` John Snow
2015-05-02 0:13 ` John Snow
2015-05-05 10:35 ` Paolo Bonzini
2015-05-05 15:48 ` John Snow
2015-05-05 16:19 ` Paolo Bonzini
2015-05-05 16:26 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430510112-30474-5-git-send-email-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=afaerber@suse.de \
--cc=marc.mari.barcelo@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).