From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3qgs-0007dm-KZ for qemu-devel@nongnu.org; Mon, 29 Jul 2013 12:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3qgj-0004QY-M6 for qemu-devel@nongnu.org; Mon, 29 Jul 2013 12:52:58 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:58072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3qgj-0004QB-Hg for qemu-devel@nongnu.org; Mon, 29 Jul 2013 12:52:49 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Jul 2013 12:52:46 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 4B66838C804A for ; Mon, 29 Jul 2013 12:52:41 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6TGqgbn200380 for ; Mon, 29 Jul 2013 12:52:42 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6TGqgAE027166 for ; Mon, 29 Jul 2013 12:52:42 -0400 Message-ID: <51F69DDA.8060706@linux.vnet.ibm.com> Date: Mon, 29 Jul 2013 12:52:42 -0400 From: "Michael R. Hines" MIME-Version: 1.0 References: <1375102920-18817-1-git-send-email-stefanha@redhat.com> <1375102920-18817-3-git-send-email-stefanha@redhat.com> <51F6805A.6080901@linux.vnet.ibm.com> <20130729150133.GA16864@stefanha-thinkpad.redhat.com> In-Reply-To: <20130729150133.GA16864@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/4] migration: fix spice migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Juan Quintela , "Michael R. Hines" , Stefan Hajnoczi , qemu-devel@nongnu.org On 07/29/2013 11:01 AM, Stefan Hajnoczi wrote: > On Mon, Jul 29, 2013 at 10:46:50AM -0400, Michael R. Hines wrote: >> On 07/29/2013 09:01 AM, Stefan Hajnoczi wrote: >>> Commit 29ae8a4133082e16970c9d4be09f4b6a15034617 ("rdma: introduce >>> MIG_STATE_NONE and change MIG_STATE_SETUP state transition") changed the >>> state transitions during migration setup. >>> >>> Spice used to be notified with MIG_STATE_ACTIVE and it detected this >>> using migration_is_active(). Spice is now notified with >>> MIG_STATE_SETUP and migration_is_active() no longer works. >>> >>> Replace migration_is_active() with migration_in_setup() to fix spice >>> migration. >>> >>> Cc: Michael R. Hines >>> Signed-off-by: Stefan Hajnoczi >>> --- >>> include/migration/migration.h | 2 +- >>> migration.c | 4 ++-- >>> ui/spice-core.c | 2 +- >>> 3 files changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/include/migration/migration.h b/include/migration/migration.h >>> index 08c772d..140e6b4 100644 >>> --- a/include/migration/migration.h >>> +++ b/include/migration/migration.h >>> @@ -90,7 +90,7 @@ int migrate_fd_close(MigrationState *s); >>> >>> void add_migration_state_change_notifier(Notifier *notify); >>> void remove_migration_state_change_notifier(Notifier *notify); >>> -bool migration_is_active(MigrationState *); >>> +bool migration_in_setup(MigrationState *); >>> bool migration_has_finished(MigrationState *); >>> bool migration_has_failed(MigrationState *); >>> MigrationState *migrate_get_current(void); >>> diff --git a/migration.c b/migration.c >>> index a5ed26b..9fc7294 100644 >>> --- a/migration.c >>> +++ b/migration.c >>> @@ -338,9 +338,9 @@ void remove_migration_state_change_notifier(Notifier *notify) >>> notifier_remove(notify); >>> } >>> >>> -bool migration_is_active(MigrationState *s) >>> +bool migration_in_setup(MigrationState *s) >>> { >>> - return s->state == MIG_STATE_ACTIVE; >>> + return s->state == MIG_STATE_SETUP; >>> } >>> >>> bool migration_has_finished(MigrationState *s) >>> diff --git a/ui/spice-core.c b/ui/spice-core.c >>> index f308fd9..033fd89 100644 >>> --- a/ui/spice-core.c >>> +++ b/ui/spice-core.c >>> @@ -563,7 +563,7 @@ static void migration_state_notifier(Notifier *notifier, void *data) >>> { >>> MigrationState *s = data; >>> >>> - if (migration_is_active(s)) { >>> + if (migration_in_setup(s)) { >>> spice_server_migrate_start(spice_server); >>> } else if (migration_has_finished(s)) { >>> spice_server_migrate_end(spice_server, true); >> Do we really have to replace this function? Can we just add a new function? > Yes, migration_is_active() is deadcode since there are no callers. > > There is also no way to receive a migration state change callback with > ACTIVE. The notifiers are not called on the SETUP -> ACTIVE transition > because the migration thread does cmpxchg only (it doesn't invoke > notifiers). > > If someone would like it again in the future they will first need to > decide how to notify when the migration thread transitions states. > Leaving this function around would be misleading since it cannot be used > correctly at the moment. > > Stefan > Acknowledged. - Michael