|
|
9ae3a8 |
From d6d76951c7e02baad0ee5944d4a6b5a5468d0d40 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <d6d76951c7e02baad0ee5944d4a6b5a5468d0d40.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:52:53 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 17/46] rdma: allow state transitions between other states
|
|
|
9ae3a8 |
besides ACTIVE
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-18-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55705
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 17/42] rdma: allow state transitions between other states besides ACTIVE
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit d58f574bf39796ed2396dfd1e308352fbb03f944
|
|
|
9ae3a8 |
Author: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Date: Mon Jul 22 10:01:56 2013 -0400
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma: allow state transitions between other states besides ACTIVE
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This patch is in preparation for the next ones: Until now the MIG_STATE_SETUP
|
|
|
9ae3a8 |
state was not really a 'formal' state. It has been used as a 'zero' state
|
|
|
9ae3a8 |
and QEMU has been unconditionally transitioning into this state when
|
|
|
9ae3a8 |
the QMP migrate command was called. In preparation for timing this state,
|
|
|
9ae3a8 |
we have to make this state a a 'real' state which actually gets transitioned
|
|
|
9ae3a8 |
from later in the migration_thread() from SETUP => ACTIVE, rather than just
|
|
|
9ae3a8 |
automatically dropping into this state at the beginninig of the migration.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This means that the state transition function (migration_finish_set_state())
|
|
|
9ae3a8 |
needs to be capable of transitioning from valid states _other_ than just
|
|
|
9ae3a8 |
MIG_STATE_ACTIVE.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The function is in fact already capable of doing that, but was not allowing the
|
|
|
9ae3a8 |
old state to be a parameter specified as an input.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This patch fixes that and only makes the transition if the current state
|
|
|
9ae3a8 |
matches the old state that the caller intended to transition from.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
Tested-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration.c | 12 ++++++------
|
|
|
9ae3a8 |
1 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration.c | 12 ++++++------
|
|
|
9ae3a8 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/migration.c b/migration.c
|
|
|
9ae3a8 |
index 2fa0237..e885bb7 100644
|
|
|
9ae3a8 |
--- a/migration.c
|
|
|
9ae3a8 |
+++ b/migration.c
|
|
|
9ae3a8 |
@@ -296,9 +296,9 @@ static void migrate_fd_cleanup(void *opaque)
|
|
|
9ae3a8 |
notifier_list_notify(&migration_state_notifiers, s);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static void migrate_finish_set_state(MigrationState *s, int new_state)
|
|
|
9ae3a8 |
+static void migrate_set_state(MigrationState *s, int old_state, int new_state)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- if (atomic_cmpxchg(&s->state, MIG_STATE_ACTIVE, new_state) == new_state) {
|
|
|
9ae3a8 |
+ if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
|
|
|
9ae3a8 |
trace_migrate_set_state(new_state);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -316,7 +316,7 @@ static void migrate_fd_cancel(MigrationState *s)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
DPRINTF("cancelling migration\n");
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- migrate_finish_set_state(s, MIG_STATE_CANCELLED);
|
|
|
9ae3a8 |
+ migrate_set_state(s, s->state, MIG_STATE_CANCELLED);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void add_migration_state_change_notifier(Notifier *notify)
|
|
|
9ae3a8 |
@@ -578,19 +578,19 @@ static void *migration_thread(void *opaque)
|
|
|
9ae3a8 |
qemu_mutex_unlock_iothread();
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
- migrate_finish_set_state(s, MIG_STATE_ERROR);
|
|
|
9ae3a8 |
+ migrate_set_state(s, MIG_STATE_ACTIVE, MIG_STATE_ERROR);
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!qemu_file_get_error(s->file)) {
|
|
|
9ae3a8 |
- migrate_finish_set_state(s, MIG_STATE_COMPLETED);
|
|
|
9ae3a8 |
+ migrate_set_state(s, MIG_STATE_ACTIVE, MIG_STATE_COMPLETED);
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (qemu_file_get_error(s->file)) {
|
|
|
9ae3a8 |
- migrate_finish_set_state(s, MIG_STATE_ERROR);
|
|
|
9ae3a8 |
+ migrate_set_state(s, MIG_STATE_ACTIVE, MIG_STATE_ERROR);
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
current_time = qemu_get_clock_ms(rt_clock);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|