From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: will@kernel.org, julien.thierry.kdev@gmail.com,
Suzuki.Poulose@arm.com, andre.przywara@arm.com, maz@kernel.org,
oliver.upton@linux.dev, jean-philippe.brucker@arm.com,
apatel@ventanamicro.com, kvm@vger.kernel.org
Subject: Re: [PATCH RESEND kvmtool 3/4] util: Use __pr_debug() instead of pr_info() to print debug messages
Date: Fri, 7 Jul 2023 14:35:35 +0100 [thread overview]
Message-ID: <ZKgUpwD82qd7_W89@monolith.localdoman> (raw)
In-Reply-To: <20230704095004.GD3214657@myrica>
Hi,
On Tue, Jul 04, 2023 at 10:50:04AM +0100, Jean-Philippe Brucker wrote:
> On Fri, Jun 30, 2023 at 02:31:33PM +0100, Alexandru Elisei wrote:
> > pr_debug() is special, because it can be suppressed with a command line
> > argument, and because it needs to be a macro to capture the correct
> > filename, function name and line number. Display debug messages with the
> > prefix "Debug", to make it clear that those aren't informational messages.
> >
> > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
>
> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Thanks, changed the parameter to be called debug.
Alex
>
> (nit below)
>
> > ---
> > include/kvm/util.h | 3 ++-
> > util/util.c | 15 +++++++++++++++
> > 2 files changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/kvm/util.h b/include/kvm/util.h
> > index f51f370d2b37..6920ce2630ad 100644
> > --- a/include/kvm/util.h
> > +++ b/include/kvm/util.h
> > @@ -42,12 +42,13 @@ extern void die_perror(const char *s) NORETURN;
> > extern void pr_err(const char *err, ...) __attribute__((format (printf, 1, 2)));
> > extern void pr_warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
> > extern void pr_info(const char *err, ...) __attribute__((format (printf, 1, 2)));
> > +extern void __pr_debug(const char *err, ...) __attribute__((format (printf, 1, 2)));
> > extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
> >
> > #define pr_debug(fmt, ...) \
> > do { \
> > if (do_debug_print) \
> > - pr_info("(%s) %s:%d: " fmt, __FILE__, \
> > + __pr_debug("(%s) %s:%d: " fmt, __FILE__, \
> > __func__, __LINE__, ##__VA_ARGS__); \
> > } while (0)
> >
> > diff --git a/util/util.c b/util/util.c
> > index f59f26e1581c..e3b36f67f899 100644
> > --- a/util/util.c
> > +++ b/util/util.c
> > @@ -38,6 +38,11 @@ static void info_builtin(const char *info, va_list params)
> > report(" Info: ", info, params);
> > }
> >
> > +static void debug_builtin(const char *info, va_list params)
>
> parameter here and in __pr_debug could be called 'debug' for consistency
>
> > +{
> > + report(" Debug: ", info, params);
> > +}
> > +
> > void die(const char *err, ...)
> > {
> > va_list params;
> > @@ -74,6 +79,16 @@ void pr_info(const char *info, ...)
> > va_end(params);
> > }
> >
> > +/* Do not call directly; call pr_debug() instead. */
> > +void __pr_debug(const char *info, ...)
> > +{
> > + va_list params;
> > +
> > + va_start(params, info);
> > + debug_builtin(info, params);
> > + va_end(params);
> > +}
> > +
> > void die_perror(const char *s)
> > {
> > perror(s);
> > --
> > 2.41.0
> >
next prev parent reply other threads:[~2023-07-07 13:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 13:31 [PATCH RESEND kvmtool 0/4] Add --loglevel argument Alexandru Elisei
2023-06-30 13:31 ` [PATCH RESEND kvmtool 1/4] util: Make pr_err() return void Alexandru Elisei
2023-07-04 9:37 ` Jean-Philippe Brucker
2023-07-07 13:10 ` Alexandru Elisei
2023-06-30 13:31 ` [PATCH RESEND kvmtool 2/4] Replace printf/fprintf with pr_* macros Alexandru Elisei
2023-07-04 9:46 ` Jean-Philippe Brucker
2023-07-07 13:29 ` Alexandru Elisei
2023-07-07 14:21 ` Jean-Philippe Brucker
2023-06-30 13:31 ` [PATCH RESEND kvmtool 3/4] util: Use __pr_debug() instead of pr_info() to print debug messages Alexandru Elisei
2023-07-04 9:50 ` Jean-Philippe Brucker
2023-07-07 13:35 ` Alexandru Elisei [this message]
2023-06-30 13:31 ` [PATCH RESEND kvmtool 4/4] Add --loglevel argument for the run command Alexandru Elisei
2023-07-04 9:53 ` Jean-Philippe Brucker
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=ZKgUpwD82qd7_W89@monolith.localdoman \
--to=alexandru.elisei@arm.com \
--cc=Suzuki.Poulose@arm.com \
--cc=andre.przywara@arm.com \
--cc=apatel@ventanamicro.com \
--cc=jean-philippe.brucker@arm.com \
--cc=jean-philippe@linaro.org \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=will@kernel.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