From f70d3451fe468eacddb15ccf5fd170754510b0a0 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Mon, 24 Jul 2017 17:51:25 +0100 Subject: cpu_physical_memory_sync_dirty_bitmap: Fix alignment check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code has an optimised, word aligned version, and a boring unaligned version. Recently 084140bd498909 fixed a missing offset addition from the core of both versions. However, the offset isn't necessarily aligned and thus the choice between the two versions needs fixing up to also include the offset. Symptom: A few stuck unsent pages during migration; not normally noticed unless under very low bandwidth in which case the migration may get stuck never ending and never performing a 2nd sync; noticed by a hanging postcopy-test on a very heavily loaded system. Fixes: 084140bd498909 Signed-off-by: Dr. David Alan Gilbert Reported-by: Alex Benneé Tested-by: Alex Benneé -- v2 Move 'page' inside the if (Comment from Paolo) Message-Id: <20170724165125.29887-1-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/ram_addr.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index c04f4f6..d017639 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -377,19 +377,20 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb, uint64_t *real_dirty_pages) { ram_addr_t addr; - unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS); + unsigned long word = BIT_WORD((start + rb->offset) >> TARGET_PAGE_BITS); uint64_t num_dirty = 0; unsigned long *dest = rb->bmap; /* start address is aligned at the start of a word? */ - if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) == start) { + if (((word * BITS_PER_LONG) << TARGET_PAGE_BITS) == + (start + rb->offset)) { int k; int nr = BITS_TO_LONGS(length >> TARGET_PAGE_BITS); unsigned long * const *src; - unsigned long word = BIT_WORD((start + rb->offset) >> TARGET_PAGE_BITS); unsigned long idx = (word * BITS_PER_LONG) / DIRTY_MEMORY_BLOCK_SIZE; unsigned long offset = BIT_WORD((word * BITS_PER_LONG) % DIRTY_MEMORY_BLOCK_SIZE); + unsigned long page = BIT_WORD(start >> TARGET_PAGE_BITS); rcu_read_lock(); -- cgit v1.1 From 4db0db1fa6b653970148f6ff7a24bede1d52ef9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 20 Jul 2017 12:00:46 +0200 Subject: char-fd: remove useless chr pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently unused since it was introduced in commit a29753f8aa79a34a324afebe340182a51a5aef11. Now, it can be trivially accessed by CHARDEV() of self. Signed-off-by: Marc-André Lureau Message-Id: <20170720100046.4424-1-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- include/chardev/char-fd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/chardev/char-fd.h b/include/chardev/char-fd.h index 55ae5b4..e7c2b17 100644 --- a/include/chardev/char-fd.h +++ b/include/chardev/char-fd.h @@ -29,7 +29,7 @@ typedef struct FDChardev { Chardev parent; - Chardev *chr; + QIOChannel *ioc_in, *ioc_out; int max_size; } FDChardev; -- cgit v1.1 From 0ec846bface0f9733ca61ba18e3d4b72bfd9f8ca Mon Sep 17 00:00:00 2001 From: Anton Nefedov Date: Tue, 25 Jul 2017 13:04:41 +0300 Subject: char: don't exit on hmp 'chardev-add help' qemu_chr_new_from_opts() is used from both vl.c and hmp, and it is quite confusing to see qemu suddenly exit after receiving a help option in hmp. Do exit(0) from vl.c instead. Signed-off-by: Anton Nefedov Message-Id: <1500977081-120929-1-git-send-email-anton.nefedov@virtuozzo.com> Signed-off-by: Paolo Bonzini --- include/chardev/char.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/chardev/char.h b/include/chardev/char.h index 1604ea9..66dde46 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -65,7 +65,9 @@ struct Chardev { * * @opts see qemu-config.c for a list of valid options * - * Returns: a new character backend + * Returns: on success: a new character backend + * otherwise: NULL; @errp specifies the error + * or left untouched in case of help option */ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, Error **errp); -- cgit v1.1