Misc patches for 2018-09-30
The following changes since commit 3892f1f1a963e59dfe012cd9d461d33b2986fa3b:
Merge remote-tracking branch 'remotes/dgibson/tags/libfdt-20181002' into staging (2018-10-02 09:54:44 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 97866508669c4a75f531bfa94f8267900fcbb5dc:
hw/scsi/mptendian: Avoid taking address of fields in packed structs (2018-10-02 19:09:14 +0200)
----------------------------------------------------------------
* configure fix for environment variables (Daniel)
* fix memory leaks (Alex)
* x86_64 MTTCG fixes (Emilio)
* introduce atomic64 (Emilio)
* Fix for virtio hang (Fam, myself)
* SH serial port fix (Geert)
* Deprecate rotation_rate for scsi-block (Fam)
* Extend memory-backend-file availability to all POSIX hosts (Hikaru)
* Memory API cleanups and fixes (Igor, Li Qiang, Peter, Philippe)
* MSI/IOMMU fix (Jan)
* Socket reconnection fixes (Marc-André)
* icount fixes (Emilio, myself)
* QSP fixes for Coverity (myself)
* Some record/replay improovements (Pavel)
* Packed struct fixes (Peter)
* Windows dump fixes and elf2dmp (Viktor)
* kbmclock fix (Yongji)
----------------------------------------------------------------
Alex Bennée (1):
cpus: fix TCG kick timer leak
Daniel P. Berrangé (1):
configure: preserve various environment variables in config.status
Emilio G. Cota (22):
atomic: fix comment s/x64_64/x86_64/
cpus: initialize timers_state.vm_clock_lock
cacheinfo: add i/d cache_linesize_log
util: add atomic64
tests: add atomic64-bench
qsp: use atomic64 accessors
test-rcu-list: access n_reclaims and n_nodes_removed with atomic64
cpus: access .qemu_icount with atomic64
cpus: access .qemu_icount_bias with atomic64 target/i386: move cpu_cc_srcT to DisasContext target/i386: move cpu_A0 to DisasContext
target/i386: move cpu_T0 to DisasContext
target/i386: move cpu_T1 to DisasContext
target/i386: move cpu_tmp0 to DisasContext target/i386: move cpu_tmp4 to DisasContext target/i386: move cpu_ptr0 to DisasContext target/i386: move cpu_ptr1 to DisasContext target/i386: move cpu_tmp2_i32 to DisasContext target/i386: move cpu_tmp3_i32 to DisasContext target/i386: move cpu_tmp1_i64 to DisasContext target/i386: move x86_64_hregs to DisasContext
configure: enable mttcg for i386 and x86_64
Fam Zheng (2):
virtio: Return true from virtio_queue_empty if broken
scsi-block: Deprecate rotation_rate
Geert Uytterhoeven (1):
hw/char/sh_serial: Add timeout handling to unbreak serial input
Hikaru Nishida (1):
hostmem-file: make available memory-backend-file on POSIX-based hosts
Igor Mammedov (1):
memory: cleanup side effects of memory_region_init_foo() on failure
Jan Kiszka (1):
kvm: x86: Fix kvm_arch_fixup_msi_route for remap-less case
Li Qiang (5):
fw_cfg_mem: add read memory region callback
hw: debugexit: add read callback
hw: pc-testdev: add read memory region callback
hw: hyperv_testdev: add read callback
hw: edu: replace device name with macro
Li Zhijian (1):
change get_image_size return type to int64_t
Liran Alon (1):
i386: Compile CPUX86State xsave_buf only when support KVM or HVF
Marc-André Lureau (10):
hostmem-memfd: add checks before adding hostmem-memfd & properties
util: add qemu_write_pidfile()
util: use fcntl() for qemu_write_pidfile() locking Delete PID file on exit
Revert "chardev: tcp: postpone TLS work until machine done" Revert "chardev: tcp: postpone async connection setup"
char-socket: update all ioc handlers when changing context
test-char: fix random socket test failure
test-char: add socket reconnect test
qom/object: add some interface asserts
Mark Cave-Ayland (1):
lsi53c895a: convert to trace-events
Paolo Bonzini (9):
qsp: hide indirect function calls from Coverity
es1370: fix ADC_FRAMEADR and ADC_FRAMECNT
cpus: take seqlock across qemu_icount updates
serial: fix DLL writes
char-pty: remove unnecessary #ifdef target/i386: unify masking of interrupts target/i386: rename HF_SVMI_MASK to HF_GUEST_MASK
hvf: drop unused variable
virtio: do not take address of packed members
Pavel Dovgalyuk (10):
ps2: prevent changing irq state on save and load
replay: wake up vCPU when replaying
replay: flush events when exiting
translator: fix breakpoint processing
replay: allow loading any snapshots before recording
timer: introduce new virtual clock
slirp: fix ipv6 timers
ui: fix virtual timers
target/i386: fix translation for icount mode
replay: replay BH for IDE trim operation
Peter Maydell (4):
memory: Remove old_mmio accessors
hw/nvram/fw_cfg: Use memberwise copy of MemoryRegionOps struct docs/devel/memory.txt: Document _with_attrs accessors hw/scsi/mptendian: Avoid taking address of fields in packed structs
Philippe Mathieu-Daudé (3):
memory: Use MAKE_64BIT_MASK()
memory: Refactor common shifting code from accessors
memory: Fix access_with_adjusted_size(small size) on big-endian memory regions
Thomas Huth (1):
accel/tcg: Remove dead code
Viktor Prutyanov (4):
dump: fix Windows dump memory run mapping
dump: move Windows dump structures definitions
contrib: add elf2dmp tool
MAINTAINERS: add myself as elf2dmp maintainer
Yongji Xie (1):
kvmclock: run KVM_KVMCLOCK_CTRL ioctl in vcpu thread
MAINTAINERS | 5 + Makefile | 5 + Makefile.objs | 1 + accel/tcg/translate-all.c | 9 - accel/tcg/translator.c | 8 +- backends/Makefile.objs | 2 +- backends/hostmem-file.c | 2 +- backends/hostmem-memfd.c | 32 +- chardev/char-pty.c | 6 - chardev/char-socket.c | 86 +- configure | 45 + contrib/elf2dmp/Makefile.objs | 1 + contrib/elf2dmp/addrspace.c | 233 ++++ contrib/elf2dmp/addrspace.h | 44 + contrib/elf2dmp/download.c | 47 + contrib/elf2dmp/download.h | 13 + contrib/elf2dmp/err.h | 13 + contrib/elf2dmp/kdbg.h | 194 ++++ contrib/elf2dmp/main.c | 589 ++++++++++ contrib/elf2dmp/pdb.c | 322 ++++++ contrib/elf2dmp/pdb.h | 241 ++++ contrib/elf2dmp/pe.h | 121 ++ contrib/elf2dmp/qemu_elf.c | 164 +++ contrib/elf2dmp/qemu_elf.h | 51 + cpus.c | 84 +- docs/devel/memory.txt | 13 +- exec.c | 4 +- hw/alpha/dp264.c | 3 +- hw/audio/es1370.c | 10 +- hw/char/serial.c | 4 +- hw/char/sh_serial.c | 20 + hw/char/virtio-serial-bus.c | 6 +- hw/core/loader.c | 5 +- hw/hppa/machine.c | 2 +- hw/i386/kvm/clock.c | 17 +- hw/i386/pc.c | 7 +- hw/ide/core.c | 3 +- hw/input/ps2.c | 8 +- hw/mips/mips_fulong2e.c | 6 +- hw/mips/mips_malta.c | 6 +- hw/mips/mips_mipssim.c | 3 +- hw/mips/mips_r4k.c | 6 +- hw/misc/debugexit.c | 6 + hw/misc/edu.c | 5 +- hw/misc/hyperv_testdev.c | 10 +- hw/misc/pc-testdev.c | 20 +- hw/moxie/moxiesim.c | 2 +- hw/nvram/fw_cfg.c | 13 +- hw/scsi/lsi53c895a.c | 214 ++-- hw/scsi/mptendian.c | 163 +-- hw/scsi/scsi-disk.c | 6 + hw/scsi/trace-events | 62 ++ hw/virtio/virtio.c | 8 + include/exec/memory.h | 7 +- include/hw/loader.h | 2 +- include/qemu/atomic.h | 36 +- include/qemu/memfd.h | 18 +- include/qemu/osdep.h | 5 +- include/qemu/thread.h | 17 + include/qemu/timer.h | 9 + include/qemu/win_dump_defs.h | 179 +++ include/sysemu/replay.h | 3 + memory.c | 163 +-- os-posix.c | 24 - os-win32.c | 25 - qga/main.c | 54 +- qom/object.c | 9 +- replay/replay-events.c | 14 +- replay/replay-internal.h | 2 - replay/replay-snapshot.c | 17 +- replay/replay.c | 12 + scsi/qemu-pr-helper.c | 40 +- slirp/ip6_icmp.c | 7 +- target/i386/cpu.c | 51 +- target/i386/cpu.h | 9 +- target/i386/excp_helper.c | 2 +- target/i386/hvf/README.md | 2 +- target/i386/hvf/hvf.c | 3 +- target/i386/hvf/x86hvf.c | 4 +- target/i386/kvm.c | 10 +- target/i386/seg_helper.c | 112 +- target/i386/svm_helper.c | 6 +- target/i386/translate.c | 2474 +++++++++++++++++++++-------------------- tests/Makefile.include | 3 +- tests/atomic64-bench.c | 171 +++ tests/test-char.c | 25 +- tests/test-rcu-list.c | 20 +- tests/vhost-user-test.c | 6 +- ui/input.c | 8 +- util/Makefile.objs | 1 + util/atomic64.c | 83 ++ util/cacheinfo.c | 11 + util/memfd.c | 35 +- util/oslib-posix.c | 73 ++ util/oslib-win32.c | 27 + util/qemu-timer.c | 2 + util/qsp.c | 49 +- vl.c | 25 +- win_dump.c | 40 +- win_dump.h | 166 +-- 100 files changed, 4824 insertions(+), 2187 deletions(-) create mode 100644 contrib/elf2dmp/Makefile.objs create mode 100644 contrib/elf2dmp/addrspace.c create mode 100644 contrib/elf2dmp/addrspace.h create mode 100644 contrib/elf2dmp/download.c create mode 100644 contrib/elf2dmp/download.h create mode 100644 contrib/elf2dmp/err.h create mode 100644 contrib/elf2dmp/kdbg.h create mode 100644 contrib/elf2dmp/main.c create mode 100644 contrib/elf2dmp/pdb.c create mode 100644 contrib/elf2dmp/pdb.h create mode 100644 contrib/elf2dmp/pe.h create mode 100644 contrib/elf2dmp/qemu_elf.c create mode 100644 contrib/elf2dmp/qemu_elf.h create mode 100644 include/qemu/win_dump_defs.h create mode 100644 tests/atomic64-bench.c create mode 100644 util/atomic64.c
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 24/80] change get_image_size return type to int64_t
From: Li Zhijian <[email protected]>
Previously, if the size of initrd >=2G, qemu exits with error:
root@haswell-OptiPlex-9020:/home/lizj# /home/lizhijian/lkp/qemu-colo/x86_64-softmmu/qemu-system-x86_64 -kernel ./vmlinuz-4.16.0-rc4 -initrd large.cgz -nographic qemu: error reading initrd large.cgz: No such file or directory root@haswell-OptiPlex-9020:/home/lizj# du -sh large.cgz 2.5G large.cgz
this patch changes the caller side that use this function to calculate size of initrd file as well.
v2: update error message and int64_t printing format
Message-Id: <[email protected]>
--- hw/alpha/dp264.c | 3 ++- hw/core/loader.c | 5 +++-- hw/hppa/machine.c | 2 +- hw/i386/pc.c | 7 ++++++- hw/mips/mips_fulong2e.c | 6 +++--- hw/mips/mips_malta.c | 6 +++--- hw/mips/mips_mipssim.c | 3 +-- hw/mips/mips_r4k.c | 6 +++--- hw/moxie/moxiesim.c | 2 +- include/hw/loader.h | 2 +- 10 files changed, 24 insertions(+), 18 deletions(-)
hw/alpha/dp264.c +2 -1
@@ -150,7 +150,8 @@ static void clipper_init(MachineState *machine) }if (initrd_filename) { -long initrd_base, initrd_size; +long initrd_base; +int64_t initrd_size; initrd_size =get_image_size (initrd_filename);if (initrd_size <0 ) {
hw/core/loader.c +3 -2
@@ -61,9 +61,10 @@static int roms_loaded;/* return the size or -1 if error */ -int get_image_size (const char *filename) +int64_t get_image_size (const char *filename) { -int fd, size; +int fd; +int64_t size; fd =open (filename,O_RDONLY |O_BINARY );if (fd <0 )return -1 ;
hw/hppa/machine.c +1 -1
@@ -191,7 +191,7 @@ static void machine_hppa_init(MachineState *machine)if (initrd_filename) {ram_addr_t initrd_base; -long initrd_size; +int64_t initrd_size; initrd_size =get_image_size (initrd_filename);if (initrd_size <0 ) {
hw/i386/pc.c +6 -1
@@ -838,7 +838,8 @@ static void load_linux(PCMachineState *pcms, FWCfgState *fw_cfg) {uint16_t protocol; -int setup_size, kernel_size, initrd_size =0 , cmdline_size; +int setup_size, kernel_size, cmdline_size; +int64_t initrd_size =0 ;int dtb_size, setup_data_offset;uint32_t initrd_max;uint8_t header[8192 ], *setup, *kernel, *initrd_data;
@@ -974,6 +975,10 @@ static void load_linux(PCMachineState *pcms,fprintf (stderr,"qemu: error reading initrd %s: %s\n" , initrd_filename,strerror (errno));exit (1 ); + }else if (initrd_size >= initrd_max) { +fprintf (stderr,"qemu: initrd is too large, cannot support." +"(max: %" PRIu32", need %" PRId64")\n" , initrd_max, initrd_size); +exit (1 ); } initrd_addr = (initrd_max-initrd_size) & ~4095 ;
hw/mips/mips_fulong2e.c +3 -3
@@ -104,9 +104,9 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t* prom_buf, int index,static int64_t load_kernel (CPUMIPSState *env) { -int64_t kernel_entry, kernel_low, kernel_high; +int64_t kernel_entry, kernel_low, kernel_high, initrd_size;int index =0 ; -long kernel_size, initrd_size; +long kernel_size;ram_addr_t initrd_offset;uint32_t *prom_buf;long prom_size;
@@ -150,7 +150,7 @@ static int64_t load_kernel (CPUMIPSState *env)prom_set (prom_buf, index++,"%s" , loaderparams.kernel_filename);if (initrd_size >0 ) { -prom_set (prom_buf, index++,"rd_start=0x%" PRIx64" rd_size=%li %s" , +prom_set (prom_buf, index++,"rd_start=0x%" PRIx64" rd_size=%" PRId64" %s" ,cpu_mips_phys_to_kseg0 (NULL , initrd_offset), initrd_size, loaderparams.kernel_cmdline); }else {
hw/mips/mips_malta.c +3 -3
@@ -995,8 +995,8 @@ static void GCC_FMT_ATTR(3, 4) prom_set(uint32_t* prom_buf, int index,/* Kernel */ static int64_t load_kernel (void ) { -int64_t kernel_entry, kernel_high; -long kernel_size, initrd_size; +int64_t kernel_entry, kernel_high, initrd_size; +long kernel_size;ram_addr_t initrd_offset;int big_endian;uint32_t *prom_buf;
@@ -1070,7 +1070,7 @@ static int64_t load_kernel (void)prom_set (prom_buf, prom_index++,"%s" , loaderparams.kernel_filename);if (initrd_size >0 ) { -prom_set (prom_buf, prom_index++,"rd_start=0x%" PRIx64" rd_size=%li %s" , +prom_set (prom_buf, prom_index++,"rd_start=0x%" PRIx64" rd_size=%" PRId64" %s" ,xlate_to_kseg0 (NULL , initrd_offset), initrd_size, loaderparams.kernel_cmdline); }else {
hw/mips/mips_mipssim.c +1 -2
@@ -58,9 +58,8 @@ typedef struct ResetData {static int64_t load_kernel (void ) { -int64_t entry, kernel_high; +int64_t entry, kernel_high, initrd_size;long kernel_size; -long initrd_size;ram_addr_t initrd_offset;int big_endian;
hw/mips/mips_r4k.c +3 -3
@@ -81,8 +81,8 @@ typedef struct ResetData {static int64_t load_kernel (void ) {const size_t params_size =264 ; -int64_t entry, kernel_high; -long kernel_size, initrd_size; +int64_t entry, kernel_high, initrd_size; +long kernel_size;ram_addr_t initrd_offset;uint32_t *params_buf;int big_endian;
@@ -136,7 +136,7 @@ static int64_t load_kernel(void) params_buf[1 ] =tswap32 (0x12345678 );if (initrd_size >0 ) { -snprintf ((char *)params_buf +8 ,256 ,"rd_start=0x%" PRIx64" rd_size=%li %s" , +snprintf ((char *)params_buf +8 ,256 ,"rd_start=0x%" PRIx64" rd_size=%" PRId64" %s" ,cpu_mips_phys_to_kseg0 (NULL , initrd_offset), initrd_size, loaderparams.kernel_cmdline); }else {
hw/moxie/moxiesim.c +1 -1
@@ -54,8 +54,8 @@ typedef struct {static void load_kernel (MoxieCPU *cpu,LoaderParams *loader_params) {uint64_t entry, kernel_low, kernel_high; +int64_t initrd_size;long kernel_size; -long initrd_size;ram_addr_t initrd_offset; kernel_size = load_elf(loader_params->kernel_filename, NULL, NULL,
include/hw/loader.h +1 -1
@@ -10,7 +10,7 @@* Returns the size of the image file on success, -1 otherwise. * On error, errno is also set as appropriate. */ -int get_image_size (const char *filename); +int64_t get_image_size (const char *filename);int load_image (const char *filename,uint8_t *addr);/* deprecated */ ssize_t load_image_size (const char *filename,void *addr,size_t size);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 53/80] test-char: fix random socket test failure
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
Peter reported a test failure on FreeBSD with the new reconnect test:
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} gtester -k --verbose -m=quick tests/test-char
TEST: tests/test-char... (pid=16190)
/char/null: OK /char/invalid: OK /char/ringbuf: OK /char/mux: OK /char/stdio: OK /char/pipe: OK /char/file: OK /char/file-fifo: OK /char/udp: OK /char/serial: OK /char/hotswap: OK /char/socket/basic: OK /char/socket/reconnect: FAIL
GTester: last random seed: R02S521380d9c12f1dac3ad1763bf5665c27 (pid=16367)
/char/socket/fdpass: OK
FAIL: tests/test-char
**
ERROR:tests/test-char.c:353:char_socket_test_common: assertion failed:
(object_property_get_bool(OBJECT(chr_client), "connected", &error_abort))
It turns out that the socket test code checks both server and client connection states, but doesn't wait for both.
Wait for the client side as well.
Message-Id: <[email protected]>
--- tests/test-char.c | 7 +++++++ 1 file changed, 7 insertions(+)
tests/test-char.c +7 -0
@@ -347,6 +347,12 @@ static void char_socket_test_common(Chardev *chr) g_assert_cmpint(id, >, 0);main_loop (); + d.chr = chr_client; + id =g_idle_add (char_socket_test_idle, &d); +g_source_set_name_by_id (id,"test-idle" ); + g_assert_cmpint(id, >, 0); +main_loop (); +g_assert (object_property_get_bool (OBJECT (chr),"connected" , &error_abort));g_assert (object_property_get_bool (OBJECT (chr_client),"connected" , &error_abort));
@@ -356,6 +362,7 @@ static void char_socket_test_common(Chardev *chr)object_unparent (OBJECT (chr_client)); + d.chr = chr; d.conn_expected = false;g_idle_add (char_socket_test_idle, &d);main_loop ();
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 23 lines · Paolo Bonzini
The following changes since commit
3892f1f1a963e59dfe012cd9d461d33b2986fa3b:Merge remote-tracking branch 'remotes/dgibson/tags/libfdt-20181002' into staging (2018-10-02 09:54:44 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
97866508669c4a75f531bfa94f8267900fcbb5dc:hw/scsi/mptendian: Avoid taking address of fields in packed structs (2018-10-02 19:09:14 +0200)
----------------------------------------------------------------
* configure fix for environment variables (Daniel)
* fix memory leaks (Alex)
*x86_64MTTCG fixes (Emilio)
* introduce atomic64 (Emilio)
* Fix for virtio hang (Fam, myself)
* SH serial port fix (Geert)
* Deprecaterotation_ratefor scsi-block (Fam)
* Extend memory-backend-file availability to all POSIX hosts (Hikaru)
* Memory API cleanups and fixes (Igor, Li Qiang, Peter, Philippe)
Quoted 8 lines
* MSI/IOMMU fix (Jan)
* Socket reconnection fixes (Marc-André)
* icount fixes (Emilio, myself)
* QSP fixes for Coverity (myself)
* Some record/replay improovements (Pavel)
* Packed struct fixes (Peter)
* Windows dump fixes and elf2dmp (Viktor)
* kbmclock fix (Yongji)
Applied, thanks.
-- PMM