From patchwork Sat Sep 16 01:03:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 9954043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01B3060208 for ; Sat, 16 Sep 2017 01:08:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1BA629130 for ; Sat, 16 Sep 2017 01:08:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6B5229558; Sat, 16 Sep 2017 01:08:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1368829560 for ; Sat, 16 Sep 2017 01:08:06 +0000 (UTC) Received: from localhost ([::1]:55544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dt1Zw-0007Xu-3B for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Sep 2017 21:07:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dt1WG-0005Ay-51 for qemu-devel@nongnu.org; Fri, 15 Sep 2017 21:03:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dt1WE-0006BW-Jg for qemu-devel@nongnu.org; Fri, 15 Sep 2017 21:03:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dt1WE-0006AQ-Ax for qemu-devel@nongnu.org; Fri, 15 Sep 2017 21:03:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49F8A7EBD3; Sat, 16 Sep 2017 01:03:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 49F8A7EBD3 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jsnow@redhat.com Received: from probe.bos.redhat.com (dhcp-17-130.bos.redhat.com [10.18.17.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id D46505D96A; Sat, 16 Sep 2017 01:03:36 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Fri, 15 Sep 2017 21:03:26 -0400 Message-Id: <20170916010330.10435-8-jsnow@redhat.com> In-Reply-To: <20170916010330.10435-1-jsnow@redhat.com> References: <20170916010330.10435-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 16 Sep 2017 01:03:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/11] IDE: replace DEBUG_AIO with trace events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: John Snow Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Message-id: 20170901001502.29915-6-jsnow@redhat.com Signed-off-by: John Snow --- hw/ide/atapi.c | 5 +---- hw/ide/core.c | 24 +++++++++++++++++------- hw/ide/trace-events | 3 +++ include/hw/ide/internal.h | 6 ++++-- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 9b84a1b..c0509c8 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -416,10 +416,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) s->io_buffer_size = n * 2048; data_offset = 0; } -#ifdef DEBUG_AIO - printf("aio_read_cd: lba=%u n=%d\n", s->lba, n); -#endif - + trace_ide_atapi_cmd_read_dma_cb_aio(s, s->lba, n); s->bus->dma->iov.iov_base = (void *)(s->io_buffer + data_offset); s->bus->dma->iov.iov_len = n * ATAPI_SECTOR_SIZE; qemu_iovec_init_external(&s->bus->dma->qiov, &s->bus->dma->iov, 1); diff --git a/hw/ide/core.c b/hw/ide/core.c index 82a19b1..2cc2a08 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -58,6 +58,21 @@ static const int smart_attributes[][12] = { { 190, 0x03, 0x00, 0x45, 0x45, 0x1f, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x32}, }; +const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT] = { + [IDE_DMA_READ] = "DMA READ", + [IDE_DMA_WRITE] = "DMA WRITE", + [IDE_DMA_TRIM] = "DMA TRIM", + [IDE_DMA_ATAPI] = "DMA ATAPI" +}; + +static const char *IDE_DMA_CMD_str(enum ide_dma_cmd enval) +{ + if (enval >= 0 && enval < IDE_DMA__COUNT) { + return IDE_DMA_CMD_lookup[enval]; + } + return "DMA UNKNOWN CMD"; +} + static void ide_dummy_transfer_stop(IDEState *s); static void padstr(char *str, const char *src, int len) @@ -860,10 +875,7 @@ static void ide_dma_cb(void *opaque, int ret) goto eot; } -#ifdef DEBUG_AIO - printf("ide_dma_cb: sector_num=%" PRId64 " n=%d, cmd_cmd=%d\n", - sector_num, n, s->dma_cmd); -#endif + trace_ide_dma_cb(s, sector_num, n, IDE_DMA_CMD_str(s->dma_cmd)); if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && !ide_sect_range_ok(s, sector_num, n)) { @@ -2391,9 +2403,7 @@ void ide_bus_reset(IDEBus *bus) /* pending async DMA */ if (bus->dma->aiocb) { -#ifdef DEBUG_AIO - printf("aio_cancel\n"); -#endif + trace_ide_bus_reset_aio(); blk_aio_cancel(bus->dma->aiocb); bus->dma->aiocb = NULL; } diff --git a/hw/ide/trace-events b/hw/ide/trace-events index 8c79a6c..cc8949c 100644 --- a/hw/ide/trace-events +++ b/hw/ide/trace-events @@ -18,6 +18,8 @@ ide_cancel_dma_sync_remaining(void) "draining all remaining requests" ide_sector_read(int64_t sector_num, int nsectors) "sector=%"PRId64" nsectors=%d" ide_sector_write(int64_t sector_num, int nsectors) "sector=%"PRId64" nsectors=%d" ide_reset(void *s) "IDEstate %p" +ide_bus_reset_aio(void) "aio_cancel" +ide_dma_cb(void *s, int64_t sector_num, int n, const char *dma) "IDEState %p; sector_num=%"PRId64" n=%d cmd=%s" # BMDMA HBAs: @@ -51,5 +53,6 @@ ide_atapi_cmd_reply_end_new(void *s, int status) "IDEState: %p; new transfer sta ide_atapi_cmd_check_status(void *s) "IDEState: %p" ide_atapi_cmd_read(void *s, const char *method, int lba, int nb_sectors) "IDEState: %p; read %s: LBA=%d nb_sectors=%d" ide_atapi_cmd(void *s, uint8_t cmd) "IDEState: %p; cmd: 0x%02x" +ide_atapi_cmd_read_dma_cb_aio(void *s, int lba, int n) "IDEState: %p; aio read: lba=%d n=%d" # Warning: Verbose ide_atapi_cmd_packet(void *s, uint16_t limit, const char *packet) "IDEState: %p; limit=0x%x packet: %s" diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 74efe8a..db9fde0 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -14,7 +14,6 @@ #include "block/scsi.h" /* debug IDE devices */ -//#define DEBUG_AIO #define USE_DMA_CDROM typedef struct IDEBus IDEBus; @@ -333,12 +332,15 @@ struct unreported_events { }; enum ide_dma_cmd { - IDE_DMA_READ, + IDE_DMA_READ = 0, IDE_DMA_WRITE, IDE_DMA_TRIM, IDE_DMA_ATAPI, + IDE_DMA__COUNT }; +extern const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT]; + #define ide_cmd_is_read(s) \ ((s)->dma_cmd == IDE_DMA_READ)