qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 73c6e4: rcu: completely disable pthread_atfor


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 73c6e4: rcu: completely disable pthread_atfork callbacks a...
Date: Tue, 08 Aug 2017 09:41:41 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 73c6e4013b4cd92d3d531bc22cc29e6036ef42e0
      
https://github.com/qemu/qemu/commit/73c6e4013b4cd92d3d531bc22cc29e6036ef42e0
  Author: Paolo Bonzini <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M include/qemu/rcu.h
    M util/rcu.c
    M vl.c

  Log Message:
  -----------
  rcu: completely disable pthread_atfork callbacks as soon as possible

Because of -daemonize, system mode QEMU sometimes needs to fork() and
keep RCU enabled in the child.  However, there is a possible deadlock
with synchronize_rcu:

- the CPU thread is inside a RCU critical section and wants to take
  the BQL in order to do MMIO

- the monitor thread, which is owning the BQL, calls rcu_init_lock
  which tries to take the rcu_sync_lock

- the call_rcu thread has taken rcu_sync_lock in synchronize_rcu, but
  synchronize_rcu needs the CPU thread to end the critical section
  before returning.

This cannot happen for user-mode emulation, because it does not have
a BQL.

To fix it, assume that system mode QEMU only forks in preparation for
exec (except when daemonizing) and disable pthread_atfork as soon as
the double fork has happened.

Reported-by: Dr. David Alan Gilbert <address@hidden>
Tested-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 2a96a552f9502ac34c29da2f3a39788db5ee5692
      
https://github.com/qemu/qemu/commit/2a96a552f9502ac34c29da2f3a39788db5ee5692
  Author: Paolo Bonzini <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M include/qemu/rcu.h
    M linux-user/syscall.c
    M os-posix.c
    M util/rcu.c

  Log Message:
  -----------
  Revert "rcu: do not create thread in pthread_atfork callback"

This reverts commit a59629fcc6f603e19b516dc08f75334e5c480bd0.
This is not needed anymore because the IOThread mutex is not
"magic" anymore (need not kick the CPU thread)and also because
fork callbacks are only enabled at the very beginning of
QEMU's execution.

Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 1b7ac7cab6a9abaf686fe7a7f4afea155c03d6a8
      
https://github.com/qemu/qemu/commit/1b7ac7cab6a9abaf686fe7a7f4afea155c03d6a8
  Author: Greg Kurz <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M include/sysemu/kvm.h

  Log Message:
  -----------
  kvm: workaround build break on gcc-7.1.1 / fedora26

Building QEMU on fedora26 with the latest gcc package fails:

  CC      ppc64-softmmu/target/ppc/kvm.o
In file included from include/sysemu/hw_accel.h:16:0,
           from target/ppc/kvm.c:31:
target/ppc/kvm.c: In function ‘kvmppc_booke_watchdog_enable’:
include/sysemu/kvm.h:449:35: error: ‘args_tmp[i]’ may be used uninitialized
 in this function [-Werror=maybe-uninitialized]
       cap.args[i] = args_tmp[i];                               \
                             ^
target/ppc/kvm.c: In function ‘kvmppc_set_papr’:
include/sysemu/kvm.h:449:35: error: ‘args_tmp[i]’ may be used uninitialized
 in this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors

$ rpm -q gcc
gcc-7.1.1-3.fc26.ppc64le

The compiler should obviously optimize this code away when no extra
agument is passed to kvm_vm_enable_cap() and kvm_vcpu_enable_cap(),
but it doesn't. This bug should be fixed one day in gcc, but we can
also change our code pattern so that we don't hit the issue anymore.
We workaround this, by using memcpy() instead of open-coding the copy.

Signed-off-by: Greg Kurz <address@hidden>
Message-Id: <address@hidden>
Acked-by: Cornelia Huck <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: ded6ddc5a7b95217557fa360913d1213e12d4a6d
      
https://github.com/qemu/qemu/commit/ded6ddc5a7b95217557fa360913d1213e12d4a6d
  Author: Hannes Reinecke <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M hw/scsi/scsi-bus.c

  Log Message:
  -----------
  scsi: clarify sense codes for LUN0 emulation

The LUN0 emulation is just that, an emulation for a non-existing
LUN0. So we should be returning LUN_NOT_SUPPORTED for any request
coming from any other LUN.
And we should be aborting unhandled commands with INVALID OPCODE,
not LUN NOT SUPPORTED.

Signed-off-by: Hannes Reinecke <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: ab6ab3e9972a49a359f59895a88bed311472ca97
      
https://github.com/qemu/qemu/commit/ab6ab3e9972a49a359f59895a88bed311472ca97
  Author: Joseph Myers <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M target/i386/translate.c

  Log Message:
  -----------
  target/i386: set rip_offset for some SSE4.1 instructions

