From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Doug Gale <doug16k@gmail.com>, qemu-devel <qemu-devel@nongnu.org>,
keith.busch@intel.com, kwolf@redhat.com, qemu-block@nongnu.org,
mreitz@redhat.com
Subject: Re: [Qemu-devel] Patch to add helpful tracing output for driver authors in NVMe emulation
Date: Fri, 6 Oct 2017 14:54:25 +0100 [thread overview]
Message-ID: <20171006135425.GF26575@redhat.com> (raw)
In-Reply-To: <62e835a4-ba5d-e620-47d2-180932a33426@redhat.com>
On Fri, Oct 06, 2017 at 08:50:31AM -0500, Eric Blake wrote:
> On 10/05/2017 06:18 PM, Doug Gale wrote:
> > I added the tracing output in this patch to assist me in implementing
> > an NVMe driver. It helped tremendously.
> >
> >>From 1d19086cdef8d492929852d582cb41dcc5026f71 Mon Sep 17 00:00:00 2001
> > From: Doug Gale <doug16k@gmail.com>
> > Date: Thu, 5 Oct 2017 19:02:03 -0400
> > Subject: [PATCH] Add tracing output to NVMe emulation to help driver authors.
> >
> > It is off by default, enable it by uncommenting #define DEBUG_NVME
> > or through CFLAGS
> >
> > Signed-off-by: Doug Gale <doug16k@gmail.com>
> > ---
> > hw/block/nvme.c | 191 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
> > 1 file changed, 177 insertions(+), 14 deletions(-)
> >
> > diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> > index 9aa32692a3..74220c0171 100644
> > --- a/hw/block/nvme.c
> > +++ b/hw/block/nvme.c
> > @@ -36,6 +36,14 @@
> >
> > #include "nvme.h"
> >
> > +//#define DEBUG_NVME
> > +
> > +#ifdef DEBUG_NVME
> > +#define DPRINTF(fmt, ...) fprintf(stderr, "nvme: " fmt "\n", ## __VA_ARGS__)
> > +#else
> > +#define DPRINTF(fmt, ...) ((void)0)
> > +#endif
>
> As Kevin said, using trace-events is nicer than fprintf(). But if you
> absolutely insist on fprintf(), then do NOT do it like this, because
> this leads to bit-rot. Instead, do it in a form that lets -Wformat
> checking work even when tracing is disabled:
[snip]
IMHO using of trace() instead of fprintf() is pretty much mandatory
at this point. We've been making a concious effort to replace fprintfs
with trace across code, so shouldn't add more fprintfs. It is just so
much more useful to be able to enable the debugging without having to
recompile the binary.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2017-10-06 13:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 23:18 [Qemu-devel] Patch to add helpful tracing output for driver authors in NVMe emulation Doug Gale
2017-10-06 9:49 ` Kevin Wolf
2017-10-06 13:53 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-10-06 13:50 ` [Qemu-devel] " Eric Blake
2017-10-06 13:54 ` Daniel P. Berrange [this message]
2017-10-06 13:58 ` Doug Gale
2017-10-06 14:01 ` Daniel P. Berrange
2017-10-07 7:51 ` Doug Gale
2017-10-09 15:52 ` Eric Blake
2017-10-09 18:44 ` Doug Gale
2017-10-10 6:58 ` Markus Armbruster
2017-10-10 8:02 ` Kevin Wolf
2017-10-11 13:03 ` Doug Gale
2017-10-11 13:08 ` Peter Maydell
2017-10-11 19:46 ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
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=20171006135425.GF26575@redhat.com \
--to=berrange@redhat.com \
--cc=doug16k@gmail.com \
--cc=eblake@redhat.com \
--cc=keith.busch@intel.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).