[PATCH v1 0/5] Make the qemu_logfile handle thread safe.

Robert Foley posted 5 patches 4 years, 5 months ago
Test asan passed
Test checkpatch passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191112150105.2498-1-robert.foley@linaro.org
Maintainers: Marek Vasut <marex@denx.de>, Jason Wang <jasowang@redhat.com>, Chris Wulff <crwulff@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Michael Walle <michael@walle.cc>, Richard Henderson <rth@twiddle.net>, Eduardo Habkost <ehabkost@redhat.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>
There is a newer version of this series
accel/tcg/cpu-exec.c          |  4 +-
accel/tcg/translate-all.c     |  4 +-
accel/tcg/translator.c        |  4 +-
exec.c                        |  4 +-
hw/net/can/can_sja1000.c      |  4 +-
include/exec/log.h            | 33 ++++++++++++--
include/qemu/log.h            | 49 ++++++++++++++++----
net/can/can_socketcan.c       |  5 +-
target/cris/translate.c       |  4 +-
target/i386/translate.c       |  5 +-
target/lm32/translate.c       |  4 +-
target/microblaze/translate.c |  4 +-
target/nios2/translate.c      |  4 +-
target/tilegx/translate.c     |  7 +--
target/unicore32/translate.c  |  4 +-
tcg/tcg.c                     | 28 ++++++++----
tests/test-logging.c          | 80 ++++++++++++++++++++++++++++++++
util/log.c                    | 86 +++++++++++++++++++++++++++--------
18 files changed, 264 insertions(+), 69 deletions(-)
[PATCH v1 0/5] Make the qemu_logfile handle thread safe.
Posted by Robert Foley 4 years, 5 months ago
This patch adds thread safety to the qemu_logfile handle.  This now
allows changing the logfile while logging is active, and also solves 
the issue of a seg fault while changing the logfile.

This patch adds use of RCU for handling the swap out of the 
old qemu_logfile file descriptor.

Also added a few tests for logfile including changing the logfile
and closing the logfile.

One change also added for a pre-existing double free issue in 
qemu_set_log_filename() uncovered with the new test.

---
v1
    - This version of the patch incorporates changes 
      from the first round of review.  
    - It also includes a fix for an issue in
      qemu_set_log_filename().  This issue was uncovered 
      by the test added for this patch.
---
Robert Foley (5):
  Add a mutex to guarantee single writer to qemu_logfile handle.
  qemu_log_lock/unlock now preserves the qemu_logfile handle.
  Add use of RCU for qemu_logfile.
  Added tests for close and change of logfile.
  Fix double free issue in qemu_set_log_filename().

 accel/tcg/cpu-exec.c          |  4 +-
 accel/tcg/translate-all.c     |  4 +-
 accel/tcg/translator.c        |  4 +-
 exec.c                        |  4 +-
 hw/net/can/can_sja1000.c      |  4 +-
 include/exec/log.h            | 33 ++++++++++++--
 include/qemu/log.h            | 49 ++++++++++++++++----
 net/can/can_socketcan.c       |  5 +-
 target/cris/translate.c       |  4 +-
 target/i386/translate.c       |  5 +-
 target/lm32/translate.c       |  4 +-
 target/microblaze/translate.c |  4 +-
 target/nios2/translate.c      |  4 +-
 target/tilegx/translate.c     |  7 +--
 target/unicore32/translate.c  |  4 +-
 tcg/tcg.c                     | 28 ++++++++----
 tests/test-logging.c          | 80 ++++++++++++++++++++++++++++++++
 util/log.c                    | 86 +++++++++++++++++++++++++++--------
 18 files changed, 264 insertions(+), 69 deletions(-)

-- 
2.17.1