summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-08-08 16:32:54 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-08-08 16:32:54 +0100
commite42590c22a3b88f1cfcb7288f477b38200f5ae8c (patch)
tree5c6a0aea5a298d207f0fb4d04859380bbc113704
parent53b080fa83c35d22cc94c730346fb2c53138d786 (diff)
parentf5048cb7517348a20ba202e435e1006a8f5001cf (diff)
downloadqemu-e42590c22a3b88f1cfcb7288f477b38200f5ae8c.tar.gz
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 <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # 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 <peter.maydell@linaro.org>
-rw-r--r--bsd-user/main.c2
-rw-r--r--hw/scsi/scsi-bus.c7
-rw-r--r--include/qemu-common.h5
-rw-r--r--include/qemu/rcu.h7
-rw-r--r--include/sysemu/kvm.h14
-rw-r--r--linux-user/main.c4
-rw-r--r--linux-user/syscall.c1
-rw-r--r--os-posix.c2
-rw-r--r--qemu-img-cmds.hx22
-rw-r--r--qemu-img.c2
-rw-r--r--qemu-io.c9
-rw-r--r--qemu-nbd.c2
-rw-r--r--qga/main.c8
-rw-r--r--target/i386/translate.c1
-rw-r--r--util/rcu.c30
-rw-r--r--vl.c5
16 files changed, 84 insertions, 37 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 501e16f675..8a6706a1c8 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -686,6 +686,8 @@ static void usage(void)
" -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG\n"
"Note that if you provide several changes to single variable\n"
"last change will stay in effect.\n"
+ "\n"
+ QEMU_HELP_BOTTOM "\n"
,
TARGET_NAME,
interp_prefix,
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 23c51de66a..e364410a23 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -517,6 +517,11 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf)
{
SCSITargetReq *r = DO_UPCAST(SCSITargetReq, req, req);
+ if (req->lun != 0) {
+ scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));
+ scsi_req_complete(req, CHECK_CONDITION);
+ return 0;
+ }
switch (buf[0]) {
case REPORT_LUNS:
if (!scsi_target_emulate_report_luns(r)) {
@@ -542,7 +547,7 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf)
case TEST_UNIT_READY:
break;
default:
- scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));
+ scsi_req_build_sense(req, SENSE_CODE(INVALID_OPCODE));
scsi_req_complete(req, CHECK_CONDITION);
return 0;
illegal_request:
diff --git a/include/qemu-common.h b/include/qemu-common.h
index b5adbfa5e9..0456c79df4 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -22,6 +22,11 @@
#define QEMU_COPYRIGHT "Copyright (c) 2003-2017 " \
"Fabrice Bellard and the QEMU Project developers"
+/* Bug reporting information for --help arguments, About dialogs, etc */
+#define QEMU_HELP_BOTTOM \
+ "See <http://qemu.org/contribute/report-a-bug> for how to report bugs.\n" \
+ "More information on the QEMU project at <http://qemu.org>."
+
/* main function, renamed */
#if defined(CONFIG_COCOA)
int qemu_main(int argc, char **argv, char **envp);
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index 83ae2808be..f19413d649 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -105,7 +105,12 @@ extern void synchronize_rcu(void);
*/
extern void rcu_register_thread(void);
extern void rcu_unregister_thread(void);
-extern void rcu_after_fork(void);
+
+/*
+ * Support for fork(). fork() support is enabled at startup.
+ */
+extern void rcu_enable_atfork(void);
+extern void rcu_disable_atfork(void);
struct rcu_head;
typedef void RCUCBFunc(struct rcu_head *head);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 91fc07ee9a..3a458f50e9 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -428,11 +428,8 @@ int kvm_vm_check_extension(KVMState *s, unsigned int extension);
.flags = cap_flags, \
}; \
uint64_t args_tmp[] = { __VA_ARGS__ }; \
- int i; \
- for (i = 0; i < (int)ARRAY_SIZE(args_tmp) && \
- i < ARRAY_SIZE(cap.args); i++) { \
- cap.args[i] = args_tmp[i]; \
- } \
+ size_t n = MIN(ARRAY_SIZE(args_tmp), ARRAY_SIZE(cap.args)); \
+ memcpy(cap.args, args_tmp, n * sizeof(cap.args[0])); \
kvm_vm_ioctl(s, KVM_ENABLE_CAP, &cap); \
})
@@ -443,11 +440,8 @@ int kvm_vm_check_extension(KVMState *s, unsigned int extension);
.flags = cap_flags, \
}; \
uint64_t args_tmp[] = { __VA_ARGS__ }; \
- int i; \
- for (i = 0; i < (int)ARRAY_SIZE(args_tmp) && \
- i < ARRAY_SIZE(cap.args); i++) { \
- cap.args[i] = args_tmp[i]; \
- } \
+ size_t n = MIN(ARRAY_SIZE(args_tmp), ARRAY_SIZE(cap.args)); \
+ memcpy(cap.args, args_tmp, n * sizeof(cap.args[0])); \
kvm_vcpu_ioctl(cpu, KVM_ENABLE_CAP, &cap); \
})
diff --git a/linux-user/main.c b/linux-user/main.c
index 2b38d39d87..03666ef657 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4136,7 +4136,9 @@ static void usage(int exitcode)
" -E var1=val2,var2=val2 -U LD_PRELOAD,LD_DEBUG\n"
" QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG\n"
"Note that if you provide several changes to a single variable\n"
- "the last change will stay in effect.\n");
+ "the last change will stay in effect.\n"
+ "\n"
+ QEMU_HELP_BOTTOM "\n");
exit(exitcode);
}
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 54343c06be..9b6364a266 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6354,7 +6354,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
ret = fork();
if (ret == 0) {
/* Child Process. */
- rcu_after_fork();
cpu_clone_regs(env, newsp);
fork_end(1);
/* There is a race condition here. The parent process could
diff --git a/os-posix.c b/os-posix.c
index c6ddb7d830..92e9d85215 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -34,7 +34,6 @@
#include "sysemu/sysemu.h"
#include "net/slirp.h"
#include "qemu-options.h"
-#include "qemu/rcu.h"
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "qemu/cutils.h"
@@ -249,7 +248,6 @@ void os_daemonize(void)
signal(SIGTSTP, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
- rcu_after_fork();
}
}
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index 3763f13625..b47d409665 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -1,3 +1,4 @@
+HXCOMM Keep the list of subcommands sorted by name.
HXCOMM Use DEFHEADING() to define headings in both help text and texi
HXCOMM Text between STEXI and ETEXI are copied to texi version and
HXCOMM discarded from C version
@@ -9,6 +10,12 @@ STEXI
@table @option
ETEXI
+DEF("amend", img_amend,
+ "amend [--object objectdef] [--image-opts] [-p] [-q] [-f fmt] [-t cache] -o options filename")
+STEXI
+@item amend [--object @var{objectdef}] [--image-opts] [-p] [-q] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename}
+ETEXI
+
DEF("bench", img_bench,
"bench [-c count] [-d depth] [-f fmt] [--flush-interval=flush_interval] [-n] [--no-drain] [-o offset] [--pattern=pattern] [-q] [-s buffer_size] [-S step_size] [-t cache] [-w] [-U] filename")
STEXI
@@ -21,12 +28,6 @@ STEXI
@item check [--object @var{objectdef}] [--image-opts] [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] [-U] @var{filename}
ETEXI
-DEF("create", img_create,
- "create [-q] [--object objectdef] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]")
-STEXI
-@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}]
-ETEXI
-
DEF("commit", img_commit,
"commit [-q] [--object objectdef] [--image-opts] [-f fmt] [-t cache] [-b base] [-d] [-p] filename")
STEXI
@@ -45,6 +46,12 @@ STEXI
@item convert [--object @var{objectdef}] [--image-opts] [--target-image-opts] [-U] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W] @var{filename} [@var{filename2} [...]] @var{output_filename}
ETEXI
+DEF("create", img_create,
+ "create [-q] [--object objectdef] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]")
+STEXI
+@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}]
+ETEXI
+
DEF("dd", img_dd,
"dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] [skip=blocks] if=input of=output")
STEXI
@@ -87,9 +94,6 @@ STEXI
@item resize [--object @var{objectdef}] [--image-opts] [-q] @var{filename} [+ | -]@var{size}
ETEXI
-DEF("amend", img_amend,
- "amend [--object objectdef] [--image-opts] [-p] [-q] [-f fmt] [-t cache] -o options filename")
STEXI
-@item amend [--object @var{objectdef}] [--image-opts] [-p] [-q] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename}
@end table
ETEXI
diff --git a/qemu-img.c b/qemu-img.c
index f4d5f0d77d..56ef49e214 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -201,7 +201,7 @@ static void QEMU_NORETURN help(void)
printf("%s\nSupported formats:", help_msg);
bdrv_iterate_format(format_print, NULL);
- printf("\n");
+ printf("\n\n" QEMU_HELP_BOTTOM "\n");
exit(EXIT_SUCCESS);
}
diff --git a/qemu-io.c b/qemu-io.c
index 4cfa41c8f9..265445ad89 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -26,6 +26,7 @@
#include "block/block_int.h"
#include "trace/control.h"
#include "crypto/init.h"
+#include "qemu-version.h"
#define CMD_NOFILE_OK 0x01
@@ -261,8 +262,9 @@ static void usage(const char *name)
" -h, --help display this help and exit\n"
" -V, --version output version information and exit\n"
"\n"
-"See '%s -c help' for information on available commands."
-"\n",
+"See '%s -c help' for information on available commands.\n"
+"\n"
+QEMU_HELP_BOTTOM "\n",
name, name);
}
@@ -522,7 +524,8 @@ int main(int argc, char **argv)
trace_file = trace_opt_parse(optarg);
break;
case 'V':
- printf("%s version %s\n", progname, QEMU_VERSION);
+ printf("%s version " QEMU_VERSION QEMU_PKGVERSION "\n"
+ QEMU_COPYRIGHT "\n", progname);
exit(0);
case 'h':
usage(progname);
diff --git a/qemu-nbd.c b/qemu-nbd.c
index b8666bb575..27164b8205 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -123,7 +123,7 @@ static void usage(const char *name)
" --detect-zeroes=MODE set detect-zeroes mode (off, on, unmap)\n"
" --image-opts treat FILE as a full set of image options\n"
"\n"
-"Report bugs to <qemu-devel@nongnu.org>\n"
+QEMU_HELP_BOTTOM "\n"
, name, NBD_DEFAULT_PORT, "DEVICE");
}
diff --git a/qga/main.c b/qga/main.c
index 1b381d0bf3..62a62755bd 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -29,6 +29,7 @@
#include "qemu/help_option.h"
#include "qemu/sockets.h"
#include "qemu/systemd.h"
+#include "qemu-version.h"
#ifdef _WIN32
#include "qga/service-win32.h"
#include "qga/vss-win32.h"
@@ -213,7 +214,8 @@ static void usage(const char *cmd)
{
printf(
"Usage: %s [-m <method> -p <path>] [<options>]\n"
-"QEMU Guest Agent %s\n"
+"QEMU Guest Agent " QEMU_VERSION QEMU_PKGVERSION "\n"
+QEMU_COPYRIGHT "\n"
"\n"
" -m, --method transport method: one of unix-listen, virtio-serial,\n"
" isa-serial, or vsock-listen (virtio-serial is the default)\n"
@@ -247,8 +249,8 @@ static void usage(const char *cmd)
" options / command-line parameters to stdout\n"
" -h, --help display this help and exit\n"
"\n"
-"Report bugs to <mdroth@linux.vnet.ibm.com>\n"
- , cmd, QEMU_VERSION, QGA_VIRTIO_PATH_DEFAULT, QGA_SERIAL_PATH_DEFAULT,
+QEMU_HELP_BOTTOM "\n"
+ , cmd, QGA_VIRTIO_PATH_DEFAULT, QGA_SERIAL_PATH_DEFAULT,
dfl_pathnames.pidfile,
#ifdef CONFIG_FSFREEZE
QGA_FSFREEZE_HOOK_DEFAULT,
diff --git a/target/i386/translate.c b/target/i386/translate.c
index cab9e32f91..5fdadf98cf 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -4080,6 +4080,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
if (sse_fn_eppi == SSE_SPECIAL) {
ot = mo_64_32(s->dflag);
rm = (modrm & 7) | REX_B(s);
+ s->rip_offset = 1;
if (mod != 3)
gen_lea_modrm(env, s, modrm);
reg = ((modrm >> 3) & 7) | rex_r;
diff --git a/util/rcu.c b/util/rcu.c
index 9adc5e4a36..ca5a63e36a 100644
--- a/util/rcu.c
+++ b/util/rcu.c
@@ -318,30 +318,54 @@ static void rcu_init_complete(void)
rcu_register_thread();
}
+static int atfork_depth = 1;
+
+void rcu_enable_atfork(void)
+{
+ atfork_depth++;
+}
+
+void rcu_disable_atfork(void)
+{
+ atfork_depth--;
+}
+
#ifdef CONFIG_POSIX
static void rcu_init_lock(void)
{
+ if (atfork_depth < 1) {
+ return;
+ }
+
qemu_mutex_lock(&rcu_sync_lock);
qemu_mutex_lock(&rcu_registry_lock);
}
static void rcu_init_unlock(void)
{
+ if (atfork_depth < 1) {
+ return;
+ }
+
qemu_mutex_unlock(&rcu_registry_lock);
qemu_mutex_unlock(&rcu_sync_lock);
}
-#endif
-void rcu_after_fork(void)
+static void rcu_init_child(void)
{
+ if (atfork_depth < 1) {
+ return;
+ }
+
memset(&registry, 0, sizeof(registry));
rcu_init_complete();
}
+#endif
static void __attribute__((__constructor__)) rcu_init(void)
{
#ifdef CONFIG_POSIX
- pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_unlock);
+ pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child);
#endif
rcu_init_complete();
}
diff --git a/vl.c b/vl.c
index 99fcfa0442..8e247cc2a2 100644
--- a/vl.c
+++ b/vl.c
@@ -1942,7 +1942,9 @@ static void help(int exitcode)
"ctrl-alt-n switch to virtual console 'n'\n"
"ctrl-alt toggle mouse and keyboard grab\n"
"\n"
- "When using -nographic, press 'ctrl-a h' to get some help.\n");
+ "When using -nographic, press 'ctrl-a h' to get some help.\n"
+ "\n"
+ QEMU_HELP_BOTTOM "\n");
exit(exitcode);
}
@@ -4121,6 +4123,7 @@ int main(int argc, char **argv, char **envp)
set_memory_options(&ram_slots, &maxram_size, machine_class);
os_daemonize();
+ rcu_disable_atfork();
if (pid_file && qemu_create_pidfile(pid_file) != 0) {
error_report("could not acquire pid file: %s", strerror(errno));