Misc patches for 2016-06-01
The following changes since commit 56821559f0ba682fe6b367815572e6f974d329ab:
Merge remote-tracking branch 'dgilbert/tags/pull-hmp-20170517' into staging (2017-05-18 13:36:15 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to f3c3ad2dc98c6610152355f6a4de1445efc87421:
cpus: reset throttle_thread_scheduled after sleep (2017-06-01 18:01:05 +0200)
----------------------------------------------------------------
* virtio-scsi use-after-free fix (Fam)
* vhost-user-scsi support (Felipe)
* SMM fixes and improvements for TCG (myself, Mihail)
* irqchip and AddressSpaceDispatch cleanups and fixes (Peter)
* Coverity fix (Stefano)
* NBD cleanups and fixes (Vladimir, Eric, myself)
* RTC accuracy improvements and code cleanups (Guangrong+Yunfang)
* socket error reporting improvement (Daniel)
* GDB XML description for SSE registers (Abdallah)
* kvmclock update fix (Denis)
* SMM memory savings (Gonglei)
* -cpu 486 fix (Paolo)
* various bugfixes (Roman, Peter, myself, Thomas)
* rtc-test improvement (Guangrong)
* migration throttling fix (Felipe)
----------------------------------------------------------------
Fixed patchew build failure, added another patch.
Abdallah Bouassida (1):
target/i386: Add GDB XML description for SSE registers
Daniel P. Berrange (1):
sockets: improve error reporting if UNIX socket path is too long
Denis Plotnikov (1):
kvmclock: update system_time_msr address forcibly
Eric Blake (1):
nbd: Fully initialize client in case of failed negotiation
Fam Zheng (1):
virtio-scsi: Unset hotplug handler when unrealize
Felipe Franciosi (3):
vhost-user-scsi: Introduce vhost-user-scsi host device
vhost-user-scsi: Introduce a vhost-user-scsi sample application
cpus: reset throttle_thread_scheduled after sleep
Gonglei (1):
kvm: don't register smram_listener when smm is off
Mihail Abakumov (1):
i386: fix read/write cr with icount option
Paolo Bonzini (5):
target/i386: enable A20 automatically in system management mode target/i386: use multiple CPU AddressSpaces
linuxboot_dma: compile for i486
edu: fix memory leak on msi_broken platforms
nbd: make it thread-safe, fix qcow2 over nbd
Peter Xu (5):
kvm: irqchip: trace changes on msi add/remove
msix: trace control bit write op
kvm: irqchip: skip update msi when disabled
exec: simplify phys_page_find() params
exec: fix address_space_get_iotlb_entry page mask
Roman Pen (1):
i386/kvm: do not zero out segment flags if segment is unusable or not present
Stefano Stabellini (1):
Check the return value of fcntl in qemu_set_cloexec
Tai Yunfang (1):
mc146818rtc: precisely count the clock for periodic timer
Thomas Huth (1):
hw/core: nmi.c can be compiled as common-obj nowadays
Vladimir Sementsov-Ogievskiy (5):
nbd: strict nbd_wr_syncv
nbd: read_sync and friends: return 0 on success
nbd: add errp parameter to nbd_wr_syncv()
nbd: add errp to read_sync, write_sync and drop_sync nbd/client.c: use errp instead of LOG
Xiao Guangrong (5):
mc146818rtc: update periodic timer only if it is needed
mc146818rtc: ensure LOST_TICK_POLICY_SLEW is only enabled on TARGET_I386
mc146818rtc: drop unnecessary '#ifdef TARGET_I386'
mc146818rtc: embrace all x86 specific code
qtest: add rtc periodic timer test
.gitignore | 1 + Makefile | 3 + Makefile.objs | 4 + block/nbd-client.c | 41 +- configure | 4 +- contrib/libvhost-user/libvhost-user.h | 11 +- contrib/vhost-user-scsi/Makefile.objs | 1 + contrib/vhost-user-scsi/vhost-user-scsi.c | 886 ++++++++++++++++++++++++++++++ cpus.c | 2 +- default-configs/pci.mak | 1 + default-configs/s390x-softmmu.mak | 1 + exec.c | 27 +- gdb-xml/i386-32bit-sse.xml | 52 ++ gdb-xml/i386-32bit.xml | 14 + gdb-xml/i386-64bit-sse.xml | 60 ++ gdb-xml/i386-64bit.xml | 14 + hw/core/Makefile.objs | 2 +- hw/i386/kvm/clock.c | 3 + hw/misc/edu.c | 12 +- hw/pci/msix.c | 11 +- hw/pci/trace-events | 3 + hw/scsi/Makefile.objs | 1 + hw/scsi/vhost-scsi-common.c | 1 - hw/scsi/vhost-user-scsi.c | 211 +++++++ hw/scsi/virtio-scsi.c | 3 + hw/timer/mc146818rtc.c | 203 ++++--- hw/virtio/virtio-pci.c | 54 ++ hw/virtio/virtio-pci.h | 11 + include/block/nbd.h | 8 +- include/hw/timer/mc146818rtc_regs.h | 20 + include/hw/virtio/vhost-user-scsi.h | 35 ++ include/hw/virtio/virtio-scsi.h | 2 + kvm-all.c | 8 +- nbd/client.c | 125 ++--- nbd/common.c | 23 +- nbd/nbd-internal.h | 40 +- nbd/server.c | 100 ++-- pc-bios/linuxboot_dma.bin | Bin 1536 -> 1536 bytes pc-bios/optionrom/Makefile | 1 + qemu-nbd.c | 5 +- target/i386/arch_memory_mapping.c | 18 +- target/i386/cpu.c | 23 +- target/i386/cpu.h | 20 +- target/i386/helper.c | 96 ++-- target/i386/kvm.c | 36 +- target/i386/machine.c | 4 - target/i386/smm_helper.c | 18 - target/i386/translate.c | 12 + tests/qemu-iotests/083.out | 2 + tests/rtc-test.c | 49 ++ trace-events | 3 +- util/oslib-posix.c | 4 +- util/qemu-sockets.c | 68 ++- 53 files changed, 1956 insertions(+), 401 deletions(-) create mode 100644 contrib/vhost-user-scsi/Makefile.objs create mode 100644 contrib/vhost-user-scsi/vhost-user-scsi.c create mode 100644 gdb-xml/i386-32bit-sse.xml create mode 100644 gdb-xml/i386-32bit.xml create mode 100644 gdb-xml/i386-64bit-sse.xml create mode 100644 gdb-xml/i386-64bit.xml create mode 100644 hw/scsi/vhost-user-scsi.c create mode 100644 include/hw/virtio/vhost-user-scsi.h
Signature · 1 line
2.13.0
[Qemu-devel] [PULL 06/34] qtest: add rtc periodic timer test
From: Xiao Guangrong <[email protected]>
It tests the accuracy of rtc periodic timer which is recently improved & fixed by commit 7ffcb539a3 ("mc146818rtc: precisely count the clock for periodic timer", 2017-05-19).
Message-Id: <[email protected]>
--- hw/timer/mc146818rtc.c | 15 +++--------- include/hw/timer/mc146818rtc_regs.h | 20 +++++++++++++++ tests/rtc-test.c | 49 +++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 12 deletions(-)
hw/timer/mc146818rtc.c +3 -12
@@ -120,7 +120,7 @@ static void rtc_coalesced_timer_update(RTCState *s)/* divide each RTC interval to 2 - 8 smaller intervals */ int c =MIN (s->irq_coalesced,7 ) +1 ;int64_t next_clock =qemu_clock_get_ns (rtc_clock) + -muldiv64 (s->period / c,NANOSECONDS_PER_SECOND ,RTC_CLOCK_RATE ); +periodic_clock_to_ns (s->period / c);timer_mod (s->coalesced_timer, next_clock); } }
@@ -178,16 +178,8 @@ static uint32_t rtc_periodic_clock_ticks(RTCState *s) } period_code = s->cmos_data[RTC_REG_A ] &0x0f ; -if (!period_code) { -return 0 ; - } - -if (period_code <=2 ) { - period_code +=7 ; - } -/* period in 32 Khz cycles */ -return 1 << (period_code -1 ); +return periodic_period_to_clock (period_code); }/*
@@ -260,8 +252,7 @@ periodic_timer_update(RTCState *s, int64_t current_time, uint32_t old_period)assert (lost_clock >=0 && lost_clock <= period); next_irq_clock = cur_clock + period - lost_clock; - s->next_periodic_time =muldiv64 (next_irq_clock,NANOSECONDS_PER_SECOND , -RTC_CLOCK_RATE ) +1 ; + s->next_periodic_time =periodic_clock_to_ns (next_irq_clock) +1 ;timer_mod (s->periodic_timer, s->next_periodic_time); }else { s->irq_coalesced =0 ;
include/hw/timer/mc146818rtc_regs.h +20 -0
@@ -65,4 +65,24 @@#define REG_C_AF 0x20#define REG_C_MASK 0x70 +static inline uint32_t periodic_period_to_clock (int period_code) +{ +if (!period_code) { +return 0 ; + } + +if (period_code <=2 ) { + period_code +=7 ; + } +/* period in 32 Khz cycles */ +return 1 << (period_code -1 ); +} + +#define RTC_CLOCK_RATE 32768 + +static inline int64_t periodic_clock_to_ns (int64_t clocks) +{ +return muldiv64 (clocks,NANOSECONDS_PER_SECOND ,RTC_CLOCK_RATE ); +} +#endif
tests/rtc-test.c +49 -0
67 lines not on this page · raw message
Signature · 1 line
2.13.0
[Qemu-devel] [PULL 34/34] cpus: reset throttle_thread_scheduled after sleep
In reply to Paolo BonziniFrom: Felipe Franciosi <[email protected]>
Currently, the throttle_thread_scheduled flag is reset back to 0 before sleeping (as part of the throttling logic). Given that throttle_timer (well, any timer) may tick with a slight delay, it so happens that under heavy throttling (ie. close or on CPU_THROTTLE_PCT_MAX) the tick may schedule a further cpu_throttle_thread() work item after the flag reset, but before the previous sleep completed. This results on the vCPU thread sleeping continuously for potentially several seconds in a row.
The chances of that happening can be drastically minimised by resetting the flag after the sleep.
Message-Id: <[email protected]>
--- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cpus.c +1 -1
@@ -677,9 +677,9 @@ static void cpu_throttle_thread(CPUState *cpu, run_on_cpu_data opaque) sleeptime_ns = (long )(throttle_ratio *CPU_THROTTLE_TIMESLICE_NS );qemu_mutex_unlock_iothread (); -atomic_set (&cpu->throttle_thread_scheduled,0 );g_usleep (sleeptime_ns /1000 );/* Convert ns to us for usleep call */ qemu_mutex_lock_iothread (); +atomic_set (&cpu->throttle_thread_scheduled,0 ); }static void cpu_throttle_timer_tick (void *opaque)
Signature · 1 line
2.13.0