Misc patches for 2017-01-12
The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to a88ae3be7bf0550adf877f5422c837dbf4bf4a39:
scripts/analyse-locks-simpletrace.py: script to analyse lock times (2018-01-12 13:22:05 +0100)
----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)
----------------------------------------------------------------
Alex Bennée (4):
scripts/qemu-gdb: add simple tcg lock status helper scripts/qemu-gdb/timers.py: new helper to dump timer state util/qemu-thread-*: add qemu_lock, locked and unlock trace events scripts/analyse-locks-simpletrace.py: script to analyse lock times
Dr. David Alan Gilbert (2):
find_ram_offset: Add comments and tracing
find_ram_offset: Align ram_addr_t allocation on long boundaries
Eric Blake (7):
net: Drop unusual use of do { } while (0);
mips: Tweak location of ';' in macros
chardev: Use goto/label instead of do/break/while(0)
chardev: Clean up previous patch indentation
tests: Avoid 'do/while(false); ' in vhost-user-bridge
maint: Fix macros with broken 'do/while(0); ' usage
checkpatch: Enforce proper do/while (0) style
Fam Zheng (1):
scsi-generic: Add share-rw option
Haozhong Zhang (1):
pc: fail memory hot-plug/unplug with -no-acpi and Q35 machine type
Jan Dakinevich (1):
i386/cpu/kvm: look at PMU's CPUID before setting MSRs
Marc-André Lureau (18):
build-sys: fix qemu-ga -pthread linking
build-sys: silence make by default or V=0
build-sys: add a rule to print a variable
build-sys: compile with -Og or -O1 when --enable-debug tests/docker: add some sanitizers to fedora dockerfile tests/docker: add test-debug
build-sys: add some sanitizers when --enable-debug if possible
tests: fix check-qobject leak
vl: fix direct firmware directories leak
readline: add a free function
tests: fix migration-test leak
crypto: fix stack-buffer-overflow error
qemu-config: fix leak in query-command-line-options
tests: fix qmp-test leak
ucontext: annotate coroutine stack for ASAN
tests: fix coroutine leak in /basic/entered
mips: fix potential fopen(NULL,...)
disas/s390: fix global-buffer-overflow
Paolo Bonzini (3):
scsi: fix scsi_convert_sense crash when in_buf == NULL && in_len == 0
target-i386: update hflags on Hypervisor.framework
cpus: unify qemu_*_wait_io_event
Pavel Dovgalyuk (3):
hpet: recover timer offset correctly
icount: fixed saving/restoring of icount warp timers
cpu: flush TB cache when loading VMState
Peter Lieven (1):
block/iscsi: fix initialization of iTask in iscsi_co_get_block_status
Peter Xu (3):
chardev: use backend chr context when watch for fe
chardev: let g_idle_add() be with chardev gcontext
chardev: introduce qemu_chr_timeout_add_ms()
Stefan Hajnoczi (1):
scsi-disk: release AioContext in unaligned WRITE SAME case
Tao Wu (3):
target/i386: move hflags update code to a function target/i386: hax: change to use x86_update_hflags target/i386: hax: Move x86_update_hflags.
Thomas Huth (3):
tests/boot-serial-test: Add tests for microblaze boards tests/boot-serial-test: Add a test for the moxiesim machine tests/boot-serial-test: Add support for the raspi2 machine
linzhecheng (1):
irq: fix memory leak
.travis.yml | 3 +- Makefile | 7 +- audio/paaudio.c | 4 +- block/iscsi.c | 3 +- chardev/char-fe.c | 2 +- chardev/char-pty.c | 64 ++++++++-------- chardev/char-serial.c | 75 +++++++++--------- chardev/char-socket.c | 28 ++++--- chardev/char.c | 18 +++++ configure | 38 +++++++++- cpus.c | 134 ++++++++++++++++++++------------- crypto/ivgen-essiv.c | 2 +- disas/s390.c | 16 ++-- docs/devel/build-system.txt | 13 ++++ exec.c | 40 ++++++++-- hw/adc/stm32f2xx_adc.c | 2 +- hw/block/m25p80.c | 2 +- hw/char/cadence_uart.c | 2 +- hw/char/stm32f2xx_usart.c | 2 +- hw/char/terminal3270.c | 28 ++++--- hw/display/cg3.c | 2 +- hw/display/dpcd.c | 2 +- hw/display/xlnx_dp.c | 2 +- hw/dma/pl330.c | 2 +- hw/dma/xlnx-zynq-devcfg.c | 2 +- hw/dma/xlnx_dpdma.c | 2 +- hw/i2c/i2c-ddc.c | 2 +- hw/i386/pc.c | 18 ++++- hw/misc/auxbus.c | 2 +- hw/misc/macio/mac_dbdma.c | 4 +- hw/misc/mmio_interface.c | 2 +- hw/misc/stm32f2xx_syscfg.c | 2 +- hw/misc/zynq_slcr.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/pcnet.c | 20 ++--- hw/nvram/ds1225y.c | 4 +- hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 9 +++ hw/ssi/mss-spi.c | 2 +- hw/ssi/stm32f2xx_spi.c | 2 +- hw/ssi/xilinx_spi.c | 2 +- hw/ssi/xilinx_spips.c | 2 +- hw/timer/a9gtimer.c | 2 +- hw/timer/cadence_ttc.c | 2 +- hw/timer/hpet.c | 30 +++++++- hw/timer/mss-timer.c | 2 +- hw/timer/stm32f2xx_timer.c | 2 +- hw/tpm/tpm_passthrough.c | 2 +- hw/tpm/tpm_tis.c | 2 +- include/chardev/char.h | 3 + include/hw/compat.h | 6 +- include/qemu/compiler.h | 4 + include/qemu/readline.h | 1 + include/qemu/thread.h | 39 +++++++++- migration/rdma.c | 2 +- monitor.c | 2 +- rules.mak | 2 + scripts/analyse-locks-simpletrace.py | 99 ++++++++++++++++++++++++ scripts/checkpatch.pl | 5 ++ scripts/qemu-gdb.py | 4 +- scripts/qemugdb/tcg.py | 46 +++++++++++ scripts/qemugdb/timers.py | 54 +++++++++++++ scsi/utils.c | 12 +-- target/arm/translate-a64.c | 2 +- target/i386/cpu.c | 42 +++++++++++ target/i386/cpu.h | 2 + target/i386/hax-all.c | 54 +------------ target/i386/hvf/x86hvf.c | 2 +- target/i386/kvm.c | 121 ++++++++++++----------------- target/mips/msa_helper.c | 34 +++++---- target/s390x/kvm.c | 2 +- tests/Makefile.include | 5 ++ tests/acpi-utils.h | 8 +- tests/boot-serial-test.c | 37 +++++++++ tests/check-qobject.c | 2 + tests/docker/dockerfiles/fedora.docker | 4 +- tests/docker/test-clang | 2 +- tests/docker/test-debug | 26 +++++++ tests/docker/test-mingw | 2 - tests/migration-test.c | 3 +- tests/qmp-test.c | 3 +- tests/tcg/test-mmap.c | 2 +- tests/test-coroutine.c | 1 - tests/vhost-user-bridge.c | 6 +- trace-events | 4 + ui/sdl_zoom_template.h | 8 +- util/coroutine-ucontext.c | 48 ++++++++++++ util/qemu-config.c | 3 +- util/qemu-thread-posix.c | 21 +++--- util/qemu-thread-win32.c | 20 ++--- util/readline.c | 18 ++++- util/trace-events | 7 +- vl.c | 9 ++- 93 files changed, 975 insertions(+), 415 deletions(-) create mode 100755 scripts/analyse-locks-simpletrace.py create mode 100644 scripts/qemugdb/tcg.py create mode 100644 scripts/qemugdb/timers.py create mode 100755 tests/docker/test-debug
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/52] hpet: recover timer offset correctly
From: Pavel Dovgalyuk <[email protected]>
HPET saves its state by calculating the current time and recovers timer offset using this calculated value. But these calculations include divisions and multiplications. Therefore the timer state cannot be recovered precise enough.
This patch introduces saving of the original value of the offset to preserve the determinism of the timer.
--
v3: Added compat property for correct migration.
--- hw/timer/hpet.c | 30 ++++++++++++++++++++++++++++-- include/hw/compat.h | 6 +++++- 2 files changed, 33 insertions(+), 3 deletions(-)
hw/timer/hpet.c +28 -2
@@ -70,6 +70,7 @@ typedef struct HPETState {MemoryRegion iomem;uint64_t hpet_offset; +bool hpet_offset_saved;qemu_irq irqs[HPET_NUM_IRQ_ROUTES ];uint32_t flags;uint8_t rtc_irq_level;
@@ -221,7 +222,9 @@ static int hpet_pre_save(void *opaque)HPETState *s = opaque;/* save current counter value */ - s->hpet_counter =hpet_get_ticks (s); +if (hpet_enabled (s)) { + s->hpet_counter =hpet_get_ticks (s); + }return 0 ; }
@@ -252,7 +255,10 @@ static int hpet_post_load(void *opaque, int version_id)HPETState *s = opaque;/* Recalculate the offset between the main counter and guest time */ - s->hpet_offset =ticks_to_ns (s->hpet_counter) -qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +if (!s->hpet_offset_saved) { + s->hpet_offset =ticks_to_ns (s->hpet_counter) + -qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); + }/* Push number of timers into capability returned via HPET_ID */ s->capability &= ~HPET_ID_NUM_TIM_MASK ;
@@ -267,6 +273,13 @@ static int hpet_post_load(void *opaque, int version_id)return 0 ; } +static bool hpet_offset_needed (void *opaque) +{ +HPETState *s = opaque; + +return hpet_enabled (s) && s->hpet_offset_saved; +} +static bool hpet_rtc_irq_level_needed (void *opaque) {HPETState *s = opaque;
@@ -285,6 +298,17 @@ static const VMStateDescription vmstate_hpet_rtc_irq_level = { } }; +static const VMStateDescription vmstate_hpet_offset = { + .name ="hpet/offset" , + .version_id =1 , + .minimum_version_id =1 , + .needed = hpet_offset_needed, + .fields = (VMStateField []) { +VMSTATE_UINT64 (hpet_offset, HPETState), +VMSTATE_END_OF_LIST () + } +}; +static const VMStateDescription vmstate_hpet_timer = { .name ="hpet_timer" , .version_id =1 ,
@@ -320,6 +344,7 @@ static const VMStateDescription vmstate_hpet = { }, .subsections = (const VMStateDescription*[]) { &vmstate_hpet_rtc_irq_level, + &vmstate_hpet_offset,NULL } };
@@ -762,6 +787,7 @@ static Property hpet_device_properties[] = {DEFINE_PROP_UINT8 ("timers" , HPETState, num_timers,HPET_MIN_TIMERS ),DEFINE_PROP_BIT ("msi" , HPETState, flags,HPET_MSI_SUPPORT , false),DEFINE_PROP_UINT32 (HPET_INTCAP , HPETState, intcap,0 ), +DEFINE_PROP_BOOL ("hpet-offset-saved" , HPETState, hpet_offset_saved, true), DEFINE_PROP_END_OF_LIST(), };
include/hw/compat.h +5 -1
@@ -2,7 +2,11 @@#define HW_COMPAT_H #define HW_COMPAT_2_11 \ -/* empty */ + {\ + .driver = "hpet",\ + .property = "hpet-offset-saved",\ + .value = "false",\ + },#define HW_COMPAT_2_10 \ {\
Signature · 1 line
1.8.3.1
Quoted 27 lines · Paolo Bonzini
The following changes since commit
997eba28a3ed5400a80f754bf3a1c8044b75b9ff:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
a88ae3be7bf0550adf877f5422c837dbf4bf4a39:
scripts/analyse-locks-simpletrace.py: script to analyse lock times (2018-01-12 13:22:05 +0100)----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
*ram_addr_toptimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)
Quoted 1 line
----------------------------------------------------------------
This fails to build on x86-64 Linux, with an --enable-debug build, using gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
CC util/coroutine-ucontext.o/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c: In function ‘finish_switch_fiber’:/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:75:5:
error: implicit declaration of function ‘__sanitizer_finish_switch_fiber’ [-Werror=implicit-function-declaration]
__sanitizer_finish_switch_fiber(fake_stack_save, &bottom_old, &size_old);
^/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:75:5:
error: nested extern declaration of ‘__sanitizer_finish_switch_fiber’ [-Werror=nested-externs] /home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c: In function ‘start_switch_fiber’:/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:88:5:
error: implicit declaration of function ‘__sanitizer_start_switch_fiber’ [-Werror=implicit-function-declaration]
__sanitizer_start_switch_fiber(fake_stack_save, bottom, size);
^/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:88:5:
error: nested extern declaration of ‘__sanitizer_start_switch_fiber’ [-Werror=nested-externs]
It looks like older versions of gcc and the sanitizer don't provide those switch_fiber functions.
thanks
-- PMM
Quoted 53 lines · Peter Maydell
Quoted 27 lines · Paolo Bonzini
The following changes since commit
997eba28a3ed5400a80f754bf3a1c8044b75b9ff:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
a88ae3be7bf0550adf877f5422c837dbf4bf4a39:
scripts/analyse-locks-simpletrace.py: script to analyse lock times (2018-01-12 13:22:05 +0100)----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
*ram_addr_toptimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)Quoted 1 line
----------------------------------------------------------------
This fails to build on x86-64 Linux, with an --enable-debug build, using gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
CC
util/coroutine-ucontext.o/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c: In function ‘finish_switch_fiber’:/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:75:5:
error: implicit declaration of function ‘__sanitizer_finish_switch_fiber’ [-Werror=implicit-function-declaration]__sanitizer_finish_switch_fiber(fake_stack_save, &bottom_old, &size_old); ^
/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:75:5:
error: nested extern declaration of ‘__sanitizer_finish_switch_fiber’ [-Werror=nested-externs]/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c: In function ‘start_switch_fiber’:/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:88:5:
error: implicit declaration of function ‘__sanitizer_start_switch_fiber’ [-Werror=implicit-function-declaration]__sanitizer_start_switch_fiber(fake_stack_save, bottom, size); ^
Quoted 7 lines
/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:88:5:
error: nested extern declaration of ‘__sanitizer_start_switch_fiber’ [-Werror=nested-externs]It looks like older versions of gcc and the sanitizer don't provide those
switch_fiberfunctions.
I'll drop that patch. Marc-André, can you refine the configure test?
Paolo
Hi
Quoted 59 lines · Paolo Bonzini
Quoted 58 lines · Peter Maydell
Quoted 27 lines · Paolo Bonzini
The following changes since commit
997eba28a3ed5400a80f754bf3a1c8044b75b9ff:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)
are available in the git repository at:
git://github.com/bonzini/qemu.gittags/for-upstreamfor you to fetch changes up to
a88ae3be7bf0550adf877f5422c837dbf4bf4a39:
scripts/analyse-locks-simpletrace.py: script to analyse lock times (2018-01-12 13:22:05 +0100)----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
*ram_addr_toptimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)Quoted 1 line
----------------------------------------------------------------
This fails to build on x86-64 Linux, with an --enable-debug build, using gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
CC
util/coroutine-ucontext.o/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c: In function ‘finish_switch_fiber’:/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:75:5:
error: implicit declaration of function ‘__sanitizer_finish_switch_fiber’ [-Werror=implicit-function-declaration]__sanitizer_finish_switch_fiber(fake_stack_save, &bottom_old, &size_old); ^
/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:75:5:
error: nested extern declaration of ‘__sanitizer_finish_switch_fiber’ [-Werror=nested-externs]/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c: In function ‘start_switch_fiber’:/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:88:5:
error: implicit declaration of function ‘__sanitizer_start_switch_fiber’ [-Werror=implicit-function-declaration]__sanitizer_start_switch_fiber(fake_stack_save, bottom, size); ^
/home/petmay01/linaro/qemu-for-merges/util/coroutine-ucontext.c:88:5:
error: nested extern declaration of ‘__sanitizer_start_switch_fiber’ [-Werror=nested-externs]
Quoted 5 lines
Quoted 2 lines
It looks like older versions of gcc and the sanitizer don't provide those
switch_fiberfunctions.I'll drop that patch. Marc-André, can you refine the configure test?
working on it, thanks
Signature · 1 line
Marc-André Lureau
Quoted 1 line · Paolo Bonzini
I'll drop that patch.
I'm assuming you'll send a new pull req cover letter email when you've done that (so this one is leaving my queue of things to do).
thanks
-- PMM
Hi Paolo,
Quoted 6 lines · Peter Maydell
Quoted 1 line · Paolo Bonzini
I'll drop that patch.
I'm assuming you'll send a new pull req cover letter email when you've done that (so this one is leaving my queue of things to do).
If you send an new PR can you include Dmitry patch to update his email address? He is no more receiving mails for his maintained sections, and emails keep bouncing.
This is the patch:
http://lists.nongnu.org/archive/html/qemu-trivial/2017-12/msg00189.html
Thanks!
Phil.