Patch Round-up for stable 1.6.2, freeze on 2013-12-06
Hi everyone,
The following new patches are queued for QEMU stable v1.6.2:
https://github.com/mdroth/qemu/commits/stable-1.6-staging
The release is planned for 2013-12-09:
http://wiki.qemu.org/Planning/1.6
Please respond here or CC [email protected] on any patches you think should be included in the release. The cut-off date is has been extended to 2013-12-06 due to the round-up email going out late.
Testing/feedback is greatly appreciated.
Thanks!
Alex Williamson (1):
vfio-pci: Fix multifunction=on
Alexey Kardashevskiy (1):
memory: fix 128 arithmetic in info mtree
Amit Shah (3):
char: move backends' io watch tag to CharDriverState
char: use common function to disable callbacks on chardev close
char: remove watch callback on chardev detach from frontend
Amos Kong (2):
virtio-net: fix the memory leak in rxfilter_notify()
rng-egd: offset the point when repeatedly read from the buffer
Bandan Das (1):
pci: unregister vmstate_pcibus on unplug
Cole Robinson (1):
Fix pc migration from qemu <= 1.5
Fam Zheng (1):
vmdk: Fix vmdk_parse_extents
Hans de Goede (1):
audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second
Igor Mammedov (1):
qdev-monitor: Fix crash when device_add is called with abstract driver
Jason Wang (1):
virtio-net: only delete bh that existed
Markus Armbruster (2):
tests: Fix schema parser test for in-tree build
tests: Update .gitignore for test-int128 and test-bitops
Matthew Daley (1):
xen_disk: mark ioreq as mapped before unmapping in error case
Max Filippov (1):
exec: fix breakpoint_invalidate when pc may not be translated
Max Reitz (1):
qcow2: count_contiguous_clusters and compression
Mike Frysinger (1):
configure: detect endian via compile test
Paolo Bonzini (1):
monitor: eliminate monitor_event_state_lock
Peter Lieven (1):
qcow2: fix possible corruption when reading multiple clusters
Peter Maydell (1):
configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0
Richard Henderson (1):
Adjust qapi-visit for python-2.4.3
Stefan Hajnoczi (1):
qdev-monitor: Unref device when device_add fails
Stefan Weil (5):
tci: Add implementation of rotl_i64, rotr_i64
bitops: Add rotate functions (rol8, ror8, ...)
misc: Use new rotate functions
qemu-char: Fix potential out of bounds access to local arrays
linux-user: Fix stat64 syscall for SPARC64
Vlad Yasevich (1):
qom: Fix memory leak in object_property_set_link()
Wenchao Xia (2):
qapi: fix memleak by adding implict struct functions in dealloc visitor
tests: fix memleak in error path test for input visitor
audio/audio.c | 3 +- backends/rng-egd.c | 4 +- block/qcow2-cluster.c | 7 +++- block/vmdk.c | 7 +++- configure | 45 +++++++++------------ exec.c | 6 ++- hw/block/xen_disk.c | 1 + hw/misc/vfio.c | 7 ++++ hw/net/virtio-net.c | 10 ++--- hw/pci-host/piix.c | 9 ++++- hw/pci-host/q35.c | 10 ++++- hw/pci/pci.c | 8 ++++ include/hw/i386/pc.h | 8 ++++ include/hw/pci-host/q35.h | 1 + include/qemu/bitops.h | 80 +++++++++++++++++++++++++++++++++++++ include/sysemu/char.h | 1 + linux-user/syscall.c | 6 +-- linux-user/syscall_defs.h | 14 +++++++ memory.c | 4 +- monitor.c | 6 --- qapi/qapi-dealloc-visitor.c | 20 ++++++++++ qdev-monitor.c | 8 ++++ qemu-char.c | 86 +++++++++++++++------------------------- qom/object.c | 5 ++- scripts/qapi-visit.py | 17 ++++++-- target-arm/iwmmxt_helper.c | 2 +- tcg/optimize.c | 12 ++---- tcg/tci/tcg-target.c | 1 - tci.c | 14 +++++-- tests/.gitignore | 3 ++ tests/Makefile | 8 ++-- tests/test-qmp-input-visitor.c | 1 + 32 files changed, 287 insertions(+), 127 deletions(-)
PATCH 1/32 char: move backends' io watch tag to CharDriverState
From: Amit Shah <[email protected]>
All the backends implement an io watcher tag for callbacks. Move it to CharDriverState from each backend's struct to make accessing the tag from backend-neutral functions easier.
This will be used later to cancel a callback on chardev detach from a frontend.
--- include/sysemu/char.h | 1 + qemu-char.c | 77 +++++++++++++++++++++++++------------------------ 2 files changed, 40 insertions(+), 38 deletions(-)
include/sysemu/char.h +1 -0
@@ -78,6 +78,7 @@ struct CharDriverState {int explicit_be_open;int avail_connections;int is_mux; +guint fd_in_tag;QemuOpts *opts;QTAILQ_ENTRY (CharDriverState) next; };
qemu-char.c +39 -38
179 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/32 char: use common function to disable callbacks on chardev close
In reply to Michael RothFrom: Amit Shah <[email protected]>
This deduplicates code used a lot of times.
--- qemu-char.c | 62 ++++++++++++++++++----------------------------------------- 1 file changed, 19 insertions(+), 43 deletions(-)
qemu-char.c +19 -43
@@ -725,6 +725,14 @@ static void io_remove_watch_poll(guint tag)g_source_destroy (&iwp->parent); } +static void remove_fd_in_watch (CharDriverState *chr) +{ +if (chr->fd_in_tag) { +io_remove_watch_poll (chr->fd_in_tag); + chr->fd_in_tag =0 ; + } +} +#ifndef _WIN32static GIOChannel *io_channel_from_fd (int fd) {
@@ -829,10 +837,7 @@ static gboolean fd_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) status =g_io_channel_read_chars (chan, (gchar *)buf, len, &bytes_read,NULL );if (status ==G_IO_STATUS_EOF ) { -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } +remove_fd_in_watch (chr);qemu_chr_be_event (chr,CHR_EVENT_CLOSED );return FALSE; }
@@ -862,11 +867,7 @@ static void fd_chr_update_read_handler(CharDriverState *chr) {FDCharDriver *s = chr->opaque; -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } - +remove_fd_in_watch (chr);if (s->fd_in) { chr->fd_in_tag =io_add_watch_poll (s->fd_in, fd_chr_read_poll, fd_chr_read, chr);
@@ -877,11 +878,7 @@ static void fd_chr_close(struct CharDriverState *chr) {FDCharDriver *s = chr->opaque; -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } - +remove_fd_in_watch (chr);if (s->fd_in) {g_io_channel_unref (s->fd_in); }
@@ -1122,10 +1119,7 @@ static void pty_chr_state(CharDriverState *chr, int connected)PtyCharDriver *s = chr->opaque;if (!connected) { -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } +remove_fd_in_watch (chr); s->connected =0 ;/* (re-)connect poll interval for idle guests: once per second. * We check more frequently in case the guests sends data to
@@ -1151,10 +1145,7 @@ static void pty_chr_close(struct CharDriverState *chr)PtyCharDriver *s = chr->opaque;int fd; -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } +remove_fd_in_watch (chr); fd =g_io_channel_unix_get_fd (s->fd);g_io_channel_unref (s->fd);close (fd);
@@ -2216,10 +2207,7 @@ static gboolean udp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque) s->bufcnt = bytes_read; s->bufptr = s->bufcnt;if (status !=G_IO_STATUS_NORMAL ) { -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } +remove_fd_in_watch (chr);return FALSE; }
@@ -2237,11 +2225,7 @@ static void udp_chr_update_read_handler(CharDriverState *chr) {NetCharDriver *s = chr->opaque; -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } - +remove_fd_in_watch (chr);if (s->chan) { chr->fd_in_tag =io_add_watch_poll (s->chan, udp_chr_read_poll, udp_chr_read, chr);
@@ -2251,10 +2235,8 @@ static void udp_chr_update_read_handler(CharDriverState *chr)static void udp_chr_close (CharDriverState *chr) {NetCharDriver *s = chr->opaque; -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } + +remove_fd_in_watch (chr);if (s->chan) {g_io_channel_unref (s->chan);closesocket (s->fd);
@@ -2489,10 +2471,7 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)if (s->listen_chan) { s->listen_tag =g_io_add_watch (s->listen_chan,G_IO_IN , tcp_chr_accept, chr); } -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } +remove_fd_in_watch (chr);g_io_channel_unref (s->chan); s->chan =NULL ;closesocket (s->fd);
@@ -2606,10 +2585,7 @@ static void tcp_chr_close(CharDriverState *chr) {TCPCharDriver *s = chr->opaque;if (s->fd >=0 ) { -if (chr->fd_in_tag) { -io_remove_watch_poll (chr->fd_in_tag); - chr->fd_in_tag =0 ; - } +remove_fd_in_watch (chr);if (s->chan) {g_io_channel_unref (s->chan); }
Signature · 1 line
1.7.9.5
PATCH 3/32 char: remove watch callback on chardev detach from frontend
In reply to Michael RothFrom: Amit Shah <[email protected]>
If a frontend device releases the chardev (via unplug), the chr handlers are set to NULL via qdev's exit callbacks invoking qemu_chr_add_handlers(). If the chardev had a pending operation, a callback will be invoked, which will try to access data in the just-released frontend, causing a segfault.
Ensure the callbacks are disabled when frontends release chardevs.
This was seen when a virtio-serial port was unplugged when heavy guest->host IO was in progress (causing a callback to be registered). In the window in which the throttling was active, unplugging ports caused a qemu segfault.
https://bugzilla.redhat.com/show_bug.cgi?id=985205
--- qemu-char.c | 3 +++ 1 file changed, 3 insertions(+)
qemu-char.c +3 -0
@@ -193,6 +193,8 @@ void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)va_end (ap); } +static void remove_fd_in_watch (CharDriverState *chr); + void qemu_chr_add_handlers(CharDriverState *s, IOCanReadHandler *fd_can_read, IOReadHandler *fd_read,
@@ -203,6 +205,7 @@ void qemu_chr_add_handlers(CharDriverState *s,if (!opaque && !fd_can_read && !fd_read && !fd_event) { fe_open =0 ; +remove_fd_in_watch (s); }else { fe_open =1 ; }
Signature · 1 line
1.7.9.5
PATCH 4/32 tests: Fix schema parser test for in-tree build
In reply to Michael RothFrom: Markus Armbruster <[email protected]>
Commit 4f193e3 added the test, but screwed up in-tree builds (SRCDIR=.): the tests's output overwrites the expected output, and is thus compared to itself.
--- tests/.gitignore | 1 + tests/Makefile | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-)
tests/.gitignore +1 -0
@@ -19,3 +19,4 @@ test-thread-pool test-x86-cpuid test-xbzrle *-test +qapi-schema/*.test.*
tests/Makefile +4 -4
@@ -247,10 +247,10 @@ check-tests/test-qapi.py: tests/test-qapi.py .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json - $(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py <$^ >$*.out 2>$*.err; echo $$? >$*.exit, " TEST $*.out") - @diff -q $(SRC_PATH)/$*.out $*.out - @diff -q $(SRC_PATH)/$*.err $*.err - @diff -q $(SRC_PATH)/$*.exit $*.exit + $(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py <$^ >$*.test.out 2>$*.test.err; echo $$? >$*.test.exit, " TEST $*.out") + @diff -q $(SRC_PATH)/$*.out $*.test.out + @diff -q $(SRC_PATH)/$*.err $*.test.err + @diff -q $(SRC_PATH)/$*.exit $*.test.exit # Consolidated targets
Signature · 1 line
1.7.9.5
PATCH 5/32 tests: Update .gitignore for test-int128 and test-bitops
In reply to Michael RothFrom: Markus Armbruster <[email protected]>
Forgotten in commit 6046c62 and 3464700.
Conflicts:
tests/.gitignore
*removed post-1.6 additions from diff
--- tests/.gitignore | 2 ++ 1 file changed, 2 insertions(+)
tests/.gitignore +2 -0
@@ -5,8 +5,10 @@ check-qjson check-qlist check-qstring test-aio +test-bitops test-cutils test-hbitmap +test-int128 test-iov test-mul64 test-qapi-types.[ch]
Signature · 1 line
1.7.9.5
PATCH 6/32 tci: Add implementation of rotl_i64, rotr_i64
In reply to Michael RothFrom: Stefan Weil <[email protected]>
It is used by qemu-ppc64 when running Debian's busybox-static.
--- tcg/tci/tcg-target.c | 1 - tci.c | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
tcg/tci/tcg-target.c +0 -1
@@ -677,7 +677,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,case INDEX_op_shl_i64:case INDEX_op_shr_i64:case INDEX_op_sar_i64: -/* TODO: Implementation of rotl_i64, rotr_i64 missing in tci.c. */ case INDEX_op_rotl_i64:/* Optional (TCG_TARGET_HAS_rot_i64). */ case INDEX_op_rotr_i64:/* Optional (TCG_TARGET_HAS_rot_i64). */ tcg_out_r (s, args[0 ]);
tci.c +9 -1
@@ -952,8 +952,16 @@ tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)break ;#if TCG_TARGET_HAS_rot_i64case INDEX_op_rotl_i64: + t0 = *tb_ptr++; + t1 =tci_read_ri64 (&tb_ptr); + t2 =tci_read_ri64 (&tb_ptr); +tci_write_reg64 (t0, (t1 << t2) | (t1 >> (64 - t2))); +break ;case INDEX_op_rotr_i64: -TODO (); + t0 = *tb_ptr++; + t1 =tci_read_ri64 (&tb_ptr); + t2 =tci_read_ri64 (&tb_ptr); +tci_write_reg64 (t0, (t1 >> t2) | (t1 << (64 - t2)));break ;#endif #if TCG_TARGET_HAS_deposit_i64
Signature · 1 line
1.7.9.5
PATCH 7/32 bitops: Add rotate functions (rol8, ror8, ...)
In reply to Michael RothFrom: Stefan Weil <[email protected]>
These functions were copies from include/linux/bitopts.h.
--- include/qemu/bitops.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+)
include/qemu/bitops.h +80 -0
@@ -184,6 +184,86 @@ static inline unsigned long hweight_long(unsigned long w) }/** +* rol8 - rotate an 8-bit value left +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint8_t rol8 (uint8_t word,unsigned int shift) +{ +return (word << shift) | (word >> (8 - shift)); +} + +/** +* ror8 - rotate an 8-bit value right +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint8_t ror8 (uint8_t word,unsigned int shift) +{ +return (word >> shift) | (word << (8 - shift)); +} + +/** +* rol16 - rotate a 16-bit value left +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint16_t rol16 (uint16_t word,unsigned int shift) +{ +return (word << shift) | (word >> (16 - shift)); +} + +/** +* ror16 - rotate a 16-bit value right +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint16_t ror16 (uint16_t word,unsigned int shift) +{ +return (word >> shift) | (word << (16 - shift)); +} + +/** +* rol32 - rotate a 32-bit value left +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint32_t rol32 (uint32_t word,unsigned int shift) +{ +return (word << shift) | (word >> (32 - shift)); +} + +/** +* ror32 - rotate a 32-bit value right +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint32_t ror32 (uint32_t word,unsigned int shift) +{ +return (word >> shift) | (word << (32 - shift)); +} + +/** +* rol64 - rotate a 64-bit value left +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint64_t rol64 (uint64_t word,unsigned int shift) +{ +return (word << shift) | (word >> (64 - shift)); +} + +/** +* ror64 - rotate a 64-bit value right +* @word: value to rotate +* @shift: bits to roll +*/ +static inline uint64_t ror64 (uint64_t word,unsigned int shift) +{ +return (word >> shift) | (word << (64 - shift)); +} + +/** * extract32: * @value: the value to extract the bit field from * @start: the lowest bit in the bit field (numbered from 0)
Signature · 1 line
1.7.9.5
PATCH 8/32 misc: Use new rotate functions
In reply to Michael RothFrom: Stefan Weil <[email protected]>
--- target-arm/iwmmxt_helper.c | 2 +- tcg/optimize.c | 12 ++++-------- tci.c | 8 ++++---- 3 files changed, 9 insertions(+), 13 deletions(-)
target-arm/iwmmxt_helper.c +1 -1
@@ -577,7 +577,7 @@ uint64_t HELPER(iwmmxt_rorl)(CPUARMState *env, uint64_t x, uint32_t n)uint64_t HELPER (iwmmxt_rorq )(CPUARMState *env,uint64_t x,uint32_t n) { - x = (x >> n) | (x << (64 - n)); + x =ror64 (x, n); env->iwmmxt.cregs[ARM_IWMMXT_wCASF] =NZBIT64 (x);return x; }
tcg/optimize.c +4 -8
@@ -236,20 +236,16 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y)return (int64_t )x >> (int64_t )y;case INDEX_op_rotr_i32: - x = ((uint32_t )x << (32 - y)) | ((uint32_t )x >> y); -return x; +return ror32 (x, y);case INDEX_op_rotr_i64: - x = ((uint64_t )x << (64 - y)) | ((uint64_t )x >> y); -return x; +return ror64 (x, y);case INDEX_op_rotl_i32: - x = ((uint32_t )x << y) | ((uint32_t )x >> (32 - y)); -return x; +return rol32 (x, y);case INDEX_op_rotl_i64: - x = ((uint64_t )x << y) | ((uint64_t )x >> (64 - y)); -return x; +return rol64 (x, y); CASE_OP_32_64(not):return ~x;
tci.c +4 -4
@@ -688,13 +688,13 @@ tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr) t0 = *tb_ptr++; t1 =tci_read_ri32 (&tb_ptr); t2 =tci_read_ri32 (&tb_ptr); -tci_write_reg32 (t0, (t1 << t2) | (t1 >> (32 - t2))); +tci_write_reg32 (t0,rol32 (t1, t2));break ;case INDEX_op_rotr_i32: t0 = *tb_ptr++; t1 =tci_read_ri32 (&tb_ptr); t2 =tci_read_ri32 (&tb_ptr); -tci_write_reg32 (t0, (t1 >> t2) | (t1 << (32 - t2))); +tci_write_reg32 (t0,ror32 (t1, t2));break ;#endif #if TCG_TARGET_HAS_deposit_i32
@@ -955,13 +955,13 @@ tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr) t0 = *tb_ptr++; t1 =tci_read_ri64 (&tb_ptr); t2 =tci_read_ri64 (&tb_ptr); -tci_write_reg64 (t0, (t1 << t2) | (t1 >> (64 - t2))); +tci_write_reg64 (t0,rol64 (t1, t2));break ;case INDEX_op_rotr_i64: t0 = *tb_ptr++; t1 =tci_read_ri64 (&tb_ptr); t2 =tci_read_ri64 (&tb_ptr); -tci_write_reg64 (t0, (t1 >> t2) | (t1 << (64 - t2))); +tci_write_reg64 (t0,ror64 (t1, t2));break ;#endif #if TCG_TARGET_HAS_deposit_i64
Signature · 1 line
1.7.9.5
PATCH 9/32 qemu-char: Fix potential out of bounds access to local arrays
In reply to Michael RothFrom: Stefan Weil <[email protected]>
Latest gcc-4.8 supports a new option -fsanitize=address which activates an AddressSanitizer. This AddressSanitizer stops the QEMU system emulation very early because two character arrays of size 8 are potentially written with 9 bytes.
Commit 6ea314d91439741e95772dfbab98b4135e04bebb added the code.
There is no obvious reason why width or height could need 8 characters, so reduce it to 7 characters which together with the terminating '\0' fit into the arrays.
--- qemu-char.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qemu-char.c +2 -2
@@ -2969,11 +2969,11 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)if (strstart (filename,"vc" , &p)) {qemu_opt_set (opts,"backend" ,"vc" );if (*p ==':' ) { -if (sscanf (p+1 ,"%8[0-9]x%8[0-9]" , width, height) ==2 ) { +if (sscanf (p+1 ,"%7[0-9]x%7[0-9]" , width, height) ==2 ) {/* pixels */ qemu_opt_set (opts,"width" , width);qemu_opt_set (opts,"height" , height); - }else if (sscanf (p+1 ,"%8[0-9]Cx%8[0-9]C" , width, height) ==2 ) { + }else if (sscanf (p+1 ,"%7[0-9]Cx%7[0-9]C" , width, height) ==2 ) {/* chars */ qemu_opt_set (opts,"cols" , width);qemu_opt_set (opts,"rows" , height);
Signature · 1 line
1.7.9.5
PATCH 10/32 xen_disk: mark ioreq as mapped before unmapping in error case
In reply to Michael RothFrom: Matthew Daley <[email protected]>
Commit 4472beae modified the semantics of ioreq_{un,}map so that they are idempotent if called when they're not needed (ie., twice in a row). However, it neglected to handle the case where batch mapping is not being used (the default), and one of the grants fails to map. In this case, ioreq_unmap will be called to unwind and unmap any mappings already performed, but ioreq_unmap simply returns due to the aforementioned change (the ioreq has not already been marked as mapped).
The frontend user can therefore force xen_disk to leak grant mappings, a per-domain limited resource.
Fix by marking the ioreq as mapped before calling ioreq_unmap in this situation.
--- hw/block/xen_disk.c | 1 + 1 file changed, 1 insertion(+)
hw/block/xen_disk.c +1 -0
@@ -405,6 +405,7 @@ static int ioreq_map(struct ioreq *ioreq)xen_be_printf (&ioreq->blkdev->xendev,0 ,"can't map grant ref %d (%s, %d maps)\n" , refs[i],strerror (errno), ioreq->blkdev->cnt_map); + ioreq->mapped =1 ;ioreq_unmap (ioreq);return -1 ; }
Signature · 1 line
1.7.9.5
PATCH 11/32 vmdk: Fix vmdk_parse_extents
In reply to Michael RothFrom: Fam Zheng <[email protected]>
An extra 'p++' after while loop when *p == '\n' will move p to unknown data position, risking parsing junk data or memory access violation.
--- block/vmdk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
block/vmdk.c +5 -2
@@ -755,10 +755,13 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, } next_line:/* move to next line */ -while (*p && *p !='\n' ) { +while (*p) { +if (*p =='\n' ) { + p++; +break ; + } p++; } - p++; }return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 12/32 audio: honor QEMU_AUDIO_TIMER_PERIOD instead of waking up every *nano* second
In reply to Michael RothFrom: Hans de Goede <[email protected]>
Now that we no longer have MIN_REARM_TIMER_NS a bug in the audio subsys has clearly shown it self by trying to make a timer fire every nano second.
Note we have a similar problem in 1.6, 1.5 and older but there MIN_REARM_TIMER_NS limits the wakeups caused by audio being active to 4000 times / second. This still causes a host cpu load of 50 % for simply playing audio, where as with this patch git master is at 13%, so we should backport this to 1.5 and 1.6 too.
Note this will not apply to 1.5 and 1.6 as is.
Conflicts:
audio/audio.c
*fixed to reflect 1.6 timer function/clock names
--- audio/audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
audio/audio.c +2 -1
@@ -1124,7 +1124,8 @@ static int audio_is_timer_needed (void)static void audio_reset_timer (AudioState *s) {if (audio_is_timer_needed ()) { -qemu_mod_timer (s->ts,qemu_get_clock_ns (vm_clock) +1 ); +qemu_mod_timer (s->ts, +qemu_get_clock_ns (vm_clock) + conf.period.ticks); }else {qemu_del_timer (s->ts);
Signature · 1 line
1.7.9.5
PATCH 13/32 monitor: eliminate monitor_event_state_lock
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
This lock does not protect anything that the BQL does not already protect. Furthermore, with -nodefaults and no monitor, the mutex is not initialized but monitor_protocol_event_queue is called anyway, which causes a crash under mingw (and only works by luck. under Linux or other POSIX OSes).
--- monitor.c | 6 ------ 1 file changed, 6 deletions(-)
monitor.c +0 -6
@@ -508,7 +508,6 @@ static const char *monitor_event_names[] = { QEMU_BUILD_BUG_ON(ARRAY_SIZE(monitor_event_names) != QEVENT_MAX)MonitorEventState monitor_event_state[QEVENT_MAX ]; -QemuMutex monitor_event_state_lock;/* * Emits the event to every monitor instance
@@ -540,7 +539,6 @@ monitor_protocol_event_queue(MonitorEvent event,int64_t now =qemu_get_clock_ns (rt_clock);assert (event <QEVENT_MAX ); -qemu_mutex_lock (&monitor_event_state_lock); evstate = &(monitor_event_state[event]); trace_monitor_protocol_event_queue(event, data,
@@ -573,7 +571,6 @@ monitor_protocol_event_queue(MonitorEvent event, evstate->last = now; } } -qemu_mutex_unlock (&monitor_event_state_lock); }
@@ -586,7 +583,6 @@ static void monitor_protocol_event_handler(void *opaque)MonitorEventState *evstate = opaque;int64_t now =qemu_get_clock_ns (rt_clock); -qemu_mutex_lock (&monitor_event_state_lock); trace_monitor_protocol_event_handler(evstate->event, evstate->data,
@@ -598,7 +594,6 @@ static void monitor_protocol_event_handler(void *opaque) evstate->data =NULL ; } evstate->last = now; -qemu_mutex_unlock (&monitor_event_state_lock); }
@@ -635,7 +630,6 @@ monitor_protocol_event_throttle(MonitorEvent event,* and initialize state */ static void monitor_protocol_event_init (void ) { -qemu_mutex_init (&monitor_event_state_lock);/* Limit RTC & BALLOON events to 1 per second */ monitor_protocol_event_throttle (QEVENT_RTC_CHANGE ,1000 );monitor_protocol_event_throttle (QEVENT_BALLOON_CHANGE ,1000 );
Signature · 1 line
1.7.9.5
PATCH 14/32 memory: fix 128 arithmetic in info mtree
In reply to Michael RothFrom: Alexey Kardashevskiy <[email protected]>
mtree_print_mr() calls int128_get64() in 3 places but only 2 places handle 2^64 correctly.
This fixes the third call of int128_get64().
--- memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
memory.c +3 -1
@@ -1809,7 +1809,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, mr->alias->name, mr->alias_offset, mr->alias_offset - + (hwaddr)int128_get64(mr->size) - 1); + + (int128_nz (mr->size) ? + (hwaddr )int128_get64 (int128_sub (mr->size, + int128_one())) : 0)); }else { mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n",
Signature · 1 line
1.7.9.5
PATCH 15/32 Adjust qapi-visit for python-2.4.3
In reply to Michael RothFrom: Richard Henderson <[email protected]>
We say we support python 2.4, but python 2.4.3 does not support the "expr if test else expr" syntax used here.
This allows QEMU to compile on RHEL 5.3, the last release for ia64.
--- scripts/qapi-visit.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
scripts/qapi-visit.py +14 -3
@@ -20,7 +20,10 @@ import errno def generate_visit_struct_fields(name, field_prefix, fn_prefix, members): substructs = [] ret = '' - full_name = name if not fn_prefix else "%s_%s" % (name, fn_prefix) + if not fn_prefix: + full_name = name + else: + full_name = "%s_%s" % (name, fn_prefix) for argname, argentry, optional, structured in parse_args(members): if structured:
@@ -84,7 +87,10 @@ if (!error_is_set(errp)) { ''') push_indent() - full_name = name if not field_prefix else "%s_%s" % (field_prefix, name) + if not field_prefix: + full_name = name + else: + full_name = "%s_%s" % (field_prefix, name) if len(field_prefix): ret += mcgen('''
@@ -265,12 +271,17 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error ** name=name) pop_indent() + + if not discriminator: + desc_type = "type" + else: + desc_type = discriminator ret += mcgen(''' visit_type_%(name)sKind(m, &(*obj)->kind, "%(type)s", &err); if (!err) { switch ((*obj)->kind) { ''', - name=name, type="type" if not discriminator else discriminator) + name=name, type=desc_type) for key in members: if not discriminator:
Signature · 1 line
1.7.9.5
PATCH 16/32 configure: detect endian via compile test
In reply to Michael RothFrom: Mike Frysinger <[email protected]>
This avoids needing to execute a program and keeping an (incomplete) list when cross-compiling.
Message-id: [email protected]
--- configure | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-)
configure +14 -26
@@ -1394,39 +1394,27 @@ feature_not_found() { "configure was not able to find it" } -if test -z "$cross_prefix" ; then - # --- # big/little endian test cat > $TMPC << EOF -#include <inttypes.h> -int main(void) { - volatile uint32_t i=0x01234567; - return (*((uint8_t*)(&i))) == 0x67; +short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, }; +short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, }; +extern int foo(short *, short *); +int main(int argc, char *argv[]) { + return foo(big_endian, little_endian); } EOF -if compile_prog "" "" ; then -$TMPE && bigendian="yes" -else -echo big/little test failed -fi - -else - -# if cross compiling, cannot launch a program, so make a static guess -case "$cpu" in - arm) - # ARM can be either way; ask the compiler which one we are - if check_define __ARMEB__; then - bigendian=yes +if compile_object ; then + if grep -q BiGeNdIaN $TMPO ; then + bigendian="yes" + elif grep -q LiTtLeEnDiAn $TMPO ; then + bigendian="no" + else + echo big/little test failed fi - ;; - hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64) - bigendian=yes - ;; -esac - +else + echo big/little test failed fi ##########################################
Signature · 1 line
1.7.9.5
PATCH 17/32 qapi: fix memleak by adding implict struct functions in dealloc visitor
In reply to Michael RothFrom: Wenchao Xia <[email protected]>
Otherwise member "base" is leaked in a qapi_free_STRUCTURE() call.
Message-id: [email protected]
--- qapi/qapi-dealloc-visitor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
qapi/qapi-dealloc-visitor.c +20 -0
@@ -76,6 +76,24 @@ static void qapi_dealloc_end_struct(Visitor *v, Error **errp) } } +static void qapi_dealloc_start_implicit_struct (Visitor *v, +void **obj, +size_t size, +Error **errp) +{ +QapiDeallocVisitor *qov =to_qov (v); +qapi_dealloc_push (qov, obj); +} + +static void qapi_dealloc_end_implicit_struct (Visitor *v,Error **errp) +{ +QapiDeallocVisitor *qov =to_qov (v); +void **obj =qapi_dealloc_pop (qov); +if (obj) { +g_free (*obj); + } +} +static void qapi_dealloc_start_list (Visitor *v,const char *name,Error **errp) {QapiDeallocVisitor *qov =to_qov (v);
@@ -162,6 +180,8 @@ QapiDeallocVisitor *qapi_dealloc_visitor_new(void) v->visitor.start_struct = qapi_dealloc_start_struct; v->visitor.end_struct = qapi_dealloc_end_struct; + v->visitor.start_implicit_struct = qapi_dealloc_start_implicit_struct; + v->visitor.end_implicit_struct = qapi_dealloc_end_implicit_struct; v->visitor.start_list = qapi_dealloc_start_list; v->visitor.next_list = qapi_dealloc_next_list; v->visitor.end_list = qapi_dealloc_end_list;
Signature · 1 line
1.7.9.5
PATCH 18/32 tests: fix memleak in error path test for input visitor
In reply to Michael RothFrom: Wenchao Xia <[email protected]>
Message-id: [email protected]
--- tests/test-qmp-input-visitor.c | 1 + 1 file changed, 1 insertion(+)
tests/test-qmp-input-visitor.c +1 -0
@@ -604,6 +604,7 @@ static void test_visitor_in_errors(TestInputVisitorData *data,g_assert (error_is_set (&errp));g_assert (p->string ==NULL ); +error_free (errp);g_free (p->string);g_free (p); }
Signature · 1 line
1.7.9.5
PATCH 19/32 configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0
In reply to Michael RothFrom: Peter Maydell <[email protected]>
Our rules.mak adds '-rR' to MAKEFLAGS to indicate that we will be explicitly specifying everything and not relying on any default variables or rules. However we were accidentally relying on the default ARFLAGS ("rv"). This went unnoticed because of a bug in GNU Make 3.82 and earlier which meant that adding -rR to MAKEFLAGS only affected submakes, not the currently running instance. Explicitly set ARFLAGS in config-host.mak, in the same way we handle CFLAGS and LDFLAGS; this will allow us to work with Make 4.0.
Thanks to Paul Smith for analyzing this bug for us.
--- configure | 5 +++++ 1 file changed, 5 insertions(+)
configure +5 -0
@@ -298,6 +298,9 @@ query_pkg_config() { pkg_config=query_pkg_config sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}" +# If the user hasn't specified ARFLAGS, default to 'rv', just as make does. +ARFLAGS="${ARFLAGS-rv}" + # default flags for all hosts QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
@@ -3529,6 +3532,7 @@ echo "Source path $source_path" echo "C compiler $cc" echo "Host C compiler $host_cc" echo "Objective-C compiler $objcc" +echo "ARFLAGS $ARFLAGS" echo "CFLAGS $CFLAGS" echo "QEMU_CFLAGS $QEMU_CFLAGS" echo "LDFLAGS $LDFLAGS"
@@ -4117,6 +4121,7 @@ echo "CC_I386=$cc_i386" >> $config_host_mak echo "HOST_CC=$host_cc" >> $config_host_mak echo "OBJCC=$objcc" >> $config_host_mak echo "AR=$ar" >> $config_host_mak +echo "ARFLAGS=$ARFLAGS" >> $config_host_mak echo "AS=$as" >> $config_host_mak echo "CPP=$cpp" >> $config_host_mak echo "OBJCOPY=$objcopy" >> $config_host_mak
Signature · 1 line
1.7.9.5
PATCH 20/32 linux-user: Fix stat64 syscall for SPARC64
In reply to Michael RothFrom: Stefan Weil <[email protected]>
Some targets use a stat64 structure for the stat64 syscall while others use a stat structure. SPARC64 used the wrong kind.
Instead of extending the conditional compilation in syscall.c, now a macro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a target_stat64.
--- linux-user/syscall.c | 6 +++--- linux-user/syscall_defs.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-)
linux-user/syscall.c +3 -3
@@ -4764,10 +4764,10 @@ static inline abi_long host_to_target_stat64(void *cpu_env, } else#endif { -#if TARGET_ABI_BITS ==64 && !defined(TARGET_ALPHA ) -struct target_stat *target_st; -#else +#if defined(TARGET_HAS_STRUCT_STAT64 )struct target_stat64 *target_st; +#else +struct target_stat *target_st;#endif if (!lock_user_struct (VERIFY_WRITE , target_st, target_addr,0 ))
linux-user/syscall_defs.h +14 -0
@@ -1165,6 +1165,7 @@ struct target_stat {/* This matches struct stat64 in glibc2.1, hence the absolutely * insane amounts of padding around dev_t's. */ +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned short st_dev;unsigned char __pad0[10 ];
@@ -1200,6 +1201,7 @@ struct target_stat64 { }QEMU_PACKED ; #ifdef TARGET_ARM +#define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { unsigned long long st_dev; unsigned int __pad1;
@@ -1249,6 +1251,7 @@ struct target_stat {abi_ulong __unused4[2 ]; }; +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned char __pad0[6 ];unsigned short st_dev;
@@ -1304,6 +1307,7 @@ struct target_stat {abi_ulong __unused4[2 ]; }; +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned char __pad0[6 ];unsigned short st_dev;
@@ -1371,6 +1375,8 @@ struct target_stat {#endif }; +#if !defined(TARGET_PPC64 ) || defined(TARGET_ABI32 ) +#define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 {unsigned long long st_dev;unsigned long long st_ino;
@@ -1393,6 +1399,7 @@ struct QEMU_PACKED target_stat64 {unsigned int __unused4; unsigned int __unused5; }; +#endif #elif defined(TARGET_MICROBLAZE)
@@ -1418,6 +1425,7 @@ struct target_stat { };/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ +#define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 {uint64_t st_dev;#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
@@ -1473,6 +1481,7 @@ struct target_stat {/* This matches struct stat64 in glibc2.1, hence the absolutely * insane amounts of padding around dev_t's. */ +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned long long st_dev;unsigned char __pad1[2 ];
@@ -1581,6 +1590,7 @@ struct target_stat {* struct stat of the 64-bit kernel. */ +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {unsigned int st_dev;unsigned int st_pad0[3 ];/* Reserved for st_dev expansion */
@@ -1652,6 +1662,7 @@ struct target_stat {* struct stat of the 64-bit kernel. */ +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {abi_ulong st_dev;abi_ulong st_pad0[3 ];/* Reserved for st_dev expansion */
@@ -1708,6 +1719,7 @@ struct target_stat {unsigned int st_gen; }; +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {abi_ulong st_dev;abi_ulong st_ino;
@@ -1757,6 +1769,7 @@ struct target_stat {/* This matches struct stat64 in glibc2.1, hence the absolutely * insane amounts of padding around dev_t's. */ +#define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 {unsigned long long st_dev;unsigned char __pad0[4 ];
@@ -1862,6 +1875,7 @@ struct target_stat {unsigned int __unused5; }; +#define TARGET_HAS_STRUCT_STAT64 struct target_stat64 {uint64_t st_dev;uint64_t st_ino;
Signature · 1 line
1.7.9.5
PATCH 21/32 virtio-net: only delete bh that existed
In reply to Michael RothFrom: Jason Wang <[email protected]>
We delete without check whether it existed during exit. This will lead NULL pointer deference since it was created conditionally depends on guest driver status and features. So add a check of existence before trying to delete it.
Message-id: [email protected]
Conflicts:
hw/net/virtio-net.c
*modified to reflect timer function names for 1.6
--- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/virtio-net.c +1 -1
@@ -1600,7 +1600,7 @@ static int virtio_net_device_exit(DeviceState *qdev)if (q->tx_timer) {qemu_del_timer (q->tx_timer);qemu_free_timer (q->tx_timer); - }else { + }else if (q->tx_bh) {qemu_bh_delete (q->tx_bh); } }
Signature · 1 line
1.7.9.5
PATCH 22/32 exec: fix breakpoint_invalidate when pc may not be translated
In reply to Michael RothFrom: Max Filippov <[email protected]>
This fixes qemu abort with the following message:
include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.
which happens due to attempt to invalidate breakpoint by virtual address for which get_phys_page_debug couldn't find mapping.
For more details see
http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg04582.html
--- exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
exec.c +4 -2
@@ -425,8 +425,10 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)#else static void breakpoint_invalidate (CPUState *cpu,target_ulong pc) { -tb_invalidate_phys_addr (cpu_get_phys_page_debug (cpu, pc) | - (pc & ~TARGET_PAGE_MASK )); +hwaddr phys =cpu_get_phys_page_debug (cpu, pc); +if (phys !=-1 ) { +tb_invalidate_phys_addr (phys | (pc & ~TARGET_PAGE_MASK )); + } }#endif #endif /* TARGET_HAS_ICE */
Signature · 1 line
1.7.9.5
PATCH 23/32 Fix pc migration from qemu <= 1.5
In reply to Michael RothFrom: Cole Robinson <[email protected]>
The following commit introduced a migration incompatibility:
commit 568f0690fd9aa4d39d84b04c1a5dbb53a915c3fe
Author: David Gibson <[email protected]> Date: Thu Jun 6 18:48:49 2013 +1000
pci: Replace pci_find_domain() with more general pci_root_bus_path()
The issue is that i440fx savevm idstr went from 0000:00:00.0/I440FX to 0000:00.0/I440FX. Unfortunately we are stuck with the breakage for 1.6 machine types.
Add a compat property to maintain the busted idstr for the 1.6 machine types, but revert to the old style format for 1.7+, and <= 1.5.
Tested with migration from qemu 1.5, qemu 1.6, and qemu.git.
Conflicts:
include/hw/i386/pc.h
*removed 1.6 compat properties
--- hw/pci-host/piix.c | 9 ++++++++- hw/pci-host/q35.c | 10 ++++++++-- include/hw/i386/pc.h | 8 ++++++++ include/hw/pci-host/q35.h | 1 + 4 files changed, 25 insertions(+), 3 deletions(-)
hw/pci-host/piix.c +8 -1
@@ -48,6 +48,7 @@ typedef struct I440FXState {PCIHostState parent_obj;PcPciInfo pci_info;uint64_t pci_hole64_size; +uint32_t short_root_bus; } I440FXState;#define PIIX_NUM_PIC_IRQS 16/* i8259 * 2 */
@@ -706,13 +707,19 @@ static const TypeInfo i440fx_info = {static const char *i440fx_pcihost_root_bus_path (PCIHostState *host_bridge,PCIBus *rootbus) { +I440FXState *s =I440FX_PCI_HOST_BRIDGE (host_bridge); +/* For backwards compat with old device paths */ -return "0000" ; +if (s->short_root_bus) { +return "0000" ; + } +return "0000:00" ; }static Property i440fx_props[] = {DEFINE_PROP_SIZE (PCI_HOST_PROP_PCI_HOLE64_SIZE , I440FXState, pci_hole64_size,DEFAULT_PCI_HOLE64_SIZE ), +DEFINE_PROP_UINT32 ("short_root_bus" , I440FXState, short_root_bus,0 ),DEFINE_PROP_END_OF_LIST (), };
hw/pci-host/q35.c +8 -2
@@ -61,8 +61,13 @@ static void q35_host_realize(DeviceState *dev, Error **errp)static const char *q35_host_root_bus_path (PCIHostState *host_bridge,PCIBus *rootbus) { -/* For backwards compat with old device paths */ -return "0000" ; +Q35PCIHost *s =Q35_HOST_DEVICE (host_bridge); + +/* For backwards compat with old device paths */ +if (s->mch.short_root_bus) { +return "0000" ; + } +return "0000:00" ; } static void q35_host_get_pci_hole_start(Object *obj, Visitor *v,
@@ -108,6 +113,7 @@ static Property mch_props[] = { MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT),DEFINE_PROP_SIZE (PCI_HOST_PROP_PCI_HOLE64_SIZE , Q35PCIHost, mch.pci_hole64_size,DEFAULT_PCI_HOLE64_SIZE ), +DEFINE_PROP_UINT32 ("short_root_bus" , Q35PCIHost, mch.short_root_bus,0 ), DEFINE_PROP_END_OF_LIST(), };
include/hw/i386/pc.h +8 -0
@@ -258,6 +258,14 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); .driver = TYPE_X86_CPU,\ .property = "pmu",\ .value = "on",\ + },{\ + .driver = "i440FX-pcihost",\ + .property = "short_root_bus",\ + .value = stringify(0),\ + },{\ + .driver = "q35-pcihost",\ + .property = "short_root_bus",\ + .value = stringify(0),\ }#define PC_COMPAT_1_4 \
include/hw/pci-host/q35.h +1 -0
@@ -61,6 +61,7 @@ typedef struct MCHPCIState {ram_addr_t above_4g_mem_size;uint64_t pci_hole64_size;PcGuestInfo *guest_info; +uint32_t short_root_bus; } MCHPCIState; typedef struct Q35PCIHost {
Signature · 1 line
1.7.9.5
PATCH 24/32 qcow2: count_contiguous_clusters and compression
In reply to Michael RothFrom: Max Reitz <[email protected]>
The function is not intended to be used on compressed clusters and will not work correctly, if used anyway, since L2E_OFFSET_MASK is not the right mask for determining the offset of compressed clusters. Therefore, assert that the first cluster is not compressed and always include the compression flag in the mask of significant flags, i.e., stop the search as soon as a compressed cluster occurs.
--- block/qcow2-cluster.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
block/qcow2-cluster.c +5 -2
@@ -266,12 +266,15 @@ static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t start, uint64_t stop_flags) { int i; -uint64_t mask = stop_flags |L2E_OFFSET_MASK ; -uint64_t offset =be64_to_cpu (l2_table[0 ]) & mask; +uint64_t mask = stop_flags |L2E_OFFSET_MASK |QCOW2_CLUSTER_COMPRESSED ; +uint64_t first_entry =be64_to_cpu (l2_table[0 ]); +uint64_t offset = first_entry & mask;if (!offset)return 0 ; +assert (qcow2_get_cluster_type (first_entry) !=QCOW2_CLUSTER_COMPRESSED ); +for (i = start; i < start + nb_clusters; i++) {uint64_t l2_entry =be64_to_cpu (l2_table[i]) & mask;if (offset + (uint64_t ) i * cluster_size != l2_entry) {
Signature · 1 line
1.7.9.5
PATCH 25/32 qcow2: fix possible corruption when reading multiple clusters
In reply to Michael RothFrom: Peter Lieven <[email protected]>
if multiple sectors spanning multiple clusters are read the function count_contiguous_clusters should ensure that the cluster type should not change between the clusters.
Especially the for-loop should break when we have one or more normal clusters followed by a compressed cluster.
Unfortunately the wrong macro was used in the mask to compare the flags.
This was discovered while debugging a data corruption issue when converting a compressed qcow2 image to raw. qemu-img reads 2MB chunks which span multiple clusters.
--- block/qcow2-cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/qcow2-cluster.c +1 -1
@@ -266,7 +266,7 @@ static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t start, uint64_t stop_flags) { int i; -uint64_t mask = stop_flags |L2E_OFFSET_MASK |QCOW2_CLUSTER_COMPRESSED ; +uint64_t mask = stop_flags |L2E_OFFSET_MASK |QCOW_OFLAG_COMPRESSED ;uint64_t first_entry =be64_to_cpu (l2_table[0 ]);uint64_t offset = first_entry & mask;
Signature · 1 line
1.7.9.5
PATCH 26/32 vfio-pci: Fix multifunction=on
In reply to Michael RothFrom: Alex Williamson <[email protected]>
When an assigned device is initialized it copies the device config space into the emulated config space. Unfortunately multifunction is setup prior to the device initfn and gets clobbered. We need to restore it just like pci-assign does.
--- hw/misc/vfio.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/misc/vfio.c +7 -0
@@ -3142,6 +3142,13 @@ static int vfio_initfn(PCIDevice *pdev) vdev->emulated_config_bits[PCI_HEADER_TYPE ] =PCI_HEADER_TYPE_MULTI_FUNCTION ; +/* Restore or clear multifunction, this is always controlled by QEMU */ +if (vdev->pdev.cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { + vdev->pdev.config[PCI_HEADER_TYPE ] |=PCI_HEADER_TYPE_MULTI_FUNCTION ; + }else { + vdev->pdev.config[PCI_HEADER_TYPE ] &= ~PCI_HEADER_TYPE_MULTI_FUNCTION ; + } +/* * Clear host resource mapping info. If we choose not to register a * BAR, such as might be the case with the option ROM, we can get
Signature · 1 line
1.7.9.5
PATCH 27/32 virtio-net: fix the memory leak in rxfilter_notify()
In reply to Michael RothFrom: Amos Kong <[email protected]>
object_get_canonical_path() returns a gchar*, it should be freed by the caller.
--- hw/net/virtio-net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/virtio-net.c +4 -4
@@ -200,16 +200,16 @@ static void rxfilter_notify(NetClientState *nc)VirtIONet *n =qemu_get_nic_opaque (nc);if (nc->rxfilter_notify_enabled) { +gchar *path =object_get_canonical_path (OBJECT (n->qdev));if (n->netclient_name) { event_data =qobject_from_jsonf ("{ 'name': %s, 'path': %s }" , - n->netclient_name, -object_get_canonical_path (OBJECT (n->qdev))); + n->netclient_name, path); }else { - event_data =qobject_from_jsonf ("{ 'path': %s }" , -object_get_canonical_path (OBJECT (n->qdev))); + event_data =qobject_from_jsonf ("{ 'path': %s }" , path); }monitor_protocol_event (QEVENT_NIC_RX_FILTER_CHANGED , event_data);qobject_decref (event_data); +g_free (path);/* disable event notification to avoid events flooding */ nc->rxfilter_notify_enabled =0 ;
Signature · 1 line
1.7.9.5
PATCH 28/32 qom: Fix memory leak in object_property_set_link()
In reply to Michael RothFrom: Vlad Yasevich <[email protected]>
Save the result of the call to object_get_canonical_path() so we can free it.
--- qom/object.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
qom/object.c +3 -2
@@ -823,8 +823,9 @@ char *object_property_get_str(Object *obj, const char *name,void object_property_set_link (Object *obj,Object *value,const char *name,Error **errp) { -object_property_set_str (obj,object_get_canonical_path (value), - name, errp); +gchar *path =object_get_canonical_path (value); +object_property_set_str (obj, path, name, errp); +g_free (path); } Object *object_property_get_link(Object *obj, const char *name,
Signature · 1 line
1.7.9.5
PATCH 29/32 qdev-monitor: Fix crash when device_add is called with abstract driver
In reply to Michael RothFrom: Igor Mammedov <[email protected]>
User is able to crash running QEMU when following monitor command is called:
device_add intel-hda-generic
Crash is caused by assertion in object_initialize_with_type() when type is abstract.
Checking if type is abstract before instance is created in qdev_device_add() allows to prevent crash on incorrect user input.
Conflicts:
qdev-monitor.c
*updated to reflect different 1.6 variable names
--- qdev-monitor.c | 6 ++++++ 1 file changed, 6 insertions(+)
qdev-monitor.c +6 -0
@@ -472,6 +472,12 @@ DeviceState *qdev_device_add(QemuOpts *opts)return NULL ; } +if (object_class_is_abstract (obj)) { +qerror_report (QERR_INVALID_PARAMETER_VALUE ,"driver" , +"non-abstract device type" ); +return NULL ; + } + k =DEVICE_CLASS (obj);/* find bus */
Signature · 1 line
1.7.9.5
PATCH 30/32 qdev-monitor: Unref device when device_add fails
In reply to Michael RothFrom: Stefan Hajnoczi <[email protected]>
qdev_device_add() leaks the created device upon failure. I suspect this problem crept in because qdev_free() unparents the device but does not drop a reference - confusing name.
--- qdev-monitor.c | 2 ++ 1 file changed, 2 insertions(+)
qdev-monitor.c +2 -0
@@ -518,6 +518,7 @@ DeviceState *qdev_device_add(QemuOpts *opts) }if (qemu_opt_foreach (opts, set_property, qdev,1 ) !=0 ) {qdev_free (qdev); +object_unref (OBJECT (qdev));return NULL ; }if (qdev->id) {
@@ -531,6 +532,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)g_free (name); }if (qdev_init (qdev) <0 ) { +object_unref (OBJECT (qdev));qerror_report (QERR_DEVICE_INIT_FAILED , driver);return NULL ; }
Signature · 1 line
1.7.9.5
PATCH 31/32 pci: unregister vmstate_pcibus on unplug
In reply to Michael RothFrom: Bandan Das <[email protected]>
PCIBus registers a vmstate during init. Unregister it upon removal/unplug.
--- hw/pci/pci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/pci/pci.c +8 -0
@@ -47,6 +47,7 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);static char *pcibus_get_dev_path (DeviceState *dev);static char *pcibus_get_fw_dev_path (DeviceState *dev);static int pcibus_reset (BusState *qbus); +static void pci_bus_finalize (Object *obj);static Property pci_props[] = {DEFINE_PROP_PCI_DEVFN ("addr" , PCIDevice, devfn,-1 ),
@@ -73,6 +74,7 @@ static const TypeInfo pci_bus_info = { .name = TYPE_PCI_BUS, .parent = TYPE_BUS, .instance_size = sizeof(PCIBus), + .instance_finalize = pci_bus_finalize, .class_init = pci_bus_class_init, };
@@ -375,6 +377,12 @@ int pci_bus_num(PCIBus *s)return s->parent_dev->config[PCI_SECONDARY_BUS ]; } +static void pci_bus_finalize (Object *obj) +{ +PCIBus *bus =PCI_BUS (obj); +vmstate_unregister (NULL , &vmstate_pcibus, bus); +} +static int get_pci_config_device (QEMUFile *f,void *pv,size_t size) {PCIDevice *s =container_of (pv, PCIDevice, config);
Signature · 1 line
1.7.9.5
PATCH 32/32 rng-egd: offset the point when repeatedly read from the buffer
In reply to Michael RothFrom: Amos Kong <[email protected]>
The buffer content might be read out more than once, currently we just repeatedly read the first data block, buffer offset is missing.
Message-id: [email protected]
--- backends/rng-egd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
backends/rng-egd.c +3 -1
@@ -91,12 +91,14 @@ static int rng_egd_chr_can_read(void *opaque)static void rng_egd_chr_read (void *opaque,const uint8_t *buf,int size) {RngEgd *s =RNG_EGD (opaque); +size_t buf_offset =0 ;while (size >0 && s->requests) {RngRequest *req = s->requests->data;int len =MIN (size, req->size - req->offset); -memcpy (req->data + req->offset, buf, len); +memcpy (req->data + req->offset, buf + buf_offset, len); + buf_offset += len; req->offset += len; size -= len;
Signature · 1 line
1.7.9.5
Il 04/12/2013 15:34, Michael Roth ha scritto:
Quoted 122 lines
Hi everyone,
The following new patches are queued for QEMU stable v1.6.2:
https://github.com/mdroth/qemu/commits/stable-1.6-staging
The release is planned for 2013-12-09:
http://wiki.qemu.org/Planning/1.6
Please respond here or CC [email protected] on any patches you think should be included in the release. The cut-off date is has been extended to 2013-12-06 due to the round-up email going out late.
Testing/feedback is greatly appreciated.
Thanks!
Alex Williamson (1):
vfio-pci: Fix multifunction=onAlexey Kardashevskiy (1):
memory: fix 128 arithmetic in info mtreeAmit Shah (3):
char: move backends' io watch tag to CharDriverState
char: use common function to disable callbacks on chardev close
char: remove watch callback on chardev detach from frontendAmos Kong (2):
virtio-net: fix the memory leak inrxfilter_notify()
rng-egd: offset the point when repeatedly read from the bufferBandan Das (1):
pci: unregistervmstate_pcibuson unplugCole Robinson (1):
Fix pc migration from qemu <= 1.5Fam Zheng (1):
vmdk: Fixvmdk_parse_extentsHans de Goede (1):
audio: honorQEMU_AUDIO_TIMER_PERIODinstead of waking up every *nano* secondIgor Mammedov (1):
qdev-monitor: Fix crash whendevice_addis called with abstract driverJason Wang (1):
virtio-net: only delete bh that existedMarkus Armbruster (2):
tests: Fix schema parser test for in-tree build
tests: Update .gitignore for test-int128 and test-bitopsMatthew Daley (1):
xen_disk: mark ioreq as mapped before unmapping in error caseMax Filippov (1):
exec: fixbreakpoint_invalidatewhen pc may not be translatedMax Reitz (1):
qcow2:count_contiguous_clustersand compressionMike Frysinger (1):
configure: detect endian via compile testPaolo Bonzini (1):
monitor: eliminatemonitor_event_state_lockPeter Lieven (1):
qcow2: fix possible corruption when reading multiple clustersPeter Maydell (1):
configure: Explicitly set ARFLAGS so we can build with GNU Make 4.0Richard Henderson (1):
Adjust qapi-visit for python-2.4.3Stefan Hajnoczi (1):
qdev-monitor: Unref device whendevice_addfailsStefan Weil (5):
tci: Add implementation ofrotl_i64,rotr_i64
bitops: Add rotate functions (rol8, ror8, ...)
misc: Use new rotate functions
qemu-char: Fix potential out of bounds access to local arrays
linux-user: Fix stat64 syscall for SPARC64Vlad Yasevich (1):
qom: Fix memory leak inobject_property_set_link()Wenchao Xia (2):
qapi: fix memleak by adding implict struct functions in dealloc visitor
tests: fix memleak in error path test for input visitoraudio/audio.c | 3 +- backends/rng-egd.c | 4 +- block/qcow2-cluster.c | 7 +++- block/vmdk.c | 7 +++- configure | 45 +++++++++------------ exec.c | 6 ++- hw/block/xen_disk.c | 1 + hw/misc/vfio.c | 7 ++++ hw/net/virtio-net.c | 10 ++--- hw/pci-host/piix.c | 9 ++++- hw/pci-host/q35.c | 10 ++++- hw/pci/pci.c | 8 ++++ include/hw/i386/pc.h | 8 ++++ include/hw/pci-host/q35.h | 1 + include/qemu/bitops.h | 80 +++++++++++++++++++++++++++++++++++++ include/sysemu/char.h | 1 + linux-user/syscall.c | 6 +-- linux-user/syscall_defs.h | 14 +++++++ memory.c | 4 +- monitor.c | 6 --- qapi/qapi-dealloc-visitor.c | 20 ++++++++++ qdev-monitor.c | 8 ++++ qemu-char.c | 86 +++++++++++++++------------------------- qom/object.c | 5 ++- scripts/qapi-visit.py | 17 ++++++--
Quoted 11 lines
target-arm/iwmmxt_helper.c | 2 +- tcg/optimize.c | 12 ++---- tcg/tci/tcg-target.c | 1 - tci.c | 14 +++++-- tests/.gitignore | 3 ++ tests/Makefile | 8 ++-- tests/test-qmp-input-visitor.c | 1 + 32 files changed, 287 insertions(+), 127 deletions(-)
This one is not yet here, but it's close:
http://permalink.gmane.org/gmane.comp.emulators.qemu/244329
It would also be nice to have the first 12 patches of
http://permalink.gmane.org/gmane.comp.emulators.qemu/244052, but perhaps it's better to wait for 1.7.1.
Paolo