* [Qemu-devel] [PULL 00/16] migration queue
@ 2019-05-14 18:34 Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 01/16] migration: comment VMSTATE_UNUSED*() properly Dr. David Alan Gilbert (git)
` (16 more replies)
0 siblings, 17 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
The following changes since commit e329ad2ab72c43b56df88b34954c2c7d839bb373:
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190513' into staging (2019-05-14 10:08:47 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.git tags/pull-migration-20190514b
for you to fetch changes up to 9d3250d5ba8c4c5389530b861686e22e77fddcc7:
monitor: Call mon_get_cpu() only once at hmp_gva2gpa() (2019-05-14 19:00:04 +0100)
----------------------------------------------------------------
Migration pull 2019-05-14
Small fixes/cleanups
One HMP/monitor fix
----------------------------------------------------------------
Cole Robinson (1):
migration: savevm: fix error code with migration blockers
Eduardo Habkost (1):
monitor: Call mon_get_cpu() only once at hmp_gva2gpa()
Peter Xu (1):
migration: comment VMSTATE_UNUSED*() properly
Wei Yang (8):
migration: not necessary to check ops again
migration: remove not used field xfer_limit
vmstate: check subsection_found is enough
migration/ram.c: start of migration_bitmap_sync_range is always 0
migration/savevm: remove duplicate check of migration_is_blocked
migration/savevm: load_header before load_setup
migration/savevm: wrap into qemu_loadvm_state_header()
migration/ram.c: fix typos in comments
Yi Wang (1):
migration: update comments of migration bitmap
Yury Kotov (1):
migration: Fix use-after-free during process exit
Zhang Chen (3):
migration/colo.c: Remove redundant input parameter
migration/colo.h: Remove obsolete codes
qemu-option.hx: Update missed parameter for colo-compare
include/migration/colo.h | 4 +-
include/migration/vmstate.h | 14 +++++++
migration/colo-failover.c | 2 +-
migration/colo.c | 2 +-
migration/migration.c | 26 ++++++++++---
migration/migration.h | 1 -
migration/ram.c | 22 +++++------
migration/savevm.c | 89 ++++++++++++++++++++++++---------------------
migration/vmstate.c | 8 ++--
monitor.c | 3 +-
qemu-options.hx | 9 +++--
11 files changed, 105 insertions(+), 75 deletions(-)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 01/16] migration: comment VMSTATE_UNUSED*() properly
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 02/16] migration: not necessary to check ops again Dr. David Alan Gilbert (git)
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Peter Xu <peterx@redhat.com>
It is error prone to use VMSTATE_UNUSED*() sometimes especially when
the size of the migration stream of the field is not the same as the
size of the structure (boolean is one example). Comment it well so
people will be aware of this when people want to use it.
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190329095713.14177-1-peterx@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
include/migration/vmstate.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index a668ec75b8..9224370ed5 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1035,6 +1035,20 @@ extern const VMStateInfo vmstate_info_qtailq;
#define VMSTATE_BUFFER_UNSAFE(_field, _state, _version, _size) \
VMSTATE_BUFFER_UNSAFE_INFO(_field, _state, _version, vmstate_info_buffer, _size)
+/*
+ * These VMSTATE_UNUSED*() macros can be used to fill in the holes
+ * when some of the vmstate fields are obsolete to be compatible with
+ * migrations between new/old binaries.
+ *
+ * CAUTION: when using any of the VMSTATE_UNUSED*() macros please be
+ * sure that the size passed in is the size that was actually *sent*
+ * rather than the size of the *structure*. One example is the
+ * boolean type - the size of the structure can vary depending on the
+ * definition of boolean, however the size we actually sent is always
+ * 1 byte (please refer to implementation of VMSTATE_BOOL_V and
+ * vmstate_info_bool). So here we should always pass in size==1
+ * rather than size==sizeof(bool).
+ */
#define VMSTATE_UNUSED_V(_v, _size) \
VMSTATE_UNUSED_BUFFER(NULL, _v, _size)
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 02/16] migration: not necessary to check ops again
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 01/16] migration: comment VMSTATE_UNUSED*() properly Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 03/16] migration: remove not used field xfer_limit Dr. David Alan Gilbert (git)
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
During each iteration, se->ops is checked before each loop. So it is not
necessary to check it again and simplify the following check a little.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190327013130.26259-1-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 34bcad3807..587fec8ce2 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1157,15 +1157,13 @@ int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy)
if (!se->ops || !se->ops->save_live_iterate) {
continue;
}
- if (se->ops && se->ops->is_active) {
- if (!se->ops->is_active(se->opaque)) {
- continue;
- }
+ if (se->ops->is_active &&
+ !se->ops->is_active(se->opaque)) {
+ continue;
}
- if (se->ops && se->ops->is_active_iterate) {
- if (!se->ops->is_active_iterate(se->opaque)) {
- continue;
- }
+ if (se->ops->is_active_iterate &&
+ !se->ops->is_active_iterate(se->opaque)) {
+ continue;
}
/*
* In the postcopy phase, any device that doesn't know how to
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 03/16] migration: remove not used field xfer_limit
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 01/16] migration: comment VMSTATE_UNUSED*() properly Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 02/16] migration: not necessary to check ops again Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 04/16] vmstate: check subsection_found is enough Dr. David Alan Gilbert (git)
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
MigrationState->xfer_limit is only set to 0 in migrate_init().
Remove this unnecessary field.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190326055726.10539-1-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 1 -
migration/migration.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 609e0df5d0..4844ad438b 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1681,7 +1681,6 @@ void migrate_init(MigrationState *s)
* locks.
*/
s->bytes_xfer = 0;
- s->xfer_limit = 0;
s->cleanup_bh = 0;
s->to_dst_file = NULL;
s->state = MIGRATION_STATUS_NONE;
diff --git a/migration/migration.h b/migration/migration.h
index 438f17edad..780a096857 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -117,7 +117,6 @@ struct MigrationState
/*< public >*/
size_t bytes_xfer;
- size_t xfer_limit;
QemuThread thread;
QEMUBH *cleanup_bh;
QEMUFile *to_dst_file;
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 04/16] vmstate: check subsection_found is enough
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (2 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 03/16] migration: remove not used field xfer_limit Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 05/16] migration: savevm: fix error code with migration blockers Dr. David Alan Gilbert (git)
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
subsection_found is true implies vmdesc is not NULL.
This patch remove the additional check on vmdesc and rename
subsection_found to vmdesc_has_subsections to make it more self-explain.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190403011016.12549-1-richardw.yang@linux.intel.com>
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/vmstate.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/migration/vmstate.c b/migration/vmstate.c
index e2bbb7b5f7..1305d1a528 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -496,7 +496,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, QJSON *vmdesc)
{
const VMStateDescription **sub = vmsd->subsections;
- bool subsection_found = false;
+ bool vmdesc_has_subsections = false;
int ret = 0;
trace_vmstate_subsection_save_top(vmsd->name);
@@ -508,9 +508,9 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
trace_vmstate_subsection_save_loop(vmsd->name, vmsdsub->name);
if (vmdesc) {
/* Only create subsection array when we have any */
- if (!subsection_found) {
+ if (!vmdesc_has_subsections) {
json_start_array(vmdesc, "subsections");
- subsection_found = true;
+ vmdesc_has_subsections = true;
}
json_start_object(vmdesc, NULL);
@@ -533,7 +533,7 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
sub++;
}
- if (vmdesc && subsection_found) {
+ if (vmdesc_has_subsections) {
json_end_array(vmdesc);
}
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 05/16] migration: savevm: fix error code with migration blockers
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (3 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 04/16] vmstate: check subsection_found is enough Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 06/16] migration/colo.c: Remove redundant input parameter Dr. David Alan Gilbert (git)
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Cole Robinson <crobinso@redhat.com>
The only caller that checks the error code is looking for != 0,
so returning false is incorrect.
Fixes: 5aaac467938 "migration: savevm: consult migration blockers"
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-Id: <b991a4d0e6c4253bc08b2794c6084be55fc72e1d.1554851834.git.crobinso@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 587fec8ce2..81a9a2ef30 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2542,7 +2542,7 @@ int save_snapshot(const char *name, Error **errp)
AioContext *aio_context;
if (migration_is_blocked(errp)) {
- return false;
+ return ret;
}
if (!replay_can_snapshot()) {
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 06/16] migration/colo.c: Remove redundant input parameter
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (4 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 05/16] migration: savevm: fix error code with migration blockers Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 07/16] migration/colo.h: Remove obsolete codes Dr. David Alan Gilbert (git)
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Zhang Chen <chen.zhang@intel.com>
The colo_do_failover no need the input parameter.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20190426090730.2691-2-chen.zhang@intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
include/migration/colo.h | 2 +-
migration/colo-failover.c | 2 +-
migration/colo.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/migration/colo.h b/include/migration/colo.h
index 99ce17aca7..ddebe0ad27 100644
--- a/include/migration/colo.h
+++ b/include/migration/colo.h
@@ -37,7 +37,7 @@ bool migration_incoming_in_colo_state(void);
COLOMode get_colo_mode(void);
/* failover */
-void colo_do_failover(MigrationState *s);
+void colo_do_failover(void);
void colo_checkpoint_notify(void *opaque);
#endif
diff --git a/migration/colo-failover.c b/migration/colo-failover.c
index 4854a96c92..e9ca0b4774 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -39,7 +39,7 @@ static void colo_failover_bh(void *opaque)
return;
}
- colo_do_failover(NULL);
+ colo_do_failover();
}
void failover_request_active(Error **errp)
diff --git a/migration/colo.c b/migration/colo.c
index 238a6d62c7..8c1644091f 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -193,7 +193,7 @@ COLOMode get_colo_mode(void)
}
}
-void colo_do_failover(MigrationState *s)
+void colo_do_failover(void)
{
/* Make sure VM stopped while failover happened. */
if (!colo_runstate_is_stopped()) {
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 07/16] migration/colo.h: Remove obsolete codes
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (5 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 06/16] migration/colo.c: Remove redundant input parameter Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 08/16] qemu-option.hx: Update missed parameter for colo-compare Dr. David Alan Gilbert (git)
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Zhang Chen <chen.zhang@intel.com>
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20190426090730.2691-3-chen.zhang@intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
include/migration/colo.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/migration/colo.h b/include/migration/colo.h
index ddebe0ad27..f6fbe23ec9 100644
--- a/include/migration/colo.h
+++ b/include/migration/colo.h
@@ -22,8 +22,6 @@ enum colo_event {
COLO_EVENT_FAILOVER,
};
-void colo_info_init(void);
-
void migrate_start_colo_process(MigrationState *s);
bool migration_in_colo_state(void);
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 08/16] qemu-option.hx: Update missed parameter for colo-compare
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (6 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 07/16] migration/colo.h: Remove obsolete codes Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 09/16] migration/ram.c: start of migration_bitmap_sync_range is always 0 Dr. David Alan Gilbert (git)
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Zhang Chen <chen.zhang@intel.com>
We missed the iothread related args in this file.
This patch is used to fix this issue.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20190426090730.2691-4-chen.zhang@intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
qemu-options.hx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 51802cbb26..3faa935929 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4425,13 +4425,15 @@ Dump the network traffic on netdev @var{dev} to the file specified by
The file format is libpcap, so it can be analyzed with tools such as tcpdump
or Wireshark.
-@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},outdev=@var{chardevid}[,vnet_hdr_support]
+@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},outdev=@var{chardevid},iothread=@var{id}[,vnet_hdr_support]
Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
secondary packet. If the packets are same, we will output primary
packet to outdev@var{chardevid}, else we will notify colo-frame
do checkpoint and send primary packet to outdev@var{chardevid}.
-if it has the vnet_hdr_support flag, colo compare will send/recv packet with vnet_hdr_len.
+In order to improve efficiency, we need to put the task of comparison
+in another thread. If it has the vnet_hdr_support flag, colo compare
+will send/recv packet with vnet_hdr_len.
we must use it with the help of filter-mirror and filter-redirector.
@@ -4446,10 +4448,11 @@ primary:
-chardev socket,id=compare0-0,host=3.3.3.3,port=9001
-chardev socket,id=compare_out,host=3.3.3.3,port=9005,server,nowait
-chardev socket,id=compare_out0,host=3.3.3.3,port=9005
+-object iothread,id=iothread1
-object filter-mirror,id=m0,netdev=hn0,queue=tx,outdev=mirror0
-object filter-redirector,netdev=hn0,id=redire0,queue=rx,indev=compare_out
-object filter-redirector,netdev=hn0,id=redire1,queue=rx,outdev=compare0
--object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0
+-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,iothread=iothread1
secondary:
-netdev tap,id=hn0,vhost=off,script=/etc/qemu-ifup,down script=/etc/qemu-ifdown
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 09/16] migration/ram.c: start of migration_bitmap_sync_range is always 0
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (7 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 08/16] qemu-option.hx: Update missed parameter for colo-compare Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 10/16] migration: update comments of migration bitmap Dr. David Alan Gilbert (git)
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
We can eliminate to pass 0.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190430034412.12935-2-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/ram.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 1ca9ba77b6..ec11161d58 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1681,10 +1681,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,
}
static void migration_bitmap_sync_range(RAMState *rs, RAMBlock *rb,
- ram_addr_t start, ram_addr_t length)
+ ram_addr_t length)
{
rs->migration_dirty_pages +=
- cpu_physical_memory_sync_dirty_bitmap(rb, start, length,
+ cpu_physical_memory_sync_dirty_bitmap(rb, 0, length,
&rs->num_dirty_pages_period);
}
@@ -1773,7 +1773,7 @@ static void migration_bitmap_sync(RAMState *rs)
qemu_mutex_lock(&rs->bitmap_mutex);
rcu_read_lock();
RAMBLOCK_FOREACH_NOT_IGNORED(block) {
- migration_bitmap_sync_range(rs, block, 0, block->used_length);
+ migration_bitmap_sync_range(rs, block, block->used_length);
}
ram_counters.remaining = ram_bytes_remaining();
rcu_read_unlock();
@@ -4196,7 +4196,7 @@ static void colo_flush_ram_cache(void)
memory_global_dirty_log_sync();
rcu_read_lock();
RAMBLOCK_FOREACH_NOT_IGNORED(block) {
- migration_bitmap_sync_range(ram_state, block, 0, block->used_length);
+ migration_bitmap_sync_range(ram_state, block, block->used_length);
}
rcu_read_unlock();
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 10/16] migration: update comments of migration bitmap
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (8 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 09/16] migration/ram.c: start of migration_bitmap_sync_range is always 0 Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 11/16] migration/savevm: remove duplicate check of migration_is_blocked Dr. David Alan Gilbert (git)
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Yi Wang <wang.yi59@zte.com.cn>
Since the ram bitmap and the unsent bitmap are split by RAMBlock
in commit 6b6712e, it's better to update the comments about them.
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Message-Id: <1555311089-18610-1-git-send-email-wang.yi59@zte.com.cn>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/ram.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index ec11161d58..e1fe45311d 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1630,8 +1630,6 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data,
/**
* migration_bitmap_find_dirty: find the next dirty page from start
*
- * Called with rcu_read_lock() to protect migration_bitmap
- *
* Returns the byte offset within memory region of the start of a dirty page
*
* @rs: current RAM state
@@ -2681,7 +2679,7 @@ static void ram_save_cleanup(void *opaque)
RAMBlock *block;
/* caller have hold iothread lock or is in a bh, so there is
- * no writing race against this migration_bitmap
+ * no writing race against the migration bitmap
*/
memory_global_dirty_log_stop();
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 11/16] migration/savevm: remove duplicate check of migration_is_blocked
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (9 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 10/16] migration: update comments of migration bitmap Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 12/16] migration/savevm: load_header before load_setup Dr. David Alan Gilbert (git)
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
Current call flow of save_snapshot is:
save_snapshot
migration_is_blocked
qemu_savevm_state
migration_is_blocked
Since qemu_savevm_state is only called in save_snapshot, this means
migration_is_blocked has been already checked.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190424004700.12766-2-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 81a9a2ef30..6e8912af49 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1418,10 +1418,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
return -EINVAL;
}
- if (migration_is_blocked(errp)) {
- return -EINVAL;
- }
-
if (migrate_use_block()) {
error_setg(errp, "Block migration and snapshots are incompatible");
return -EINVAL;
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 12/16] migration/savevm: load_header before load_setup
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (10 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 11/16] migration/savevm: remove duplicate check of migration_is_blocked Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 13/16] migration/savevm: wrap into qemu_loadvm_state_header() Dr. David Alan Gilbert (git)
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
In migration_thread() and qemu_savevm_state(), we savevm_state in
following sequence:
qemu_savevm_state_header(f);
qemu_savevm_state_setup(f);
Then it would be more proper to loadvm_state in the save sequence.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190424004700.12766-4-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 6e8912af49..4c7b8379e8 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2434,10 +2434,6 @@ int qemu_loadvm_state(QEMUFile *f)
return -ENOTSUP;
}
- if (qemu_loadvm_state_setup(f) != 0) {
- return -EINVAL;
- }
-
if (migrate_get_current()->send_configuration) {
if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
error_report("Configuration section missing");
@@ -2452,6 +2448,10 @@ int qemu_loadvm_state(QEMUFile *f)
}
}
+ if (qemu_loadvm_state_setup(f) != 0) {
+ return -EINVAL;
+ }
+
cpu_synchronize_all_pre_loadvm();
ret = qemu_loadvm_state_main(f, mis);
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 13/16] migration/savevm: wrap into qemu_loadvm_state_header()
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (11 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 12/16] migration/savevm: load_header before load_setup Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 14/16] migration: Fix use-after-free during process exit Dr. David Alan Gilbert (git)
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
On source side, we have qemu_savevm_state_header() to send related data,
while on the receiving side those steps are scattered in
qemu_loadvm_state().
This patch wrap those related steps into qemu_loadvm_state_header() to
make it friendly to read.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190424004700.12766-5-richardw.yang@linux.intel.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/savevm.c | 69 +++++++++++++++++++++++++++-------------------
1 file changed, 40 insertions(+), 29 deletions(-)
diff --git a/migration/savevm.c b/migration/savevm.c
index 4c7b8379e8..c0e557b4c2 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2262,6 +2262,43 @@ qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis)
return 0;
}
+static int qemu_loadvm_state_header(QEMUFile *f)
+{
+ unsigned int v;
+ int ret;
+
+ v = qemu_get_be32(f);
+ if (v != QEMU_VM_FILE_MAGIC) {
+ error_report("Not a migration stream");
+ return -EINVAL;
+ }
+
+ v = qemu_get_be32(f);
+ if (v == QEMU_VM_FILE_VERSION_COMPAT) {
+ error_report("SaveVM v2 format is obsolete and don't work anymore");
+ return -ENOTSUP;
+ }
+ if (v != QEMU_VM_FILE_VERSION) {
+ error_report("Unsupported migration stream version");
+ return -ENOTSUP;
+ }
+
+ if (migrate_get_current()->send_configuration) {
+ if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
+ error_report("Configuration section missing");
+ qemu_loadvm_state_cleanup();
+ return -EINVAL;
+ }
+ ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0);
+
+ if (ret) {
+ qemu_loadvm_state_cleanup();
+ return ret;
+ }
+ }
+ return 0;
+}
+
static int qemu_loadvm_state_setup(QEMUFile *f)
{
SaveStateEntry *se;
@@ -2410,7 +2447,6 @@ int qemu_loadvm_state(QEMUFile *f)
{
MigrationIncomingState *mis = migration_incoming_get_current();
Error *local_err = NULL;
- unsigned int v;
int ret;
if (qemu_savevm_state_blocked(&local_err)) {
@@ -2418,34 +2454,9 @@ int qemu_loadvm_state(QEMUFile *f)
return -EINVAL;
}
- v = qemu_get_be32(f);
- if (v != QEMU_VM_FILE_MAGIC) {
- error_report("Not a migration stream");
- return -EINVAL;
- }
-
- v = qemu_get_be32(f);
- if (v == QEMU_VM_FILE_VERSION_COMPAT) {
- error_report("SaveVM v2 format is obsolete and don't work anymore");
- return -ENOTSUP;
- }
- if (v != QEMU_VM_FILE_VERSION) {
- error_report("Unsupported migration stream version");
- return -ENOTSUP;
- }
-
- if (migrate_get_current()->send_configuration) {
- if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
- error_report("Configuration section missing");
- qemu_loadvm_state_cleanup();
- return -EINVAL;
- }
- ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0);
-
- if (ret) {
- qemu_loadvm_state_cleanup();
- return ret;
- }
+ ret = qemu_loadvm_state_header(f);
+ if (ret) {
+ return ret;
}
if (qemu_loadvm_state_setup(f) != 0) {
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 14/16] migration: Fix use-after-free during process exit
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (12 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 13/16] migration/savevm: wrap into qemu_loadvm_state_header() Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 15/16] migration/ram.c: fix typos in comments Dr. David Alan Gilbert (git)
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Yury Kotov <yury-kotov@yandex-team.ru>
It fixes heap-use-after-free which was found by clang's ASAN.
Control flow of this use-after-free:
main_thread:
* Got SIGTERM and completes main loop
* Calls migration_shutdown
- migrate_fd_cancel (so, migration_thread begins to complete)
- object_unref(OBJECT(current_migration));
migration_thread:
* migration_iteration_finish -> schedule cleanup bh
* object_unref(OBJECT(s)); (Now, current_migration is freed)
* exits
main_thread:
* Calls vm_shutdown -> drain bdrvs -> main loop
-> cleanup_bh -> use after free
If you want to reproduce, these couple of sleeps will help:
vl.c:4613:
migration_shutdown();
+ sleep(2);
migration.c:3269:
+ sleep(1);
trace_migration_thread_after_loop();
migration_iteration_finish(s);
Original output:
qemu-system-x86_64: terminating on signal 15 from pid 31980 (<unknown process>)
=================================================================
==31958==ERROR: AddressSanitizer: heap-use-after-free on address 0x61900001d210
at pc 0x555558a535ca bp 0x7fffffffb190 sp 0x7fffffffb188
READ of size 8 at 0x61900001d210 thread T0 (qemu-vm-0)
#0 0x555558a535c9 in migrate_fd_cleanup migration/migration.c:1502:23
#1 0x5555594fde0a in aio_bh_call util/async.c:90:5
#2 0x5555594fe522 in aio_bh_poll util/async.c:118:13
#3 0x555559524783 in aio_poll util/aio-posix.c:725:17
#4 0x555559504fb3 in aio_wait_bh_oneshot util/aio-wait.c:71:5
#5 0x5555573bddf6 in virtio_blk_data_plane_stop
hw/block/dataplane/virtio-blk.c:282:5
#6 0x5555589d5c09 in virtio_bus_stop_ioeventfd hw/virtio/virtio-bus.c:246:9
#7 0x5555589e9917 in virtio_pci_stop_ioeventfd hw/virtio/virtio-pci.c:287:5
#8 0x5555589e22bf in virtio_pci_vmstate_change hw/virtio/virtio-pci.c:1072:9
#9 0x555557628931 in virtio_vmstate_change hw/virtio/virtio.c:2257:9
#10 0x555557c36713 in vm_state_notify vl.c:1605:9
#11 0x55555716ef53 in do_vm_stop cpus.c:1074:9
#12 0x55555716eeff in vm_shutdown cpus.c:1092:12
#13 0x555557c4283e in main vl.c:4617:5
#14 0x7fffdfdb482f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#15 0x555556ecb118 in _start (x86_64-softmmu/qemu-system-x86_64+0x1977118)
0x61900001d210 is located 144 bytes inside of 952-byte region
[0x61900001d180,0x61900001d538)
freed by thread T6 (live_migration) here:
#0 0x555556f76782 in __interceptor_free
/tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:124:3
#1 0x555558d5fa94 in object_finalize qom/object.c:618:9
#2 0x555558d57651 in object_unref qom/object.c:1068:9
#3 0x555558a55588 in migration_thread migration/migration.c:3272:5
#4 0x5555595393f2 in qemu_thread_start util/qemu-thread-posix.c:502:9
#5 0x7fffe057f6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
previously allocated by thread T0 (qemu-vm-0) here:
#0 0x555556f76b03 in __interceptor_malloc
/tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:146:3
#1 0x7ffff6ee37b8 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f7b8)
#2 0x555558d58031 in object_new qom/object.c:640:12
#3 0x555558a31f21 in migration_object_init migration/migration.c:139:25
#4 0x555557c41398 in main vl.c:4320:5
#5 0x7fffdfdb482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
Thread T6 (live_migration) created by T0 (qemu-vm-0) here:
#0 0x555556f5f0dd in pthread_create
/tmp/final/llvm.src/projects/compiler-rt/lib/asan/asan_interceptors.cc:210:3
#1 0x555559538cf9 in qemu_thread_create util/qemu-thread-posix.c:539:11
#2 0x555558a53304 in migrate_fd_connect migration/migration.c:3332:5
#3 0x555558a72bd8 in migration_channel_connect migration/channel.c:92:5
#4 0x555558a6ef87 in exec_start_outgoing_migration migration/exec.c:42:5
#5 0x555558a4f3c2 in qmp_migrate migration/migration.c:1922:9
#6 0x555558bb4f6a in qmp_marshal_migrate qapi/qapi-commands-migration.c:607:5
#7 0x555559363738 in do_qmp_dispatch qapi/qmp-dispatch.c:131:5
#8 0x555559362a15 in qmp_dispatch qapi/qmp-dispatch.c:174:11
#9 0x5555571bac15 in monitor_qmp_dispatch monitor.c:4124:11
#10 0x55555719a22d in monitor_qmp_bh_dispatcher monitor.c:4207:9
#11 0x5555594fde0a in aio_bh_call util/async.c:90:5
#12 0x5555594fe522 in aio_bh_poll util/async.c:118:13
#13 0x5555595201e0 in aio_dispatch util/aio-posix.c:460:5
#14 0x555559503553 in aio_ctx_dispatch util/async.c:261:5
#15 0x7ffff6ede196 in g_main_context_dispatch
(/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a196)
SUMMARY: AddressSanitizer: heap-use-after-free migration/migration.c:1502:23
in migrate_fd_cleanup
Shadow bytes around the buggy address:
0x0c327fffb9f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fffba00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fffba10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fffba20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fffba30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c327fffba40: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fffba50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fffba60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fffba70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fffba80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c327fffba90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==31958==ABORTING
Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Message-Id: <20190408113343.2370-1-yury-kotov@yandex-team.ru>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixed up comment formatting
---
migration/migration.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 4844ad438b..d0a0f68f11 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1495,10 +1495,8 @@ static void block_cleanup_parameters(MigrationState *s)
}
}
-static void migrate_fd_cleanup(void *opaque)
+static void migrate_fd_cleanup(MigrationState *s)
{
- MigrationState *s = opaque;
-
qemu_bh_delete(s->cleanup_bh);
s->cleanup_bh = NULL;
@@ -1543,6 +1541,23 @@ static void migrate_fd_cleanup(void *opaque)
block_cleanup_parameters(s);
}
+static void migrate_fd_cleanup_schedule(MigrationState *s)
+{
+ /*
+ * Ref the state for bh, because it may be called when
+ * there're already no other refs
+ */
+ object_ref(OBJECT(s));
+ qemu_bh_schedule(s->cleanup_bh);
+}
+
+static void migrate_fd_cleanup_bh(void *opaque)
+{
+ MigrationState *s = opaque;
+ migrate_fd_cleanup(s);
+ object_unref(OBJECT(s));
+}
+
void migrate_set_error(MigrationState *s, const Error *error)
{
qemu_mutex_lock(&s->error_mutex);
@@ -3143,7 +3158,7 @@ static void migration_iteration_finish(MigrationState *s)
error_report("%s: Unknown ending state %d", __func__, s->state);
break;
}
- qemu_bh_schedule(s->cleanup_bh);
+ migrate_fd_cleanup_schedule(s);
qemu_mutex_unlock_iothread();
}
@@ -3278,7 +3293,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
bool resume = s->state == MIGRATION_STATUS_POSTCOPY_PAUSED;
s->expected_downtime = s->parameters.downtime_limit;
- s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);
+ s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup_bh, s);
if (error_in) {
migrate_fd_error(s, error_in);
migrate_fd_cleanup(s);
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 15/16] migration/ram.c: fix typos in comments
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (13 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 14/16] migration: Fix use-after-free during process exit Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 16/16] monitor: Call mon_get_cpu() only once at hmp_gva2gpa() Dr. David Alan Gilbert (git)
2019-05-16 11:54 ` [Qemu-devel] [PULL 00/16] migration queue Peter Maydell
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Wei Yang <richardw.yang@linux.intel.com>
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190510233729.15554-1-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/ram.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index e1fe45311d..4c60869226 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -917,7 +917,7 @@ struct {
* - to make easier to know what to free at the end of migration
*
* This way we always know who is the owner of each "pages" struct,
- * and we don't need any loocking. It belongs to the migration thread
+ * and we don't need any locking. It belongs to the migration thread
* or to the channel thread. Switching is safe because the migration
* thread is using the channel mutex when changing it, and the channel
* have to had finish with its own, otherwise pending_job can't be
@@ -1630,7 +1630,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data,
/**
* migration_bitmap_find_dirty: find the next dirty page from start
*
- * Returns the byte offset within memory region of the start of a dirty page
+ * Returns the page offset within memory region of the start of a dirty page
*
* @rs: current RAM state
* @rb: RAMBlock where to search for dirty pages
@@ -2144,7 +2144,7 @@ retry:
* find_dirty_block: find the next dirty page and update any state
* associated with the search process.
*
- * Returns if a page is found
+ * Returns true if a page is found
*
* @rs: current RAM state
* @pss: data about the state of the current dirty page scan
@@ -2240,7 +2240,7 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset)
*
* Skips pages that are already sent (!dirty)
*
- * Returns if a queued page is found
+ * Returns true if a queued page is found
*
* @rs: current RAM state
* @pss: data about the state of the current dirty page scan
@@ -3447,7 +3447,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
/* we want to check in the 1st loop, just in case it was the 1st time
and we had to sync the dirty bitmap.
- qemu_get_clock_ns() is a bit expensive, so we only check each some
+ qemu_clock_get_ns() is a bit expensive, so we only check each some
iterations
*/
if ((i & 63) == 0) {
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PULL 16/16] monitor: Call mon_get_cpu() only once at hmp_gva2gpa()
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (14 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 15/16] migration/ram.c: fix typos in comments Dr. David Alan Gilbert (git)
@ 2019-05-14 18:34 ` Dr. David Alan Gilbert (git)
2019-05-16 11:54 ` [Qemu-devel] [PULL 00/16] migration queue Peter Maydell
16 siblings, 0 replies; 18+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-14 18:34 UTC (permalink / raw)
To: qemu-devel, quintela, peterx, ehabkost, richardw.yang, yury-kotov,
chen.zhang
From: Eduardo Habkost <ehabkost@redhat.com>
hmp_gva2gpa() calls mon_get_cpu() twice, which is unnecessary.
Not an actual bug, but this is reported as a defect by Coverity
Scan (CID 1401346).
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190510185620.15757-1-ehabkost@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
monitor.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/monitor.c b/monitor.c
index bb48997913..6428eb3b7e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1685,8 +1685,7 @@ static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
return;
}
- gpa = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
- addr & TARGET_PAGE_MASK, &attrs);
+ gpa = cpu_get_phys_page_attrs_debug(cs, addr & TARGET_PAGE_MASK, &attrs);
if (gpa == -1) {
monitor_printf(mon, "Unmapped\n");
} else {
--
2.21.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PULL 00/16] migration queue
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
` (15 preceding siblings ...)
2019-05-14 18:34 ` [Qemu-devel] [PULL 16/16] monitor: Call mon_get_cpu() only once at hmp_gva2gpa() Dr. David Alan Gilbert (git)
@ 2019-05-16 11:54 ` Peter Maydell
16 siblings, 0 replies; 18+ messages in thread
From: Peter Maydell @ 2019-05-16 11:54 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git)
Cc: Eduardo Habkost, Juan Quintela, QEMU Developers, Peter Xu,
Yury Kotov, Zhang Chen, Wei Yang
On Tue, 14 May 2019 at 19:36, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> The following changes since commit e329ad2ab72c43b56df88b34954c2c7d839bb373:
>
> Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190513' into staging (2019-05-14 10:08:47 +0100)
>
> are available in the Git repository at:
>
> git://github.com/dagrh/qemu.git tags/pull-migration-20190514b
>
> for you to fetch changes up to 9d3250d5ba8c4c5389530b861686e22e77fddcc7:
>
> monitor: Call mon_get_cpu() only once at hmp_gva2gpa() (2019-05-14 19:00:04 +0100)
>
> ----------------------------------------------------------------
> Migration pull 2019-05-14
>
> Small fixes/cleanups
> One HMP/monitor fix
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2019-05-16 12:54 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-14 18:34 [Qemu-devel] [PULL 00/16] migration queue Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 01/16] migration: comment VMSTATE_UNUSED*() properly Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 02/16] migration: not necessary to check ops again Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 03/16] migration: remove not used field xfer_limit Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 04/16] vmstate: check subsection_found is enough Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 05/16] migration: savevm: fix error code with migration blockers Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 06/16] migration/colo.c: Remove redundant input parameter Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 07/16] migration/colo.h: Remove obsolete codes Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 08/16] qemu-option.hx: Update missed parameter for colo-compare Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 09/16] migration/ram.c: start of migration_bitmap_sync_range is always 0 Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 10/16] migration: update comments of migration bitmap Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 11/16] migration/savevm: remove duplicate check of migration_is_blocked Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 12/16] migration/savevm: load_header before load_setup Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 13/16] migration/savevm: wrap into qemu_loadvm_state_header() Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 14/16] migration: Fix use-after-free during process exit Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 15/16] migration/ram.c: fix typos in comments Dr. David Alan Gilbert (git)
2019-05-14 18:34 ` [Qemu-devel] [PULL 16/16] monitor: Call mon_get_cpu() only once at hmp_gva2gpa() Dr. David Alan Gilbert (git)
2019-05-16 11:54 ` [Qemu-devel] [PULL 00/16] migration queue Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).