From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, den@openvz.org,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 19/19] nbd: use generic trace subsystem instead of TRACE macro
Date: Mon, 5 Jun 2017 10:23:24 -0500 [thread overview]
Message-ID: <ca6625b0-1be4-fa44-f6fe-da935621d6b3@redhat.com> (raw)
In-Reply-To: <20170530143052.165002-20-vsementsov@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 4791 bytes --]
[adding Stefan as trace maintainer]
On 05/30/2017 09:30 AM, Vladimir Sementsov-Ogievskiy wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> Makefile.objs | 1 +
> nbd/client.c | 77 ++++++++++++++++++++++++----------------------------
> nbd/nbd-internal.h | 19 -------------
> nbd/server.c | 79 ++++++++++++++++++++++++++----------------------------
> nbd/trace-events | 67 +++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 141 insertions(+), 102 deletions(-)
> create mode 100644 nbd/trace-events
I like where you're headed with this one.
Can you please include an example command line usage in the commit
message of how you are enabling the traces (the old way was to recompile
with CFLAGS=-DDEBUG_NBD; the new way no longer requires recompilation,
but listing a formula for easy tracing as part of the commit message
can't hurt). And if I'm correct, we already have the same command-line
tracing framework hooked up for all of qemu-nbd, qemu-io, and qemu
proper, right?
> @@ -453,8 +452,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
> int rc;
> bool zeroes = true;
>
> - TRACE("Receiving negotiation tlscreds=%p hostname=%s.",
Most trace messages don't have a trailing '.'; you can remove this one
as part of moving it to trace-events.
> @@ -477,7 +475,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
> goto fail;
> }
>
> - TRACE("Magic is %s", nbd_magic_to_string(print_buf, buf, 9));
> + trace_nbd_receive_negotiate_magic(nbd_magic_to_string(print_buf, buf, 9));
>
> if (memcmp(buf, "NBDMAGIC", 8) != 0) {
See my review on 18/19; I think it is sufficient to trace an 8-byte hex
number, instead of trying to string-ize things. Yeah, the magic number
happens to be an ASCII string, but treating it as a number is no real
loss of information.
> error_setg(errp, "Invalid magic received");
> @@ -489,7 +487,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
> goto fail;
> }
> magic = be64_to_cpu(magic);
> - TRACE("Magic is 0x%" PRIx64, magic);
> + trace_nbd_receive_negotiate_magic2(magic);
In fact, I think you only need one trace function for tracing an 8-byte
magic number, that can be called from more than one spot.
> @@ -501,15 +499,16 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
> goto fail;
> }
> globalflags = be16_to_cpu(globalflags);
> - TRACE("Global flags are %" PRIx32, globalflags);
> + trace_nbd_receive_negotiate_server_flags(
> + globalflags,
> + !!(globalflags & NBD_FLAG_FIXED_NEWSTYLE),
> + !!(globalflags & NBD_FLAG_NO_ZEROES));
Why do we have to trace particular bits within the flags, when we are
already tracing the flags as a whole? It is just redundant information
(yes, it makes it a bit harder to read the trace to learn whether a
given flag is set when you only have the hex number, but I don't think
that is a real loss).
> if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) {
> fixedNewStyle = true;
> - TRACE("Server supports fixed new style");
> clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE;
> }
> if (globalflags & NBD_FLAG_NO_ZEROES) {
> zeroes = false;
> - TRACE("Server supports no zeroes");
> clientflags |= NBD_FLAG_C_NO_ZEROES;
> }
I agree with dropping these two TRACE() in favor of the overall trace of
the flags above (this exercise is a good place to figure out where
TRACE() was too chatty).
> @@ -580,7 +579,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
> goto fail;
> }
> *size = be64_to_cpu(s);
> - TRACE("Size is %" PRIu64, *size);
> + trace_nbd_receive_negotiate_export_size(*size);
>
> if (read_sync(ioc, &oldflags, sizeof(oldflags), errp) < 0) {
> error_prepend(errp, "Failed to read export flags");
> @@ -597,7 +596,7 @@ int nbd_receive_negotiate(QIOChannel *ioc, const char *name, uint16_t *flags,
> goto fail;
> }
>
> - TRACE("Size is %" PRIu64 ", export flags %" PRIx16, *size, *flags);
> + trace_nbd_receive_negotiate_size_flags(*size, *flags);
Can we share the same trace for these two callers, by having the first
one use trace_nbd_receive_negotiate_size_flags(*size, 0)?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-06-05 15:23 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-30 14:30 [Qemu-devel] [PATCH 00/19] nbd errors and traces refactoring Vladimir Sementsov-Ogievskiy
2017-05-30 14:30 ` [Qemu-devel] [PATCH 01/19] nbd/server: get rid of nbd_negotiate_read and friends Vladimir Sementsov-Ogievskiy
2017-05-30 20:10 ` Eric Blake
2017-05-31 13:12 ` Vladimir Sementsov-Ogievskiy
2017-05-31 14:39 ` Eric Blake
2017-05-31 14:56 ` Vladimir Sementsov-Ogievskiy
2017-05-31 15:48 ` Vladimir Sementsov-Ogievskiy
2017-05-30 14:30 ` [Qemu-devel] [PATCH 02/19] nbd/server: get rid of ssize_t Vladimir Sementsov-Ogievskiy
2017-05-30 20:23 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 03/19] nbd/server: refactor nbd_co_send_reply Vladimir Sementsov-Ogievskiy
2017-05-30 20:25 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 04/19] nbd/server: get rid of EAGAIN dead code Vladimir Sementsov-Ogievskiy
2017-05-30 21:06 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 05/19] nbd/server: refactor nbd_co_receive_request Vladimir Sementsov-Ogievskiy
2017-05-30 21:31 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 06/19] nbd/server: remove NBDClientNewData Vladimir Sementsov-Ogievskiy
2017-05-30 22:03 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 07/19] nbd/server: nbd_negotiate: fix error path Vladimir Sementsov-Ogievskiy
2017-05-30 21:12 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 08/19] nbd/server: get rid of fail: return rc Vladimir Sementsov-Ogievskiy
2017-05-30 22:05 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 09/19] nbd/server: rename rc to ret Vladimir Sementsov-Ogievskiy
2017-05-30 22:15 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 10/19] nbd/server: refactor nbd_trip Vladimir Sementsov-Ogievskiy
2017-05-30 22:23 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 11/19] io/channel-socket: qio_channel_socket_writev handle EPIPE Vladimir Sementsov-Ogievskiy
2017-05-30 15:04 ` Daniel P. Berrange
2017-05-30 15:15 ` Vladimir Sementsov-Ogievskiy
2017-05-30 15:29 ` Daniel P. Berrange
2017-05-30 14:30 ` [Qemu-devel] [PATCH 12/19] nbd/common: nbd_wr_syncv handle QIO_CHANNEL_ERR_EPIPE Vladimir Sementsov-Ogievskiy
2017-06-01 22:13 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 13/19] nbd/server: return original error codes Vladimir Sementsov-Ogievskiy
2017-06-01 22:29 ` Eric Blake
2017-06-02 10:00 ` Vladimir Sementsov-Ogievskiy
2017-05-30 14:30 ` [Qemu-devel] [PATCH 14/19] nbd/server: nbd_negotiate: return 1 on NBD_OPT_ABORT Vladimir Sementsov-Ogievskiy
2017-06-01 22:33 ` Eric Blake
2017-06-02 12:55 ` Vladimir Sementsov-Ogievskiy
2017-06-02 13:14 ` Vladimir Sementsov-Ogievskiy
2017-05-30 14:30 ` [Qemu-devel] [PATCH 15/19] nbd/server: use errp instead of LOG Vladimir Sementsov-Ogievskiy
2017-06-03 21:46 ` Eric Blake
2017-06-05 9:33 ` Vladimir Sementsov-Ogievskiy
2017-05-30 14:30 ` [Qemu-devel] [PATCH 16/19] nbd/server: add errp to nbd_send_reply() Vladimir Sementsov-Ogievskiy
2017-06-03 21:50 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 17/19] nbd/common: nbd_tls_handshake: use error_reportf_err instead of TRACE Vladimir Sementsov-Ogievskiy
2017-06-03 21:55 ` Eric Blake
2017-05-30 14:30 ` [Qemu-devel] [PATCH 18/19] nbd/client: refactor TRACE of NBD_MAGIC Vladimir Sementsov-Ogievskiy
2017-06-05 15:06 ` Eric Blake
2017-06-06 9:01 ` Vladimir Sementsov-Ogievskiy
2017-05-30 14:30 ` [Qemu-devel] [PATCH 19/19] nbd: use generic trace subsystem instead of TRACE macro Vladimir Sementsov-Ogievskiy
2017-06-05 15:23 ` Eric Blake [this message]
2017-06-06 9:10 ` Vladimir Sementsov-Ogievskiy
2017-06-06 9:17 ` Vladimir Sementsov-Ogievskiy
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=ca6625b0-1be4-fa44-f6fe-da935621d6b3@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).