All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: qemu-devel@nongnu.org, alistair23@gmail.com, armbru@redhat.com,
	Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 0/8]  Remove some of the fprintf(stderr, "*
Date: Tue, 26 Sep 2017 10:05:21 +0100	[thread overview]
Message-ID: <20170926090521.GE16834@stefanha-x1.localdomain> (raw)
In-Reply-To: <cover.1506384414.git.alistair.francis@xilinx.com>

On Mon, Sep 25, 2017 at 05:08:34PM -0700, Alistair Francis wrote:
> 
> Continue on improving QEMUs logging/error messages by removing more
> fprintf()'s.
> 
> Unfortunatley my Coccinelle skills aren't that great so it's all done in
> some nasty regex and a little bit of manual work.
> 
> 
> 
> Alistair Francis (8):
>   Replace all occurances of __FUNCTION__ with __func__
>   tests: Replace fprintf(stderr, "*\n" with error_report()
>   hw: Replace fprintf(stderr, "*\n" with error_report()
>   block: Replace fprintf(stderr, "*\n" with error_report()
>   util: Replace fprintf(stderr, "*\n" with error_report()
>   ui: Replace fprintf(stderr, "*\n" with error_report()
>   tcg: Replace fprintf(stderr, "*\n" with error_report()
>   target: Replace fprintf(stderr, "*\n" with error_report()
> 
>  audio/audio_int.h                      |   2 +-
>  block/file-posix.c                     |   6 +-
>  block/file-win32.c                     |   3 +-
>  block/linux-aio.c                      |   5 +-
>  block/parallels.c                      |   7 ++-
>  block/qcow2-cluster.c                  |   2 +-
>  block/qcow2-refcount.c                 |  95 +++++++++++++++----------------
>  block/qcow2.c                          |   8 +--
>  block/quorum.c                         |   5 +-
>  block/ssh.c                            |   4 +-
>  block/vdi.c                            |  14 +++--
>  block/vpc.c                            |   5 +-
>  block/vvfat.c                          |  99 ++++++++++++++++++---------------

Please don't convert fprintfs to error_report in the block layer yet.
error_report() uses the cur_mon global variable in a way that is not
thread-safe:

  void error_vprintf(const char *fmt, va_list ap)
  {
      if (cur_mon && !monitor_cur_is_qmp()) {
          monitor_vprintf(cur_mon, fmt, ap);

This is a time-of-check-to-time-of-use race condition.
monitor_cur_is_qmp() itself also suffers from a race condition.

I guess we haven't seen issues because error_report() is rarely called.

Stefan

  parent reply	other threads:[~2017-09-26  9:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  0:08 [Qemu-devel] [PATCH v1 0/8] Remove some of the fprintf(stderr, "* Alistair Francis
2017-09-26  0:08 ` [Qemu-devel] [PATCH v1 1/8] Replace all occurances of __FUNCTION__ with __func__ Alistair Francis
2017-09-26  0:08   ` Alistair Francis
2017-09-26 13:32   ` [Qemu-devel] " Eric Blake
2017-09-26 13:32   ` Eric Blake
2017-09-27 22:59     ` Alistair Francis
2017-09-27 22:59     ` Alistair Francis
2017-09-27 23:47     ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2017-09-28 22:37       ` Alistair Francis
2017-09-28 22:37         ` [Qemu-arm] [Qemu-devel] " Alistair Francis
2017-09-27 23:47     ` Peter Maydell
2017-09-26  0:08 ` [Qemu-devel] [PATCH v1 2/8] tests: Replace fprintf(stderr, "*\n" with error_report() Alistair Francis
2017-09-26  0:55   ` Emilio G. Cota
2017-09-26 14:03     ` Eric Blake
2017-09-27 23:08     ` Alistair Francis
2017-09-28 17:53       ` Emilio G. Cota
2017-09-26  0:08 ` [Qemu-devel] [PATCH v1 3/8] hw: " Alistair Francis
2017-09-26  0:08   ` Alistair Francis
2017-09-26  3:51   ` [Qemu-devel] " Thomas Huth
2017-09-27 22:41     ` Alistair Francis
2017-09-27 22:41       ` Alistair Francis
2017-09-26  3:51   ` Thomas Huth
2017-09-26  0:08 ` [Qemu-devel] [PATCH v1 4/8] block: " Alistair Francis
2017-09-26  0:09 ` [Qemu-devel] [PATCH v1 5/8] util: " Alistair Francis
2017-09-26  0:09 ` [Qemu-devel] [PATCH v1 6/8] ui: " Alistair Francis
2017-09-26  0:09 ` [Qemu-devel] [PATCH v1 7/8] tcg: " Alistair Francis
2017-09-26 15:05   ` Richard Henderson
2017-09-26  0:09 ` [Qemu-devel] [PATCH v1 8/8] target: " Alistair Francis
2017-09-26  4:08   ` Thomas Huth
2017-09-29 18:12     ` Alistair Francis
2017-09-26 15:21   ` Richard Henderson
2017-09-26  0:27 ` [Qemu-devel] [PATCH v1 0/8] Remove some of the fprintf(stderr, "* no-reply
2017-09-26  0:42 ` no-reply
2017-09-26  9:05 ` Stefan Hajnoczi [this message]
2017-09-26 16:47   ` Alistair Francis

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=20170926090521.GE16834@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=alistair.francis@xilinx.com \
    --cc=alistair23@gmail.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --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 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.