From patchwork Tue May 12 18:46:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 471492 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 304A014078C for ; Wed, 13 May 2015 04:50:52 +1000 (AEST) Received: from localhost ([::1]:44595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsFGU-00068J-Ds for incoming@patchwork.ozlabs.org; Tue, 12 May 2015 14:50:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsFCR-0006Cg-3x for qemu-devel@nongnu.org; Tue, 12 May 2015 14:46:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsFCO-0005Bg-Eu for qemu-devel@nongnu.org; Tue, 12 May 2015 14:46:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsFCO-0005B4-8X for qemu-devel@nongnu.org; Tue, 12 May 2015 14:46:36 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id CB715B8133; Tue, 12 May 2015 18:46:35 +0000 (UTC) Received: from scv.usersys.redhat.com (dhcp-17-29.bos.redhat.com [10.18.17.29]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4CIkSiZ002794; Tue, 12 May 2015 14:46:35 -0400 From: John Snow To: qemu-devel@nongnu.org Date: Tue, 12 May 2015 14:46:25 -0400 Message-Id: <1431456386-13502-14-git-send-email-jsnow@redhat.com> In-Reply-To: <1431456386-13502-1-git-send-email-jsnow@redhat.com> References: <1431456386-13502-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, jsnow@redhat.com Subject: [Qemu-devel] [PULL v2 13/14] libqos/ahci: Swap memread/write with bufread/write X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Message-id: 1430864578-22072-6-git-send-email-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 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);