From nobody Mon May 6 22:51:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568813318; cv=none; d=zoho.com; s=zohoarc; b=OIWyxk64uoBfq65lfA5iir/JIAh5MTzFYhHzerxbODcR5IXslKkIOs4Mi0HcpmphDe2iogOijIPafUrj5bnmQaYA6hnCDN1RW3FimJe0GZJljeTaPlvoRHPTCZ4/DdTnWwc7+b0HJJaV9urkeBsuVyNUEApFePlIR9cWsoTM+3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568813318; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dN+vlJupHc0Gy39RDAxArH5Y+6YX8MgaflZNqlxvgjo=; b=FEdC1/T92xuVjExzVvTBRQbs0QSPtiUxuXrRqXZfjMeExPg8vrKOUs+r0rIOuZGn7lstC1UdzeyFF4m/sirOA5RjI7Udo2/E8Vk+zAAT24UaQ4KLwErxhLZ+R2tAExe6Wn7/pu/6E42NObmnLxTDSS+qpN8p2PwKrqvhwOl3nIc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568813318928586.192694437518; Wed, 18 Sep 2019 06:28:38 -0700 (PDT) Received: from localhost ([::1]:59052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAa0b-0006Be-DZ for importer@patchew.org; Wed, 18 Sep 2019 09:28:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAZth-0008AN-17 for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:21:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAZte-0002Tt-VA for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:21:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38080) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAZtc-0002Rr-2d; Wed, 18 Sep 2019 09:21:24 -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 40F0A10CC203; Wed, 18 Sep 2019 13:21:23 +0000 (UTC) Received: from localhost (unknown [10.36.118.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 269F3600C8; Wed, 18 Sep 2019 13:21:17 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Wed, 18 Sep 2019 14:21:10 +0100 Message-Id: <20190918132112.10418-2-stefanha@redhat.com> In-Reply-To: <20190918132112.10418-1-stefanha@redhat.com> References: <20190918132112.10418-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Wed, 18 Sep 2019 13:21:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/3] loader: Trace loaded images X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , qemu-block@nongnu.org, Alexey Kardashevskiy , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jason Wang , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy This adds a trace point which prints every loaded image. This includes bios/firmware/kernel/initradmdisk/pcirom. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190613050937.124903-1-aik@ozlabs.ru> Signed-off-by: Stefan Hajnoczi --- Makefile.objs | 1 + hw/core/loader.c | 3 +++ hw/core/trace-events | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 hw/core/trace-events diff --git a/Makefile.objs b/Makefile.objs index 6a143dcd57..abcbd89654 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -203,6 +203,7 @@ trace-events-subdirs +=3D target/riscv trace-events-subdirs +=3D target/s390x trace-events-subdirs +=3D target/sparc trace-events-subdirs +=3D util +trace-events-subdirs +=3D hw/core =20 trace-events-files =3D $(SRC_PATH)/trace-events $(trace-events-subdirs:%= =3D$(SRC_PATH)/%/trace-events) =20 diff --git a/hw/core/loader.c b/hw/core/loader.c index 75eb56ddbb..0d60219364 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -45,6 +45,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qapi/error.h" +#include "trace.h" #include "hw/hw.h" #include "disas/disas.h" #include "migration/vmstate.h" @@ -1151,6 +1152,8 @@ static void rom_reset(void *unused) * CPU definitely fetches its instructions from the just written d= ata. */ cpu_flush_icache_range(rom->addr, rom->datasize); + + trace_loader_write_rom(rom->name, rom->addr, rom->datasize, rom->i= srom); } } =20 diff --git a/hw/core/trace-events b/hw/core/trace-events new file mode 100644 index 0000000000..fe47a9c8cb --- /dev/null +++ b/hw/core/trace-events @@ -0,0 +1,2 @@ +# loader.c +loader_write_rom(const char *name, uint64_t gpa, uint64_t size, bool isrom= ) "%s: @0x%"PRIx64" size=3D0x%"PRIx64" ROM=3D%d" --=20 2.21.0 From nobody Mon May 6 22:51:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568813646; cv=none; d=zoho.com; s=zohoarc; b=IhOIXHn2k9AyaKJ7pStbK0JkU+kH+8C3A0uJYOdXcXkAjv9/4+nw/LKIsig5dKJXO8HtyuONITdhF0uswjOcK7uFEj/2iNrCo3uCERVmlyGnXPmUBZ9XReZfxHHlIaKTACsA1JcM0xj+d2Ai7Z+Ese+qcORq9lx11jO/z+REROI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568813646; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TkCVTmSWYnCxwzHShRqfqHSEMzTkA0sEieCaq8HrZOY=; b=POjBp2Rtzrszph4zIVZ8arSsc7UFHdWVY8bvXS9lEwaV7T5h/RRXhOH5yYNDN0u8UDwPlz6zcLFdj5Wx4fmkeB2DzkwNF9qlgmbSDVKOZ+42A2EGVpFd21DQOCJlbC5JEMNShLnyJoaLa1zkfbuWO9VwxblEleqxldlvXW1VXv8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568813645798278.3650448846046; Wed, 18 Sep 2019 06:34:05 -0700 (PDT) Received: from localhost ([::1]:59128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAa5n-0002Bk-EM for importer@patchew.org; Wed, 18 Sep 2019 09:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60457) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAZts-0008Lg-EZ for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:21:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAZtm-0002Xi-T9 for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:21:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36681) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAZtg-0002UB-Um; Wed, 18 Sep 2019 09:21:30 -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 3A1ADA3D3A3; Wed, 18 Sep 2019 13:21:27 +0000 (UTC) Received: from localhost (unknown [10.36.118.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B19A600C8; Wed, 18 Sep 2019 13:21:24 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Wed, 18 Sep 2019 14:21:11 +0100 Message-Id: <20190918132112.10418-3-stefanha@redhat.com> In-Reply-To: <20190918132112.10418-1-stefanha@redhat.com> References: <20190918132112.10418-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Wed, 18 Sep 2019 13:21:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] trace: Remove trailing newline in events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jason Wang , John Snow , Stefan Hajnoczi , Paolo Bonzini , Kevin Wolf Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 While the tracing framework does not forbid trailing newline in events format string, using them lead to confuse output. It is the responsibility of the backend to properly end an event line. Some of our formats have trailing newlines, remove them. [Fixed typo in commit description reported by Eric Blake --Stefan] Reviewed-by: John Snow Reviewed-by: Kevin Wolf Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20190916095121.29506-2-philmd@redhat.com Message-Id: <20190916095121.29506-2-philmd@redhat.com> Signed-off-by: Stefan Hajnoczi --- hw/misc/trace-events | 10 +++++----- hw/scsi/trace-events | 2 +- hw/sd/trace-events | 2 +- nbd/trace-events | 4 ++-- net/trace-events | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/misc/trace-events b/hw/misc/trace-events index c1ea1aa437..74276225f8 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -118,11 +118,11 @@ iotkit_secctl_ns_read(uint32_t offset, uint64_t data,= unsigned size) "IoTKit Sec iotkit_secctl_ns_write(uint32_t offset, uint64_t data, unsigned size) "IoT= Kit SecCtl NS regs write: offset 0x%x data 0x%" PRIx64 " size %u" =20 # imx6ul_ccm.c -ccm_entry(void) "\n" -ccm_freq(uint32_t freq) "freq =3D %d\n" -ccm_clock_freq(uint32_t clock, uint32_t freq) "(Clock =3D %d) =3D %d\n" -ccm_read_reg(const char *reg_name, uint32_t value) "reg[%s] <=3D 0x%" PRIx= 32 "\n" -ccm_write_reg(const char *reg_name, uint32_t value) "reg[%s] =3D> 0x%" PRI= x32 "\n" +ccm_entry(void) "" +ccm_freq(uint32_t freq) "freq =3D %d" +ccm_clock_freq(uint32_t clock, uint32_t freq) "(Clock =3D %d) =3D %d" +ccm_read_reg(const char *reg_name, uint32_t value) "reg[%s] <=3D 0x%" PRIx= 32 +ccm_write_reg(const char *reg_name, uint32_t value) "reg[%s] =3D> 0x%" PRI= x32 =20 # iotkit-sysinfo.c iotkit_sysinfo_read(uint64_t offset, uint64_t data, unsigned size) "IoTKit= SysInfo read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 452b5994e6..b0820052f8 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -28,7 +28,7 @@ mptsas_mmio_read(void *dev, uint32_t addr, uint32_t val) = "dev %p addr 0x%08x val mptsas_mmio_unhandled_read(void *dev, uint32_t addr) "dev %p addr 0x%08x" mptsas_mmio_unhandled_write(void *dev, uint32_t addr, uint32_t val) "dev %= p addr 0x%08x value 0x%x" mptsas_mmio_write(void *dev, uint32_t addr, uint32_t val) "dev %p addr 0x%= 08x value 0x%x" -mptsas_process_message(void *dev, int msg, uint32_t ctx) "dev %p cmd %d co= ntext 0x%08x\n" +mptsas_process_message(void *dev, int msg, uint32_t ctx) "dev %p cmd %d co= ntext 0x%08x" mptsas_process_scsi_io_request(void *dev, int bus, int target, int lun, ui= nt64_t len) "dev %p dev %d:%d:%d length %"PRIu64"" mptsas_reset(void *dev) "dev %p " mptsas_scsi_overflow(void *dev, uint32_t ctx, uint64_t req, uint64_t found= ) "dev %p context 0x%08x: %"PRIu64"/%"PRIu64"" diff --git a/hw/sd/trace-events b/hw/sd/trace-events index 52971dc033..efcff666a2 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -4,7 +4,7 @@ bcm2835_sdhost_read(uint64_t offset, uint64_t data, unsigned size) "offset= 0x%" PRIx64 " data 0x%" PRIx64 " size %u" bcm2835_sdhost_write(uint64_t offset, uint64_t data, unsigned size) "offse= t 0x%" PRIx64 " data 0x%" PRIx64 " size %u" bcm2835_sdhost_edm_change(const char *why, uint32_t edm) "(%s) EDM now 0x%= x" -bcm2835_sdhost_update_irq(uint32_t irq) "IRQ bits 0x%x\n" +bcm2835_sdhost_update_irq(uint32_t irq) "IRQ bits 0x%x" =20 # core.c sdbus_command(const char *bus_name, uint8_t cmd, uint32_t arg) "@%s CMD%02= d arg 0x%08x" diff --git a/nbd/trace-events b/nbd/trace-events index f6cde96790..a955918e97 100644 --- a/nbd/trace-events +++ b/nbd/trace-events @@ -61,8 +61,8 @@ nbd_negotiate_begin(void) "Beginning negotiation" nbd_negotiate_new_style_size_flags(uint64_t size, unsigned flags) "adverti= sing size %" PRIu64 " and flags 0x%x" nbd_negotiate_success(void) "Negotiation succeeded" nbd_receive_request(uint32_t magic, uint16_t flags, uint16_t type, uint64_= t from, uint32_t len) "Got request: { magic =3D 0x%" PRIx32 ", .flags =3D 0= x%" PRIx16 ", .type =3D 0x%" PRIx16 ", from =3D %" PRIu64 ", len =3D %" PRI= u32 " }" -nbd_blk_aio_attached(const char *name, void *ctx) "Export %s: Attaching cl= ients to AIO context %p\n" -nbd_blk_aio_detach(const char *name, void *ctx) "Export %s: Detaching clie= nts from AIO context %p\n" +nbd_blk_aio_attached(const char *name, void *ctx) "Export %s: Attaching cl= ients to AIO context %p" +nbd_blk_aio_detach(const char *name, void *ctx) "Export %s: Detaching clie= nts from AIO context %p" nbd_co_send_simple_reply(uint64_t handle, uint32_t error, const char *errn= ame, int len) "Send simple reply: handle =3D %" PRIu64 ", error =3D %" PRIu= 32 " (%s), len =3D %d" nbd_co_send_structured_done(uint64_t handle) "Send structured reply done: = handle =3D %" PRIu64 nbd_co_send_structured_read(uint64_t handle, uint64_t offset, void *data, = size_t size) "Send structured read data reply: handle =3D %" PRIu64 ", offs= et =3D %" PRIu64 ", data =3D %p, len =3D %zu" diff --git a/net/trace-events b/net/trace-events index ac57056497..02c13fd0ba 100644 --- a/net/trace-events +++ b/net/trace-events @@ -17,9 +17,9 @@ colo_compare_icmp_miscompare(const char *sta, int size) "= : %s =3D %d" colo_compare_ip_info(int psize, const char *sta, const char *stb, int ssiz= e, const char *stc, const char *std) "ppkt size =3D %d, ip_src =3D %s, ip_d= st =3D %s, spkt size =3D %d, ip_src =3D %s, ip_dst =3D %s" colo_old_packet_check_found(int64_t old_time) "%" PRId64 colo_compare_miscompare(void) "" -colo_compare_tcp_info(const char *pkt, uint32_t seq, uint32_t ack, int hdl= en, int pdlen, int offset, int flags) "%s: seq/ack=3D %u/%u hdlen=3D %d pdl= en=3D %d offset=3D %d flags=3D%d\n" +colo_compare_tcp_info(const char *pkt, uint32_t seq, uint32_t ack, int hdl= en, int pdlen, int offset, int flags) "%s: seq/ack=3D %u/%u hdlen=3D %d pdl= en=3D %d offset=3D %d flags=3D%d" =20 # filter-rewriter.c colo_filter_rewriter_debug(void) "" -colo_filter_rewriter_pkt_info(const char *func, const char *src, const cha= r *dst, uint32_t seq, uint32_t ack, uint32_t flag) "%s: src/dst: %s/%s p: s= eq/ack=3D%u/%u flags=3D0x%x\n" -colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=3D%u\n" +colo_filter_rewriter_pkt_info(const char *func, const char *src, const cha= r *dst, uint32_t seq, uint32_t ack, uint32_t flag) "%s: src/dst: %s/%s p: s= eq/ack=3D%u/%u flags=3D0x%x" +colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=3D%u" --=20 2.21.0 From nobody Mon May 6 22:51:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568813500; cv=none; d=zoho.com; s=zohoarc; b=g34FmX4TkndaetIPzhVE6Gr+p6imXCzGdHqtXShdVMd0QsWgqOgBpdQYgQutubPiOnBuHOPTtJ+Ep5X6NfVoRMP39oVihdQUqCooIyATbSNys+FhFwcRJt/boAGi/BacTbP0p+ysi4sR+SsQPYcrghEMirjsX+TlLBJoBhWMUdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568813500; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=u3SasnFC2RMMYt8RnjQ/2myy20dAeAmABFQnxZUkvpI=; b=PStFl79semGXK91M/fb8C13mFSkYTsC8CQHOge+vUIpS9x6J8mDKgfIFQdsGXQywlFmtpUYlfVTjjcFyRHl/yKPT3RsiGnA09QaKyhG0L/p8IQkbyPBXcMHniYqJ7x5/haw5cceNFBT6gaNTOvUF7XXtcFtHaj6FnyG1gEhoFXM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568813500538483.5183968491265; Wed, 18 Sep 2019 06:31:40 -0700 (PDT) Received: from localhost ([::1]:59108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAa3Q-0000zH-2h for importer@patchew.org; Wed, 18 Sep 2019 09:31:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60476) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAZtu-0008O9-El for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAZtt-0002bz-7f for qemu-devel@nongnu.org; Wed, 18 Sep 2019 09:21:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5854) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iAZtq-0002aL-0l; Wed, 18 Sep 2019 09:21:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B60610CC203; Wed, 18 Sep 2019 13:21:37 +0000 (UTC) Received: from localhost (unknown [10.36.118.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9260A5D6A5; Wed, 18 Sep 2019 13:21:28 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Wed, 18 Sep 2019 14:21:12 +0100 Message-Id: <20190918132112.10418-4-stefanha@redhat.com> In-Reply-To: <20190918132112.10418-1-stefanha@redhat.com> References: <20190918132112.10418-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Wed, 18 Sep 2019 13:21:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] trace: Forbid event format ending with newline character X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jason Wang , John Snow , Stefan Hajnoczi , Paolo Bonzini , Kevin Wolf Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Event format ending with newlines confuse the trace reports. Forbid them. Add a check to refuse new format added with trailing newline: $ make [...] GEN hw/misc/trace.h Traceback (most recent call last): File "scripts/tracetool.py", line 152, in main(sys.argv) File "scripts/tracetool.py", line 143, in main events.extend(tracetool.read_events(fh, arg)) File "scripts/tracetool/__init__.py", line 367, in read_events event =3D Event.build(line) File "scripts/tracetool/__init__.py", line 281, in build raise ValueError("Event format can not end with a newline character") ValueError: Error at hw/misc/trace-events:121: Event format can not end w= ith a newline character Reviewed-by: John Snow Reviewed-by: Kevin Wolf Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20190916095121.29506-3-philmd@redhat.com Message-Id: <20190916095121.29506-3-philmd@redhat.com> Signed-off-by: Stefan Hajnoczi --- docs/devel/tracing.txt | 2 ++ scripts/tracetool/__init__.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/devel/tracing.txt b/docs/devel/tracing.txt index 76e492a489..8231bbf5d1 100644 --- a/docs/devel/tracing.txt +++ b/docs/devel/tracing.txt @@ -112,6 +112,8 @@ Trace events should use types as follows: Format strings should reflect the types defined in the trace event. Take special care to use PRId64 and PRIu64 for int64_t and uint64_t types, respectively. This ensures portability between 32- and 64-bit platforms. +Format strings must not end with a newline character. It is the responsib= ility +of backends to adapt line ending for proper logging. =20 Each event declaration will start with the event name, then its arguments, finally a format string for pretty-printing. For example: diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 6fca674936..04279fa62e 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -277,6 +277,9 @@ class Event(object): if fmt.find("%m") !=3D -1 or fmt_trans.find("%m") !=3D -1: raise ValueError("Event format '%m' is forbidden, pass the err= or " "as an explicit trace argument") + if fmt.endswith(r'\n"'): + raise ValueError("Event format must not end with a newline " + "character") =20 if len(fmt_trans) > 0: fmt =3D [fmt_trans, fmt] --=20 2.21.0