When emulating various SSE4.1 instructions such as pinsrd, the address
of a memory operand is computed without allowing for the 8-bit
immediate operand located after the memory operand, meaning that the
memory operand uses the wrong address in the case where it is
rip-relative.  This patch adds the required rip_offset setting for
those instructions, so fixing some GCC test failures (13 in the gcc
testsuite in my GCC 6-based testing) when testing with a default CPU
setting enabling those instructions.

Signed-off-by: Joseph Myers <address@hidden>

Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 57b2d9d4a7155f516c3ffeec88f83867d0a99c4a
      
https://github.com/qemu/qemu/commit/57b2d9d4a7155f516c3ffeec88f83867d0a99c4a
  Author: Eric Blake <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M qemu-img-cmds.hx

  Log Message:
  -----------
  qemu-img: Sort sub-command names in --help

'amend' and 'create' were not listed alphabetically; hoist them
earlier.  Separate the @end table block to make it easier to
copy-and-paste the addition of future sub-commands.

Signed-off-by: Eric Blake <address@hidden>

Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 4face32a7a89cc135f9589cabaced69a445a53b9
      
https://github.com/qemu/qemu/commit/4face32a7a89cc135f9589cabaced69a445a53b9
  Author: Eric Blake <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M qemu-io.c

  Log Message:
  -----------
  qemu-io: Give more --version information

Include the package version information (useful for detecting
builds from git or downstream backports), and the copyright notice.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Acked-by: Kevin Wolf <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 8f1c29af01c80183d7bd9166690212929a46ad48
      
https://github.com/qemu/qemu/commit/8f1c29af01c80183d7bd9166690212929a46ad48
  Author: Eric Blake <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M qga/main.c

  Log Message:
  -----------
  qga: Give more --version information

Include the package version information (useful for detecting
builds from git or downstream backports), and the copyright notice.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: f5048cb7517348a20ba202e435e1006a8f5001cf
      
https://github.com/qemu/qemu/commit/f5048cb7517348a20ba202e435e1006a8f5001cf
  Author: Eric Blake <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M bsd-user/main.c
    M include/qemu-common.h
    M linux-user/main.c
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M qga/main.c
    M vl.c

  Log Message:
  -----------
  maint: Include bug-reporting info in --help output

These days, many programs are including a bug-reporting address,
or better yet, a link to the project web site, at the tail of
their --help output.  However, we were not very consistent at
doing so: only qemu-nbd and qemu-qa mentioned anything, with the
latter pointing to an individual person instead of the project.

Add a new #define that sets up a uniform string, mentioning both
bug reporting instructions and overall project details, and which
a downstream vendor could tweak if they want bugs to go to a
downstream database.  Then use it in all of our binaries which
have --help output.

The canned text intentionally references http:// instead of https://
because our https website currently causes certificate errors in
some browsers.  That can be tweaked later once we have resolved the
web site issued.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: e42590c22a3b88f1cfcb7288f477b38200f5ae8c
      
https://github.com/qemu/qemu/commit/e42590c22a3b88f1cfcb7288f477b38200f5ae8c
  Author: Peter Maydell <address@hidden>
  Date:   2017-08-08 (Tue, 08 Aug 2017)

  Changed paths:
    M bsd-user/main.c
    M hw/scsi/scsi-bus.c
    M include/qemu-common.h
    M include/qemu/rcu.h
    M include/sysemu/kvm.h
    M linux-user/main.c
    M linux-user/syscall.c
    M os-posix.c
    M qemu-img-cmds.hx
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M qga/main.c
    M target/i386/translate.c
    M util/rcu.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* --help/--version improvements (Eric)
* GCC 7 workaround (Greg)
* Small SCSI fix (Hannes)
* SSE 4.1 fix (Joseph)
* RCU deadlock fix (myself)

# gpg: Signature made Tue 08 Aug 2017 16:28:56 BST
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <address@hidden>"
# gpg:                 aka "Paolo Bonzini <address@hidden>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  maint: Include bug-reporting info in --help output
  qga: Give more --version information
  qemu-io: Give more --version information
  qemu-img: Sort sub-command names in --help
  target/i386: set rip_offset for some SSE4.1 instructions
  scsi: clarify sense codes for LUN0 emulation
  kvm: workaround build break on gcc-7.1.1 / fedora26
  Revert "rcu: do not create thread in pthread_atfork callback"
  rcu: completely disable pthread_atfork callbacks as soon as possible

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/53b080fa83c3...e42590c22a3b

reply via email to

[Prev in Thread] Current Thread [Next in Thread]