All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Denis V. Lunev" <den@openvz.org>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Pavel Butsykin <pbutsykin@virtuozzo.com>
Subject: Re: [Qemu-devel] What's the intended use of log.h logging?
Date: Mon, 19 Oct 2015 16:29:25 +0200	[thread overview]
Message-ID: <87a8rfq6d6.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA9-aTLgng4t-BJ-AB=TZpsd5PKkB8VHJQr4C8_69wUx+A@mail.gmail.com> (Peter Maydell's message of "Fri, 16 Oct 2015 13:51:30 +0100")

Peter Maydell <peter.maydell@linaro.org> writes:

> On 16 October 2015 at 13:33, Markus Armbruster <armbru@redhat.com> wrote:
>> We have a couple of related features, and I'd like to get some clarity
>> on how exactly they should be used.
>>
>> 1. Tracing
>>
>>    Documented in docs/tracing.txt.
>>
>>    Each trace event can be individually controlled with -trace and with
>>    monitor command trace-event.  Wildcards work.  Monitor command "info
>>    trace-event" shows their status.
>>
>>    Supports a wealth of tracing backends: nop (compiles out tracing
>>    completely), stderr (prints trace to stderr), "simple", "ftrace",
>>    "dtrace", ...  Range from "trivially easy" to "complex power tool".
>
> The major problem with this is it is a compile time choice
> (especially the choice of backend), and our default backend
> is 'nop'.

I think the default is / has become wrong.  Easy enough to fix.

Let's compare log.h and tracing.

Both let you control stuff on the command line and in the monitor.

log.h's unit of control is a mask bit, which controls a canned group of
related messages.

Tracing's unit of control is the individual message.  To control a group
of messages, use globbing.  As long as we use sane names, this is
strictly more powerful than canned group.  When you don't need the
power, globbing can be harder to use than canned group with sensible
names.

log.h can log to stderr, log to a file, or not log at all (default).

Tracing's capabilities depend on a compile time choice:

* You can pick multiple backends.  They're all simultaneously active.
  If we want to support enabling configured backends selectively at
  runtime, that shouldn't be hard.

* If you compile out tracing (configure only backend 'nop'), you can't
  trace.  That's a feature.

* If you pick 'stderr', you can trace to stderr.  Turning it into a
  backend that could alternatively trace to a file (-trace file=FNAME)
  would be easy.  Picking just 'stderr' would be feature-equivalent to
  log.h then.

>> 2. Ad hoc printing
>>
>>    We have 108 files with some #define DPRINTF(), and probably some more
>>    sailing under different flags.  The ones that aren't useless should
>>    probably be tracepoints.
>>
>> 3. "qemu/log.h" logging
>>
>>    Sports a "mask", where each bit enables a certain set of log
>>    messages.  Control the mask with "-d item,..."  Try "-d help" to see
>>    acceptable items.
>>
>>    Logs to stderr by default, can be redirected with "-D <logfile>".
>
> This, though it is a bit ad-hoc, always exists, always behaves the
> same way, and doesn't require anybody to rebuild QEMU to enable
> tracing.

"Always exists" and "doesn't require rebuild" are the same.

For me, "exists unless you compiled it out" would be a (minor)
improvement over "always exists".  That's how tracing will be once we
fix the default backend.

"Always behaves the same way" I interpret as complaint about tracing
user interface complexity.  Flexibility breeds complexity, and when you
don't need the former, you don't want the latter.

While that's a valid argument for a simpler user interface, it's hardly
one for having two separate subsystems!  Pretty sure we could provide
the existing log.h user interface as sugar for tracing if we wanted.

> I think having a more consistent approach to logging would be great,
> though.

Points I'd like to make:

1. Logging is not tracing.  Logging logs events interesting for the
user.  Tracing logs code execution.  It's a debugging aid.  The two
overlap to a degree, but they're not the same.

2. The current use of log.h seems closer to tracing than to logging.

3. I figure our tracing needs could be served by the tracing subsystem
with a few improvements.  The few things log.h can do that tracing can't
yet do should be easy enough to add.  Why have two separate subsystems
then?

4. Logging would be useful, but I feel it shouldn't be shoehorned into
log.h.

  reply	other threads:[~2015-10-19 14:29 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15  7:30 [Qemu-devel] [PATCH 0/3] QEMU logging improvements Denis V. Lunev
2015-10-15  7:30 ` [Qemu-devel] [PATCH 1/3] log: improve performance of qemu_log and qemu_log_mask if disabled Denis V. Lunev
2015-10-15 17:23   ` Alex Bennée
2015-10-15 17:40     ` Denis V. Lunev
2015-10-15 18:36       ` Alex Bennée
2015-10-16  7:17   ` Markus Armbruster
2015-10-16  7:45     ` Denis V. Lunev
2015-10-16 11:02       ` Markus Armbruster
2015-10-16 11:08         ` Denis V. Lunev
2015-10-15  7:30 ` [Qemu-devel] [PATCH 2/3] log: report hmp/qmp command and qmp event Denis V. Lunev
2015-10-16  7:34   ` Markus Armbruster
2015-10-16  9:51     ` Pavel Butsykin
2015-10-16 12:35       ` Markus Armbruster
2015-10-16 12:33   ` [Qemu-devel] What's the intended use of log.h logging? (was: [PATCH 2/3] log: report hmp/qmp command and qmp event) Markus Armbruster
2015-10-16 12:48     ` [Qemu-devel] What's the intended use of log.h logging? Paolo Bonzini
2015-10-16 12:54       ` Peter Maydell
2015-10-16 13:00         ` Paolo Bonzini
2015-10-16 13:38           ` Denis V. Lunev
2015-10-16 13:26         ` Daniel P. Berrange
2015-10-16 13:29           ` Peter Maydell
2015-10-16 13:30             ` Paolo Bonzini
2015-10-16 13:36               ` Peter Maydell
2015-10-16 14:17                 ` Paolo Bonzini
2015-10-16 14:31                   ` Peter Maydell
2015-10-16 15:27                     ` Paolo Bonzini
2015-10-19 13:17                     ` Markus Armbruster
2015-10-19 13:19                       ` Paolo Bonzini
2015-10-19 13:54                       ` Peter Maydell
2015-10-16 12:51     ` [Qemu-devel] What's the intended use of log.h logging? (was: [PATCH 2/3] log: report hmp/qmp command and qmp event) Peter Maydell
2015-10-19 14:29       ` Markus Armbruster [this message]
2015-10-19 14:41         ` [Qemu-devel] What's the intended use of log.h logging? Peter Maydell
2015-10-19 16:57           ` Dr. David Alan Gilbert
2015-10-19 17:02         ` Dr. David Alan Gilbert
2015-10-20 13:11         ` Kevin Wolf
2015-10-16 14:36     ` [Qemu-devel] What's the intended use of log.h logging? (was: [PATCH 2/3] log: report hmp/qmp command and qmp event) Alex Bennée
2015-10-19 14:52       ` [Qemu-devel] What's the intended use of log.h logging? Markus Armbruster
2015-10-19 14:57         ` Peter Maydell
2015-10-21 10:41     ` [Qemu-devel] What's the intended use of log.h logging? (was: [PATCH 2/3] log: report hmp/qmp command and qmp event) Stefan Hajnoczi
2015-10-21 11:10       ` [Qemu-devel] What's the intended use of log.h logging? Denis V. Lunev
2015-10-21 12:22       ` [Qemu-devel] What's the intended use of log.h logging? (was: [PATCH 2/3] log: report hmp/qmp command and qmp event) Peter Maydell
2015-10-22 12:26         ` Stefan Hajnoczi
2015-10-22 13:05           ` [Qemu-devel] What's the intended use of log.h logging? Paolo Bonzini
2015-10-15  7:30 ` [Qemu-devel] [PATCH 3/3] log: adds a timestamp to each log entry Denis V. Lunev
2015-10-16  7:49   ` Markus Armbruster
2015-10-16  9:55     ` Pavel Butsykin
2015-10-16 11:33       ` Markus Armbruster
2015-10-15 14:49 ` [Qemu-devel] [PATCH 0/3] QEMU logging improvements Kashyap Chamarthy
2015-10-15 15:18   ` Pavel Butsykin
2015-10-15 16:02     ` Kashyap Chamarthy
2015-10-26  9:16 ` Markus Armbruster

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=87a8rfq6d6.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=lcapitulino@redhat.com \
    --cc=pbutsykin@virtuozzo.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.