From nobody Sun Feb 8 22:07:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502217474782929.1126728080611; Tue, 8 Aug 2017 11:37:54 -0700 (PDT) Received: from localhost ([::1]:44039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df9O5-0001Wg-HO for importer@patchew.org; Tue, 08 Aug 2017 14:37:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df9Jg-00063y-Rv for qemu-devel@nongnu.org; Tue, 08 Aug 2017 14:33:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1df9Jf-0002Rd-H9 for qemu-devel@nongnu.org; Tue, 08 Aug 2017 14:33:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53656) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1df9Jb-0002OI-Vn; Tue, 08 Aug 2017 14:33:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E526CC0003B7; Tue, 8 Aug 2017 18:33:14 +0000 (UTC) Received: from probe.redhat.com (ovpn-123-63.rdu2.redhat.com [10.10.123.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C8B660464; Tue, 8 Aug 2017 18:33:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E526CC0003B7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jsnow@redhat.com From: John Snow To: qemu-block@nongnu.org Date: Tue, 8 Aug 2017 14:33:02 -0400 Message-Id: <20170808183306.27474-6-jsnow@redhat.com> In-Reply-To: <20170808183306.27474-1-jsnow@redhat.com> References: <20170808183306.27474-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 08 Aug 2017 18:33:15 +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] [PATCH 5/9] 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: John Snow , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/ide/atapi.c | 5 +---- hw/ide/core.c | 17 ++++++++++------- hw/ide/trace-events | 3 +++ include/hw/ide/internal.h | 7 +++++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 37fa699..b8fc51e 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, in= t ret) s->io_buffer_size =3D n * 2048; data_offset =3D 0; } -#ifdef DEBUG_AIO - printf("aio_read_cd: lba=3D%u n=3D%d\n", s->lba, n); -#endif - + trace_ide_atapi_cmd_read_dma_cb_aio(s, s->lba, n); s->bus->dma->iov.iov_base =3D (void *)(s->io_buffer + data_offset); s->bus->dma->iov.iov_len =3D 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 29848ff..1358029 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -58,6 +58,13 @@ static const int smart_attributes[][12] =3D { { 190, 0x03, 0x00, 0x45, 0x45, 0x1f, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x= 32}, }; =20 +const char *IDE_DMA_CMD_lookup[IDE_DMA__END] =3D { + [IDE_DMA_READ] =3D "DMA_READ", + [IDE_DMA_WRITE] =3D "DMA_WRITE", + [IDE_DMA_TRIM] =3D "DMA TRIM", + [IDE_DMA_ATAPI] =3D "DMA ATAPI" +}; + static void ide_dummy_transfer_stop(IDEState *s); =20 static void padstr(char *str, const char *src, int len) @@ -860,10 +867,8 @@ static void ide_dma_cb(void *opaque, int ret) goto eot; } =20 -#ifdef DEBUG_AIO - printf("ide_dma_cb: sector_num=3D%" PRId64 " n=3D%d, cmd_cmd=3D%d\n", - sector_num, n, s->dma_cmd); -#endif + trace_ide_dma_cb(s, sector_num, n, + IDE_DMA_CMD_lookup[s->dma_cmd]); =20 if ((s->dma_cmd =3D=3D IDE_DMA_READ || s->dma_cmd =3D=3D IDE_DMA_WRITE= ) && !ide_sect_range_ok(s, sector_num, n)) { @@ -2383,9 +2388,7 @@ void ide_bus_reset(IDEBus *bus) =20 /* 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 =3D NULL; } diff --git a/hw/ide/trace-events b/hw/ide/trace-events index ade1e76..6e33cb3 100644 --- a/hw/ide/trace-events +++ b/hw/ide/trace-events @@ -17,6 +17,8 @@ ide_cancel_dma_sync_remaining(void) "draining all remaini= ng requests" ide_sector_read(int64_t sector_num, int nsectors) "sector=3D%"PRId64" nsec= tors=3D%d" ide_sector_write(int64_t sector_num, int nsectors) "sector=3D%"PRId64" nse= ctors=3D%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=3D%"PRId64" n=3D%d cmd=3D%s" =20 # hw/ide/pci.c bmdma_reset(void) "" @@ -48,5 +50,6 @@ ide_atapi_cmd_reply_end_new(void *s, int status) "IDEStat= e: %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=3D%d nb_sectors=3D%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=3D%d n=3D%d" # Warning: Verbose ide_atapi_cmd_packet(void *s, uint16_t limit, const char *packet) "IDEStat= e: %p; limit=3D0x%x packet: %s" \ No newline at end of file diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 74efe8a..97e97a2 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -14,7 +14,6 @@ #include "block/scsi.h" =20 /* debug IDE devices */ -//#define DEBUG_AIO #define USE_DMA_CDROM =20 typedef struct IDEBus IDEBus; @@ -333,12 +332,16 @@ struct unreported_events { }; =20 enum ide_dma_cmd { - IDE_DMA_READ, + IDE_DMA__BEGIN =3D 0, + IDE_DMA_READ =3D IDE_DMA__BEGIN, IDE_DMA_WRITE, IDE_DMA_TRIM, IDE_DMA_ATAPI, + IDE_DMA__END }; =20 +extern const char *IDE_DMA_CMD_lookup[IDE_DMA__END]; + #define ide_cmd_is_read(s) \ ((s)->dma_cmd =3D=3D IDE_DMA_READ) =20 --=20 2.9.4