qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, f4bug@amsat.org, alistair.francis@xilinx.com
Subject: Re: [Qemu-devel] [PATCH v8 14/14] target: Use qemu_log() instead of fprintf(stderr, ...)
Date: Mon, 5 Feb 2018 07:52:08 +0100	[thread overview]
Message-ID: <9189012b-c77c-3b7c-8014-bf086d0b75a5@redhat.com> (raw)
In-Reply-To: <87po5kx7w8.fsf@dusky.pond.sub.org>

On 05.02.2018 07:33, Markus Armbruster wrote:
> Thomas Huth <thuth@redhat.com> writes:
> 
>> On 03.02.2018 09:43, Markus Armbruster wrote:
>>> From: Alistair Francis <alistair.francis@xilinx.com>
>>>
>>> Convert fprintf(stderr, ...) to use qemu_log(). Double prints in
>>> target/ppc/translate.c were manually remove. A fprintf() in
>>> target/sh4/translate.c was kept as it's inside a #if 0. The #if 0 and
>>> fflush() was removed around the unimplemented log in
>>> target/sh4/translate.c as well.
>>>
>>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>>> [Trivial conflict with 6f1c2af641d resolved]
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>  target/cris/translate.c      |  2 +-
>>>  target/ppc/translate.c       | 36 ++++++++++--------------------------
>>>  target/sh4/translate.c       |  7 ++-----
>>>  target/unicore32/translate.c |  2 +-
>>>  4 files changed, 14 insertions(+), 33 deletions(-)
>>>
>>> diff --git a/target/cris/translate.c b/target/cris/translate.c
>>> index f51a731db9..ff31311ed0 100644
>>> --- a/target/cris/translate.c
>>> +++ b/target/cris/translate.c
>>> @@ -137,7 +137,7 @@ typedef struct DisasContext {
>>>  
>>>  static void gen_BUG(DisasContext *dc, const char *file, int line)
>>>  {
>>> -    fprintf(stderr, "BUG: pc=%x %s %d\n", dc->pc, file, line);
>>> +    qemu_log("BUG: pc=%x %s %d\n", dc->pc, file, line);
>>>      if (qemu_log_separate()) {
>>>          qemu_log("BUG: pc=%x %s %d\n", dc->pc, file, line);
>>>      }
>>
>> This one is still logging twice now.
> 
> Hmm.
> 
>>> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
>>> index 4132f67bb1..172c9f2001 100644
>>> --- a/target/ppc/translate.c
>>> +++ b/target/ppc/translate.c
>>> @@ -3933,12 +3933,8 @@ static inline void gen_op_mfspr(DisasContext *ctx)
>>>               * allowing userland application to read the PVR
>>>               */
>>>              if (sprn != SPR_PVR) {
>>> -                fprintf(stderr, "Trying to read privileged spr %d (0x%03x) at "
>>> -                        TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4);
>>> -                if (qemu_log_separate()) {
>>> -                    qemu_log("Trying to read privileged spr %d (0x%03x) at "
>>> -                             TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4);
>>> -                }
>>> +                qemu_log("Trying to read privileged spr %d (0x%03x) at "
>>> +                         TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4);
>>
>> I wonder whether that should maybe rather be a
>> qemu_log_mask(LOG_GUEST_ERROR, ...) instead? Well, but maybe that's
>> subject to another patch...
> 
> qemu_log_separate() appears to be always used like this
> 
>     fprintf(stderr, ... the message ...);
>     if (qemu_log_separate()) {
>         qemu_log(... the same message ...);
>     }
> 
> Are you proposing to replace this pattern by
> 
>     qemu_log_mask(LOG_GUEST_ERROR, ...the message ...);
> 
> ?

Not globally, only in target/ppc/translate.c. The wrong accesses to SPR
(special purpose registers) there indicate that the guest has likely
tried to do something wrong.

Globally, I wonder whether it still makes sense to keep the
qemu_log_separate() stuff - we rather want to get rid of all fprintfs,
don't we?

 Thomas

  reply	other threads:[~2018-02-05  6:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03  8:43 [Qemu-devel] [PATCH v8 00/14] Remove some of the fprintf(stderr, "* Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 01/14] audio: Replace AUDIO_FUNC with __func__ Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 02/14] hw/arm: Replace fprintf(stderr, "*\n" with error_report() Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 03/14] hw/dma: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 04/14] hw/lm32: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 05/14] hw/mips: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 06/14] hw/moxie: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 07/14] hw/openrisc: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 08/14] hw/pci*: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 09/14] hw/ppc: " Markus Armbruster
2018-02-06 17:06   ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 10/14] hw/sd: Replace fprintf(stderr, "*\n" with DPRINTF() Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 11/14] hw/sparc*: Replace fprintf(stderr, "*\n" with error_report() Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 12/14] hw/xen*: " Markus Armbruster
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 13/14] tcg: " Markus Armbruster
2018-02-03 20:28   ` Thomas Huth
2018-02-03  8:43 ` [Qemu-devel] [PATCH v8 14/14] target: Use qemu_log() instead of fprintf(stderr, ...) Markus Armbruster
2018-02-03 20:23   ` Thomas Huth
2018-02-05  6:33     ` Markus Armbruster
2018-02-05  6:52       ` Thomas Huth [this message]
2018-02-05 14:31         ` Markus Armbruster
2018-02-05 18:07           ` Alistair Francis
2018-02-06  8:43             ` Thomas Huth

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=9189012b-c77c-3b7c-8014-bf086d0b75a5@redhat.com \
    --to=thuth@redhat.com \
    --cc=alistair.francis@xilinx.com \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.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).