From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 3/4] trace: forbid use of %m in trace event format strings
Date: Tue, 22 Jan 2019 11:25:55 -0600 [thread overview]
Message-ID: <da007012-1ba8-878c-08dd-f682e579effc@redhat.com> (raw)
In-Reply-To: <20190122164940.29244-4-berrange@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]
On 1/22/19 10:49 AM, Daniel P. Berrangé wrote:
> The '%m' format specifier instructs glibc's printf() implementation to
> insert the contents of strerror(errno). Since this is a glibc extension
> it should generally be avoided in QEMU due to need for portability to a
> variety of platforms.
Up to you if you want to mention that syslog() portably supports %m, but
not all trace backends use syslog().
>
> Even though vfio is Linux-only code that could otherwise use "%m", it
> must still be avoided in trace-events files because several of the
> backends do not use the format string and so this error information is
> invisible to them.
>
> The errno string value should be given as an explicit trace argument
> instead, making it accessible to all backends. This also allows it to
> work correctly with future patches that use the format string with
> systemtap's simple printf code.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> hw/vfio/pci.c | 2 +-
> hw/vfio/trace-events | 2 +-
> scripts/tracetool/__init__.py | 4 ++++
> 3 files changed, 6 insertions(+), 2 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-01-22 18:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 16:49 [Qemu-devel] [PATCH v3 0/4] trace: make systemtap easier to use for simple logging Daniel P. Berrangé
2019-01-22 16:49 ` [Qemu-devel] [PATCH v3 1/4] display: ensure qxl log_buf is a nul terminated string Daniel P. Berrangé
2019-01-22 17:23 ` Eric Blake
2019-01-22 16:49 ` [Qemu-devel] [PATCH v3 2/4] trace: enforce that every trace-events file has a final newline Daniel P. Berrangé
2019-01-22 16:49 ` [Qemu-devel] [PATCH v3 3/4] trace: forbid use of %m in trace event format strings Daniel P. Berrangé
2019-01-22 17:25 ` Eric Blake [this message]
2019-01-22 16:49 ` [Qemu-devel] [PATCH v3 4/4] trace: add ability to do simple printf logging via systemtap Daniel P. Berrangé
2019-01-22 17:42 ` Eric Blake
2019-01-23 11:59 ` Daniel P. Berrangé
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=da007012-1ba8-878c-08dd-f682e579effc@redhat.com \
--to=eblake@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=berrange@redhat.com \
--cc=kraxel@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).