From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711510; cv=none; d=zohomail.com; s=zohoarc; b=AE0PmuyRelZivF+6SufrzWot8XESkrIKP9Rh90RY0/D3/7eVnMtVXJ5sNk88zZJjtASjDVX259pzuJ7d1zJYwhgFkNhA2Ru0nk+CWGh0RbUX6+Ud6Y/UIkCG9R5mNT9e63bgXLfO0n10rt5LVf7gKkol9ueDQmwTyYa39lGu1Uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711510; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AmaCH76yoHjfk0Z+RYNZ+HTyaDgpG6p/kVMiEXYgNtM=; b=mRDZwkkeTqy1pkA/UP65sXX/XoEup7041I+i6SUkwrPLsVtPdas2OD3+Kje7F1EjhCrkOJLmui7uez1II/psds0paxddMw/9sFwnuQoNQ0i/IDpAoG14mD+xZ/ZbTGfSqOMt9/YHoLcO1ieuwveQJV0mm04e93hImFppJbhSlOU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711510512455.6759865819507; Fri, 28 Apr 2023 12:51:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6e-0000ve-CO; Fri, 28 Apr 2023 15:50:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000q6-S1; Fri, 28 Apr 2023 15:49:59 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-00012K-HX; Fri, 28 Apr 2023 15:49:56 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id D6BB15F425; Fri, 28 Apr 2023 22:49:40 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-NlDZtyEc; Fri, 28 Apr 2023 22:49:40 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711380; bh=AmaCH76yoHjfk0Z+RYNZ+HTyaDgpG6p/kVMiEXYgNtM=; h=Cc:Message-Id:References:Date:In-Reply-To:Subject:To:From; b=ncNAmGnd95e+wh+WSGsC93rXy0cribtVwpihnS0M7lDY5HINwx6KQxds3tCiHH6Fh eLTnH2VpAi3NezfjSXzCwseGeNTvhkYJcwIThKKcx5JtDjaEn8pEClCzwFX7rPoqj5 qclNmKRajidj/83cte7BTM1mMJGueH8euYT7KK0E= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org (open list:Block layer core) Subject: [PATCH v4 01/10] block/meson.build: prefer positive condition for replication Date: Fri, 28 Apr 2023 22:49:19 +0300 Message-Id: <20230428194928.1426370-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711510825100004 Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Lukas Straub Reviewed-by: Zhang Chen --- block/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/meson.build b/block/meson.build index 382bec0e7d..b9a72e219b 100644 --- a/block/meson.build +++ b/block/meson.build @@ -84,7 +84,7 @@ block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-w= in32.c', 'win32-aio.c') block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref,= iokit]) block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c')) block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c')) -if not get_option('replication').disabled() +if get_option('replication').allowed() block_ss.add(files('replication.c')) endif block_ss.add(when: libaio, if_true: files('linux-aio.c')) --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711447; cv=none; d=zohomail.com; s=zohoarc; b=SJrkoZPREmSZhYeLLj0u2mOD8T5gol1y6RofjZdn7B1Q/dLAKgoz2ITsxFrfDDq7nqZL9ktnuu0vnF6Xo/6/N6E1PJRnCNT4d+MkQh9Osf5crVyxGKygjHdKVZjA5UTd1XOMuaWnUnLqIYsXUWyVMGvISQlJs0DfiYNWVf72FRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711447; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qXZQ9a2UoFOCKJScTxIbnQa7xYmtnglvTxlpoRXJtE4=; b=iTAouNS6yxaRlTEuLmcTmASdy+Epnb0lSVZKBue+2r7k0mFEX6R7kd6wEyZPGInKgrrEu5lIO5I5IkyoDjbksrfPnRgkqkqBM9Ljqmj0a1FkzEKFtvoGCBEtu9ORx9z37PPaCb1YsNMl5U/oJr9vcgq8U5DwSUfbWc0+peU6k2Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711447230848.3341156769872; Fri, 28 Apr 2023 12:50:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6R-0000pB-Iw; Fri, 28 Apr 2023 15:49:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-0000nm-Oc for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:53 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6H-00013O-L1 for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:52 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id 28E2C5E7EC; Fri, 28 Apr 2023 22:49:42 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-zfzyQfVD; Fri, 28 Apr 2023 22:49:41 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711381; bh=qXZQ9a2UoFOCKJScTxIbnQa7xYmtnglvTxlpoRXJtE4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=gpnwhnN5qOgfbKgu78ROdJjM1LlPsKeD3DV2LF1wqQmsIt3lBkpybX+lubR/fR13H n06pyi3YpYebz0yzjP5HirkPMT4q5V22fi3bMNhFLQAkEpMTJM3bYjhDjDKFDcF/sW a0Am7MgLLKINMkj0jBCJBtk1C61D2bHBymjzSQ9c= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Hailiang Zhang , Peter Xu , Leonardo Bras Subject: [PATCH v4 02/10] colo: make colo_checkpoint_notify static and provide simpler API Date: Fri, 28 Apr 2023 22:49:20 +0300 Message-Id: <20230428194928.1426370-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711449346100003 Content-Type: text/plain; charset="utf-8" colo_checkpoint_notify() is mostly used in colo.c. Outside we use it once when x-checkpoint-delay migration parameter is set. So, let's simplify the external API to only that function - notify COLO that parameter was set. This make external API more robust and hides implementation details from external callers. Also this helps us to make COLO module optional in further patch (i.e. we are going to add possibility not build the COLO module). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen --- include/migration/colo.h | 9 ++++++++- migration/colo.c | 29 ++++++++++++++++++----------- migration/options.c | 4 +--- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/migration/colo.h b/include/migration/colo.h index 5fbe1a6d5d..7ef315473e 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -36,6 +36,13 @@ COLOMode get_colo_mode(void); /* failover */ void colo_do_failover(void); =20 -void colo_checkpoint_notify(void *opaque); +/* + * colo_checkpoint_delay_set + * + * Handles change of x-checkpoint-delay migration parameter, called from + * migrate_params_apply() to notify COLO module about the change. + */ +void colo_checkpoint_delay_set(void); + void colo_shutdown(void); #endif diff --git a/migration/colo.c b/migration/colo.c index 07bfa21fea..c9e0b909b9 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -65,6 +65,24 @@ static bool colo_runstate_is_stopped(void) return runstate_check(RUN_STATE_COLO) || !runstate_is_running(); } =20 +static void colo_checkpoint_notify(void *opaque) +{ + MigrationState *s =3D opaque; + int64_t next_notify_time; + + qemu_event_set(&s->colo_checkpoint_event); + s->colo_checkpoint_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); + next_notify_time =3D s->colo_checkpoint_time + migrate_checkpoint_dela= y(); + timer_mod(s->colo_delay_timer, next_notify_time); +} + +void colo_checkpoint_delay_set(void) +{ + if (migration_in_colo_state()) { + colo_checkpoint_notify(migrate_get_current()); + } +} + static void secondary_vm_do_failover(void) { /* COLO needs enable block-replication */ @@ -644,17 +662,6 @@ out: } } =20 -void colo_checkpoint_notify(void *opaque) -{ - MigrationState *s =3D opaque; - int64_t next_notify_time; - - qemu_event_set(&s->colo_checkpoint_event); - s->colo_checkpoint_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); - next_notify_time =3D s->colo_checkpoint_time + migrate_checkpoint_dela= y(); - timer_mod(s->colo_delay_timer, next_notify_time); -} - void migrate_start_colo_process(MigrationState *s) { qemu_mutex_unlock_iothread(); diff --git a/migration/options.c b/migration/options.c index 53b7fc5d5d..865a0214d8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1246,9 +1246,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) =20 if (params->has_x_checkpoint_delay) { s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - if (migration_in_colo_state()) { - colo_checkpoint_notify(s); - } + colo_checkpoint_delay_set(); } =20 if (params->has_block_incremental) { --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711524; cv=none; d=zohomail.com; s=zohoarc; b=NhvQKiDKr0pZOUPwfFFsdmN8/Sc9ins3DoNznfQemdSEv+qWaPwccCE9DNWEL4c5PkpMkNbgxFJEn3sQeENrXZaeK1m3CR79kBbtNNf8+K/jMQp3+WapVsb8HGpG6sGB04OS9N9HjIvwH18RqLBB2vjZ/on5p/8p7dV9fr02WX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711524; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EtOoRoZjGd8V5MRXSEjpCveUeZPmfWh6DKvm1r7/jZU=; b=fh9xmqHN6ZN/HVJDhGK+ts15yZm8vSpv1Liqb++z/Uv6Yd+3kwFtJAK4DK69przqXfObF9S2Q/1rwmj9JVJVoikqJUgSZYGnGVnvF7eUPSs21cdlocWXs6esEbv1qkEEEliA6ibK8RmAKyaKsWccUj1J+NYZpnBdfc+PbUpnrxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711524325929.3302418449096; Fri, 28 Apr 2023 12:52:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6V-0000rj-6v; Fri, 28 Apr 2023 15:50:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000q7-RZ for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:59 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-00014C-HV for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:58 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTP id 6258E60DBE; Fri, 28 Apr 2023 22:49:43 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-9QOMhlqa; Fri, 28 Apr 2023 22:49:42 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711382; bh=EtOoRoZjGd8V5MRXSEjpCveUeZPmfWh6DKvm1r7/jZU=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=cwxeLcYDYBZ0oLTRKYCD1/vl3VTRVeZ1TLhy0ZGxZ4BR/IyUpHVk8UA270aIyxtWE fSPgnqVeAdlnObT2hjxMI+Q/+dBd9/iQp+MszDsWJY0YlYHjoMRLZvesvX0nkxpING O5GcJZ+gXi6tCycwjVJb/E5xuCqppquLWCaQhJ6g= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, "Dr . David Alan Gilbert" , Hailiang Zhang , Peter Xu , Leonardo Bras , Eric Blake , Markus Armbruster , Paolo Bonzini Subject: [PATCH v4 03/10] build: move COLO under CONFIG_REPLICATION Date: Fri, 28 Apr 2023 22:49:21 +0300 Message-Id: <20230428194928.1426370-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711524903100003 Content-Type: text/plain; charset="utf-8" We don't allow to use x-colo capability when replication is not configured. So, no reason to build COLO when replication is disabled, it's unusable in this case. Note also that the check in migrate_caps_check() is not the only restriction: some functions in migration/colo.c will just abort if called with not defined CONFIG_REPLICATION, for example: migration_iteration_finish() case MIGRATION_STATUS_COLO: migrate_start_colo_process() colo_process_checkpoint() abort() It could probably make sense to have possibility to enable COLO without REPLICATION, but this requires deeper audit of colo & replication code, which may be done later if needed. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela --- hmp-commands.hx | 2 ++ migration/colo.c | 28 ------------------------ migration/meson.build | 6 ++++-- migration/migration-hmp-cmds.c | 2 ++ migration/migration.c | 6 ++++++ qapi/migration.json | 9 +++++--- stubs/colo.c | 39 ++++++++++++++++++++++++++++++++++ stubs/meson.build | 1 + 8 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 stubs/colo.c diff --git a/hmp-commands.hx b/hmp-commands.hx index bb85ee1d26..fbd0932232 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1035,6 +1035,7 @@ SRST migration (or once already in postcopy). ERST =20 +#ifdef CONFIG_REPLICATION { .name =3D "x_colo_lost_heartbeat", .args_type =3D "", @@ -1043,6 +1044,7 @@ ERST "a failover or takeover is needed.", .cmd =3D hmp_x_colo_lost_heartbeat, }, +#endif =20 SRST ``x_colo_lost_heartbeat`` diff --git a/migration/colo.c b/migration/colo.c index c9e0b909b9..6c7c313956 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -26,9 +26,7 @@ #include "qemu/rcu.h" #include "migration/failover.h" #include "migration/ram.h" -#ifdef CONFIG_REPLICATION #include "block/replication.h" -#endif #include "net/colo-compare.h" #include "net/colo.h" #include "block/block.h" @@ -86,7 +84,6 @@ void colo_checkpoint_delay_set(void) static void secondary_vm_do_failover(void) { /* COLO needs enable block-replication */ -#ifdef CONFIG_REPLICATION int old_state; MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; @@ -151,14 +148,10 @@ static void secondary_vm_do_failover(void) if (mis->migration_incoming_co) { qemu_coroutine_enter(mis->migration_incoming_co); } -#else - abort(); -#endif } =20 static void primary_vm_do_failover(void) { -#ifdef CONFIG_REPLICATION MigrationState *s =3D migrate_get_current(); int old_state; Error *local_err =3D NULL; @@ -199,9 +192,6 @@ static void primary_vm_do_failover(void) =20 /* Notify COLO thread that failover work is finished */ qemu_sem_post(&s->colo_exit_sem); -#else - abort(); -#endif } =20 COLOMode get_colo_mode(void) @@ -235,7 +225,6 @@ void colo_do_failover(void) } } =20 -#ifdef CONFIG_REPLICATION void qmp_xen_set_replication(bool enable, bool primary, bool has_failover, bool failover, Error **errp) @@ -289,7 +278,6 @@ void qmp_xen_colo_do_checkpoint(Error **errp) /* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event(COLO_EVENT_CHECKPOINT, errp); } -#endif =20 COLOStatus *qmp_query_colo_status(Error **errp) { @@ -453,15 +441,11 @@ static int colo_do_checkpoint_transaction(MigrationSt= ate *s, } qemu_mutex_lock_iothread(); =20 -#ifdef CONFIG_REPLICATION replication_do_checkpoint_all(&local_err); if (local_err) { qemu_mutex_unlock_iothread(); goto out; } -#else - abort(); -#endif =20 colo_send_message(s->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_er= r); if (local_err) { @@ -579,15 +563,11 @@ static void colo_process_checkpoint(MigrationState *s) object_unref(OBJECT(bioc)); =20 qemu_mutex_lock_iothread(); -#ifdef CONFIG_REPLICATION replication_start_all(REPLICATION_MODE_PRIMARY, &local_err); if (local_err) { qemu_mutex_unlock_iothread(); goto out; } -#else - abort(); -#endif =20 vm_start(); qemu_mutex_unlock_iothread(); @@ -755,7 +735,6 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, return; } =20 -#ifdef CONFIG_REPLICATION replication_get_error_all(&local_err); if (local_err) { error_propagate(errp, local_err); @@ -772,9 +751,6 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, qemu_mutex_unlock_iothread(); return; } -#else - abort(); -#endif /* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event(COLO_EVENT_CHECKPOINT, &local_err); =20 @@ -881,15 +857,11 @@ void *colo_process_incoming_thread(void *opaque) object_unref(OBJECT(bioc)); =20 qemu_mutex_lock_iothread(); -#ifdef CONFIG_REPLICATION replication_start_all(REPLICATION_MODE_SECONDARY, &local_err); if (local_err) { qemu_mutex_unlock_iothread(); goto out; } -#else - abort(); -#endif vm_start(); qemu_mutex_unlock_iothread(); trace_colo_vm_state_change("stop", "run"); diff --git a/migration/meson.build b/migration/meson.build index 480ff6854a..9c6a8e65d3 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -13,8 +13,6 @@ softmmu_ss.add(files( 'block-dirty-bitmap.c', 'channel.c', 'channel-block.c', - 'colo-failover.c', - 'colo.c', 'exec.c', 'fd.c', 'global_state.c', @@ -30,6 +28,10 @@ softmmu_ss.add(files( 'threadinfo.c', ), gnutls) =20 +if get_option('replication').allowed() + softmmu_ss.add(files('colo-failover.c', 'colo.c')) +endif + softmmu_ss.add(when: rdma, if_true: files('rdma.c')) if get_option('live_block_migration').allowed() softmmu_ss.add(files('block.c')) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 4e9f00e7dc..9885d7c9f7 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -643,6 +643,7 @@ void hmp_migrate_start_postcopy(Monitor *mon, const QDi= ct *qdict) hmp_handle_error(mon, err); } =20 +#ifdef CONFIG_REPLICATION void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; @@ -650,6 +651,7 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDic= t *qdict) qmp_x_colo_lost_heartbeat(&err); hmp_handle_error(mon, err); } +#endif =20 typedef struct HMPMigrationStatus { QEMUTimer *timer; diff --git a/migration/migration.c b/migration/migration.c index abcadbb619..0c14837cd3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -389,6 +389,12 @@ void migration_incoming_disable_colo(void) =20 int migration_incoming_enable_colo(void) { +#ifndef CONFIG_REPLICATION + error_report("ENABLE_COLO command come in migration stream, but COLO " + "module is not built in"); + return -ENOTSUP; +#endif + if (ram_block_discard_disable(true)) { error_report("COLO: cannot disable RAM discard"); return -EBUSY; diff --git a/qapi/migration.json b/qapi/migration.json index 2c35b7b9cf..422a6b2613 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1381,7 +1381,8 @@ # ## { 'command': 'x-colo-lost-heartbeat', - 'features': [ 'unstable' ] } + 'features': [ 'unstable' ], + 'if': 'CONFIG_REPLICATION' } =20 ## # @migrate_cancel: @@ -1657,7 +1658,8 @@ ## { 'struct': 'COLOStatus', 'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode', - 'reason': 'COLOExitReason' } } + 'reason': 'COLOExitReason' }, + 'if': 'CONFIG_REPLICATION' } =20 ## # @query-colo-status: @@ -1674,7 +1676,8 @@ # Since: 3.1 ## { 'command': 'query-colo-status', - 'returns': 'COLOStatus' } + 'returns': 'COLOStatus', + 'if': 'CONFIG_REPLICATION' } =20 ## # @migrate-recover: diff --git a/stubs/colo.c b/stubs/colo.c new file mode 100644 index 0000000000..cf9816d368 --- /dev/null +++ b/stubs/colo.c @@ -0,0 +1,39 @@ +#include "qemu/osdep.h" +#include "qemu/notify.h" +#include "net/colo-compare.h" +#include "migration/colo.h" +#include "migration/migration.h" +#include "qemu/error-report.h" +#include "qapi/qapi-commands-migration.h" + +void colo_shutdown(void) +{ +} + +void *colo_process_incoming_thread(void *opaque) +{ + error_report("Impossible happend: trying to start COLO thread when COL= O " + "module is not built in"); + abort(); +} + +void colo_checkpoint_delay_set(void) +{ +} + +void migrate_start_colo_process(MigrationState *s) +{ + error_report("Impossible happend: trying to start COLO when COLO " + "module is not built in"); + abort(); +} + +bool migration_in_colo_state(void) +{ + return false; +} + +bool migration_incoming_in_colo_state(void) +{ + return false; +} diff --git a/stubs/meson.build b/stubs/meson.build index b2b5956d97..8412cad15f 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -45,6 +45,7 @@ stub_ss.add(files('target-get-monitor-def.c')) stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('trace-control.c')) stub_ss.add(files('uuid.c')) +stub_ss.add(files('colo.c')) stub_ss.add(files('vmstate.c')) stub_ss.add(files('vm-stop.c')) stub_ss.add(files('win32-kbd-hook.c')) --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711526; cv=none; d=zohomail.com; s=zohoarc; b=RvWQXJVisr+uy6sNiWxkmRllOZHS3ZSxI7mdq4WBGTQl+ypjXomGb2rReTudEgVU4eccwcUnNjF/2Nmz37C5dXyWqPxzwqtUTzOTNVTOJeyF3mCl8M8unWWAeRIMyCXgTcfBGNgh5oAk+dr+LEpq0y/pDWx6VocoFWadlj0cn6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711526; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8NHg9RXaVsIiMmtC99+h6Vul0Yh4wasX4o8Ki5eqWdQ=; b=nIGj25B5FnsTesGHWALlmJG93jT1ThzNAgYF5peoay5qMVNP/Er0SeQKJw5NfkP9jmVKF+fi88SAy0Xs909HU9iCbepM6TFncQugyVHDTYsdJlTd3XP3h3nabYPhwNOz8QkJMZjbkrjI8vuv7CdUzCMzFhPk+n9WrvlaAHELiNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711526349510.6695223721674; Fri, 28 Apr 2023 12:52:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6X-0000td-92; Fri, 28 Apr 2023 15:50:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000q9-SF for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:59 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-00015c-Hl for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:57 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id 6C0095F72E; Fri, 28 Apr 2023 22:49:44 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-J3krjAnj; Fri, 28 Apr 2023 22:49:43 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711383; bh=8NHg9RXaVsIiMmtC99+h6Vul0Yh4wasX4o8Ki5eqWdQ=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=OI9EUvk2SRj3MPdQWdkkB3hsgJm2ksFsqwQN4KprABChjKvBxWmxnDCGzV0z4dZM4 rxLG+glbdN0VyYObEJ4CAoC/cUZi9B/iEbo0GeZbdWSyJ+ZiyTlUDqyw9ZYvm4bNQD 9wP3g/Z/bCo/nLaKUK87DxkfXqto6n+kGgm3JNRI= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jason Wang Subject: [PATCH v4 04/10] configure: add --disable-colo-proxy option Date: Fri, 28 Apr 2023 22:49:22 +0300 Message-Id: <20230428194928.1426370-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711528444100001 Content-Type: text/plain; charset="utf-8" Add option to not build filter-mirror, filter-rewriter and colo-compare when they are not needed. There could be more agile configuration, for example add separate options for each filter, but that may be done in future on demand. The aim of this patch is to make possible to disable the whole COLO Proxy subsystem. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Zhang Chen --- meson_options.txt | 2 ++ net/meson.build | 13 ++++++++++--- scripts/meson-buildoptions.sh | 3 +++ stubs/colo-compare.c | 7 +++++++ stubs/meson.build | 1 + 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 stubs/colo-compare.c diff --git a/meson_options.txt b/meson_options.txt index 2471dd02da..b59e7ae342 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -289,6 +289,8 @@ option('live_block_migration', type: 'feature', value: = 'auto', description: 'block migration in the main migration stream') option('replication', type: 'feature', value: 'auto', description: 'replication support') +option('colo_proxy', type: 'feature', value: 'auto', + description: 'colo-proxy support') option('bochs', type: 'feature', value: 'auto', description: 'bochs image format support') option('cloop', type: 'feature', value: 'auto', diff --git a/net/meson.build b/net/meson.build index 87afca3e93..6f4ecde57f 100644 --- a/net/meson.build +++ b/net/meson.build @@ -1,13 +1,10 @@ softmmu_ss.add(files( 'announce.c', 'checksum.c', - 'colo-compare.c', - 'colo.c', 'dump.c', 'eth.c', 'filter-buffer.c', 'filter-mirror.c', - 'filter-rewriter.c', 'filter.c', 'hub.c', 'net-hmp-cmds.c', @@ -19,6 +16,16 @@ softmmu_ss.add(files( 'util.c', )) =20 +if get_option('replication').allowed() or \ + get_option('colo_proxy').allowed() + softmmu_ss.add(files('colo-compare.c')) + softmmu_ss.add(files('colo.c')) +endif + +if get_option('colo_proxy').allowed() + softmmu_ss.add(files('filter-rewriter.c')) +endif + softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('filter-replay.c')) =20 if have_l2tpv3 diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index d4369a3ad8..036047ce6f 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -83,6 +83,7 @@ meson_options_help() { printf "%s\n" ' capstone Whether and how to find the capstone li= brary' printf "%s\n" ' cloop cloop image format support' printf "%s\n" ' cocoa Cocoa user interface (macOS only)' + printf "%s\n" ' colo-proxy colo-proxy support' printf "%s\n" ' coreaudio CoreAudio sound support' printf "%s\n" ' crypto-afalg Linux AF_ALG crypto backend driver' printf "%s\n" ' curl CURL block device driver' @@ -236,6 +237,8 @@ _meson_option_parse() { --disable-cloop) printf "%s" -Dcloop=3Ddisabled ;; --enable-cocoa) printf "%s" -Dcocoa=3Denabled ;; --disable-cocoa) printf "%s" -Dcocoa=3Ddisabled ;; + --enable-colo-proxy) printf "%s" -Dcolo_proxy=3Denabled ;; + --disable-colo-proxy) printf "%s" -Dcolo_proxy=3Ddisabled ;; --enable-coreaudio) printf "%s" -Dcoreaudio=3Denabled ;; --disable-coreaudio) printf "%s" -Dcoreaudio=3Ddisabled ;; --enable-coroutine-pool) printf "%s" -Dcoroutine_pool=3Dtrue ;; diff --git a/stubs/colo-compare.c b/stubs/colo-compare.c new file mode 100644 index 0000000000..ec726665be --- /dev/null +++ b/stubs/colo-compare.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "qemu/notify.h" +#include "net/colo-compare.h" + +void colo_compare_cleanup(void) +{ +} diff --git a/stubs/meson.build b/stubs/meson.build index 8412cad15f..a56645e2f7 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -46,6 +46,7 @@ stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('trace-control.c')) stub_ss.add(files('uuid.c')) stub_ss.add(files('colo.c')) +stub_ss.add(files('colo-compare.c')) stub_ss.add(files('vmstate.c')) stub_ss.add(files('vm-stop.c')) stub_ss.add(files('win32-kbd-hook.c')) --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711534; cv=none; d=zohomail.com; s=zohoarc; b=eoJ773Gci/jIjPAPo6BjswXQ0OopWY+LUusccaNL+JRx9yvDF0xLvO2YoAWxiAKuaLNDaZamWqAIBuMIsB317DwGXnuBCmdu65NjOOowQeY76pt4ktnXAezOt2AuR5QzLY/sSmskaKSAAXidbLBcYkdSD+I2bKuCHszQrqBur+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711534; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eUsm5JPrT4xdvJGnnsrNlFCpNAOuzCV906gGboTWh+k=; b=FmVxOc/zmdtXIfgpTFZxAUdBCyFB/NipnoJ8TJeYalHPUu+makTMHsGRTvlSRPrZPUGGvMlSmNxK7c3xaousV+ZU4N3Z/JNUSGUTZuZ1ZFfRn4Splv/xG740OiQ7nEKxz3qwvMtf8ygH08pgW799BRoXYyuAI/OvJY6npFxb5Ug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711534419414.82126665341696; Fri, 28 Apr 2023 12:52:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6V-0000s3-MA; Fri, 28 Apr 2023 15:50:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000qA-ST for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:01 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-00015u-HQ for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:56 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTP id 4A84360DC2; Fri, 28 Apr 2023 22:49:45 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-qOQewefi; Fri, 28 Apr 2023 22:49:44 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711384; bh=eUsm5JPrT4xdvJGnnsrNlFCpNAOuzCV906gGboTWh+k=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=kEUoo4fXwbvEu+Q5Yn10pzSVU6+978cDK5qdrQu8zpAUN1QR4fU+zDJ897rB5NcE3 OvuSjIfCI3VUx6UF7JfTJS5bz7ZbksXqqPl0Ia+mHCHzRCReSoau94VeX7daZmyETO aCDwaxR/zkVT1Fq997fhTi9uP6F6QBiZ4sq4jtVU= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Peter Xu , Leonardo Bras Subject: [PATCH v4 05/10] migration: drop colo_incoming_thread from MigrationIncomingState Date: Fri, 28 Apr 2023 22:49:23 +0300 Message-Id: <20230428194928.1426370-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711536409100003 Content-Type: text/plain; charset="utf-8" have_colo_incoming_thread variable is unused. colo_incoming_thread can be local. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen --- migration/migration.c | 7 ++++--- migration/migration.h | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0c14837cd3..d4fa1a853c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -535,6 +535,8 @@ process_incoming_migration_co(void *opaque) =20 /* we get COLO info, and know if we are in COLO mode */ if (!ret && migration_incoming_colo_enabled()) { + QemuThread colo_incoming_thread; + /* Make sure all file formats throw away their mutable metadata */ bdrv_activate_all(&local_err); if (local_err) { @@ -542,14 +544,13 @@ process_incoming_migration_co(void *opaque) goto fail; } =20 - qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming", + qemu_thread_create(&colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); - mis->have_colo_incoming_thread =3D true; qemu_coroutine_yield(); =20 qemu_mutex_unlock_iothread(); /* Wait checkpoint incoming thread exit before free resource */ - qemu_thread_join(&mis->colo_incoming_thread); + qemu_thread_join(&colo_incoming_thread); qemu_mutex_lock_iothread(); /* We hold the global iothread lock, so it is safe here */ colo_release_ram_cache(); diff --git a/migration/migration.h b/migration/migration.h index 3a918514e7..7721c7658b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -162,8 +162,6 @@ struct MigrationIncomingState { =20 int state; =20 - bool have_colo_incoming_thread; - QemuThread colo_incoming_thread; /* The coroutine we should enter (back) after failover */ Coroutine *migration_incoming_co; QemuSemaphore colo_incoming_sem; --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711510; cv=none; d=zohomail.com; s=zohoarc; b=hqkfCK2SsVMv9mjqGNUdaWFjDTm0BK28NxwPSDTnUxqsxsHSfaPZbcq6a+Woiff1LXI8wKYvKL5/YHAiu05WCkY9r7c5UHp4GezStaxZ7x7uCnGYONwPowDB/gGyLolbcMPIN7AX0J+SJdxR94n3okjyNMe3q8OUL6HxLDbRD40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711510; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e9WvsMkW12VlVf9DXehqlqSfFgrPtBAaggJQ0vR+rz4=; b=Jxk/jSUrC891qsP/6EdHUw/WGU2PEq1URotBWU8AYem2p/QxXKZe2djqPS1KWf7W0PIF7H/pmr1lAvlOrEW1VulJ5QYF2jjw7lpuxbX3lR1ELsBRQ+NOB7ltETxgvugLJFMWyGBgWTIm5ii3HGAumK2NcE+CNxv48mjCEIO/9KU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711510575903.9391063082704; Fri, 28 Apr 2023 12:51:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6e-0000vd-9J; Fri, 28 Apr 2023 15:50:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000qC-Tn for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:01 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-00015w-HP for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:57 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id 191DB5F745; Fri, 28 Apr 2023 22:49:46 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-qDmFkLUz; Fri, 28 Apr 2023 22:49:45 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711385; bh=e9WvsMkW12VlVf9DXehqlqSfFgrPtBAaggJQ0vR+rz4=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=eL57psKsay2RM4t195bJ0n5FCOoqX8qOwk2cpF4gxLPpYY12bKmx1zg/BLKtDyQHg 0eG8DiiWspz+rJVYYFHgWUw6MaIieN4eQlIQzHdXyGTKwLUfhzSsjHVJs0xhH5ZfQs OrBJ9bRc6cQGgtI5F4FrtpnA97hVy/D8983Qomjg= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Peter Xu , Leonardo Bras Subject: [PATCH v4 06/10] migration: process_incoming_migration_co: simplify code flow around ret Date: Fri, 28 Apr 2023 22:49:24 +0300 Message-Id: <20230428194928.1426370-7-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711511714100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen --- migration/migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d4fa1a853c..8db0892317 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -533,8 +533,13 @@ process_incoming_migration_co(void *opaque) /* Else if something went wrong then just fall out of the normal e= xit */ } =20 + if (ret < 0) { + error_report("load of migration failed: %s", strerror(-ret)); + goto fail; + } + /* we get COLO info, and know if we are in COLO mode */ - if (!ret && migration_incoming_colo_enabled()) { + if (migration_incoming_colo_enabled()) { QemuThread colo_incoming_thread; =20 /* Make sure all file formats throw away their mutable metadata */ @@ -556,10 +561,6 @@ process_incoming_migration_co(void *opaque) colo_release_ram_cache(); } =20 - if (ret < 0) { - error_report("load of migration failed: %s", strerror(-ret)); - goto fail; - } mis->bh =3D qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); mis->migration_incoming_co =3D NULL; --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711512; cv=none; d=zohomail.com; s=zohoarc; b=UN/BqH57eQbBhG4E5UVcRuXmbeaiG4Db1Y3p7VeO/9fIHsVFBKYRakBJETGb5jC7R+BrML6qGvO6k2GfgY48ZaPmiLDIqzwJ31Umd++XZ98nCvuoq85np1ledEFVVL7dwt7gfHle4NvkzkOGDqmZlo4AlxOaPm9372X4kOeWcpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711512; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zH6VZk1K2LbG7/mejD0LaLx4Ubz9Wgk9QajDKzJITYk=; b=Y12qhkzrvnsLxqdQgalhsNaBoGYqfbcx3GWOMhH+EDrar61MgJwcJBQskj2OtnopzZ2PBcydUVlGY60y6n4ygY2l1REMFqBe3l7iwl13RIQq/jD9fV6H0Fzl/xd8PZSD/gAP6F4s6dc3WFyfOUaDIJR3IaSyXIiE1NzjlJ4d9h8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711512736465.7537594778006; Fri, 28 Apr 2023 12:51:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6Y-0000tj-Io; Fri, 28 Apr 2023 15:50:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6T-0000qU-RV for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:01 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6L-00016Z-HT for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:00 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id 123285F74C; Fri, 28 Apr 2023 22:49:47 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-uYQtUQoA; Fri, 28 Apr 2023 22:49:46 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711386; bh=zH6VZk1K2LbG7/mejD0LaLx4Ubz9Wgk9QajDKzJITYk=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=FKF7kVcyQnCNrf6N/nT7e/cBRsjyN9FSIWl5rm+9LNl42lkCJtS7VxHhn9vVjZFWM YV1+fV1GJckGWTePfaXe/2RSAIZGYJYwpUbc7NM3IpiZw7Ft8vweXZMfI1dXvV2Mzo qqv83Y3tpuyk1er02nucmx6QXHqzHwTEK5orKS4s= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Hailiang Zhang , Peter Xu , Leonardo Bras Subject: [PATCH v4 07/10] migration: split migration_incoming_co Date: Fri, 28 Apr 2023 22:49:25 +0300 Message-Id: <20230428194928.1426370-8-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711514319100015 Content-Type: text/plain; charset="utf-8" Originally, migration_incoming_co was introduced by 25d0c16f625feb3b6 "migration: Switch to COLO process after finishing loadvm" to be able to enter from COLO code to one specific yield point, added by 25d0c16f625feb3b6. Later in 923709896b1b0 "migration: poll the cm event for destination qemu" we reused this variable to wake the migration incoming coroutine from RDMA code. That was doubtful idea. Entering coroutines is a very fragile thing: you should be absolutely sure which yield point you are going to enter. I don't know how much is it safe to enter during qemu_loadvm_state() which I think what RDMA want to do. But for sure RDMA shouldn't enter the special COLO-related yield-point. As well, COLO code doesn't want to enter during qemu_loadvm_state(), it want to enter it's own specific yield-point. As well, when in 8e48ac95865ac97d "COLO: Add block replication into colo process" we added bdrv_invalidate_cache_all() call (now it's called activate_all()) it became possible to enter the migration incoming coroutine during that call which is wrong too. So, let't make these things separate and disjoint: loadvm_co for RDMA, non-NULL during qemu_loadvm_state(), and colo_incoming_co for COLO, non-NULL only around specific yield. Signed-off-by: Vladimir Sementsov-Ogievskiy --- migration/colo.c | 4 ++-- migration/migration.c | 8 ++++++-- migration/migration.h | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 6c7c313956..a688ac553a 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -145,8 +145,8 @@ static void secondary_vm_do_failover(void) qemu_sem_post(&mis->colo_incoming_sem); =20 /* For Secondary VM, jump to incoming co */ - if (mis->migration_incoming_co) { - qemu_coroutine_enter(mis->migration_incoming_co); + if (mis->colo_incoming_co) { + qemu_coroutine_enter(mis->colo_incoming_co); } } =20 diff --git a/migration/migration.c b/migration/migration.c index 8db0892317..23b2d187de 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -505,12 +505,14 @@ process_incoming_migration_co(void *opaque) Error *local_err =3D NULL; =20 assert(mis->from_src_file); - mis->migration_incoming_co =3D qemu_coroutine_self(); mis->largest_page_size =3D qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_ACTIVE); + + mis->loadvm_co =3D qemu_coroutine_self(); ret =3D qemu_loadvm_state(mis->from_src_file); + mis->loadvm_co =3D NULL; =20 ps =3D postcopy_state_get(); trace_process_incoming_migration_co_end(ret, ps); @@ -551,7 +553,10 @@ process_incoming_migration_co(void *opaque) =20 qemu_thread_create(&colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); + + mis->colo_incoming_co =3D qemu_coroutine_self(); qemu_coroutine_yield(); + mis->colo_incoming_co =3D NULL; =20 qemu_mutex_unlock_iothread(); /* Wait checkpoint incoming thread exit before free resource */ @@ -563,7 +568,6 @@ process_incoming_migration_co(void *opaque) =20 mis->bh =3D qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); - mis->migration_incoming_co =3D NULL; return; fail: local_err =3D NULL; diff --git a/migration/migration.h b/migration/migration.h index 7721c7658b..48a46123a0 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -162,8 +162,15 @@ struct MigrationIncomingState { =20 int state; =20 + /* + * The incoming migration coroutine, non-NULL during qemu_loadvm_state= (). + * Used to wake the migration incoming coroutine from rdma code. How m= uch is + * it safe - it's a question. + */ + Coroutine *loadvm_co; + /* The coroutine we should enter (back) after failover */ - Coroutine *migration_incoming_co; + Coroutine *colo_incoming_co; QemuSemaphore colo_incoming_sem; =20 /* --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711509; cv=none; d=zohomail.com; s=zohoarc; b=gY1ruIYsN28gprR0/TVwIVk7u+IbjGxNEpoWjM7TDHzyjF0ODqbA+pAMq/SwfItx2Uzx+B+sTta6Wl9VN1/MPtML8e4xOWAJWhYPYHC4XvUwwe1/eW2aZEpQSEj+uJaIM6z0swf96RkJoh7aMotVd7p0H7e+5WKaeQw0/a54fn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711509; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=77eDWzLF7E+8LOgFtkJYkjxqRMBOA7HGbRusQnmka94=; b=WbauvCtVXPyQrPh9+kYlUt29Qjg87KnPemVq2TbdG7em6MBwHALOEZUYMZXjpB5vu4a6Ou8NGuSTtXcOUHPS9/PVJc5aS1tPunyJn5p+mlpFCO3YkVKQWr31MnUgAizNSlLlPB8MJlZha52MeVBSDYsTfJYa/jmUw+HXhRB4nrk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711509929125.36741011833988; Fri, 28 Apr 2023 12:51:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6Z-0000uC-9m; Fri, 28 Apr 2023 15:50:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000q8-Ry for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:59 -0400 Received: from forwardcorp1b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6N-000178-Dy for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:58 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTP id E6E0160DF8; Fri, 28 Apr 2023 22:49:47 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-q4dtuUrX; Fri, 28 Apr 2023 22:49:47 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711387; bh=77eDWzLF7E+8LOgFtkJYkjxqRMBOA7HGbRusQnmka94=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=vl8B6/GYqIFHq0+nTLhQdXDx6iDQNj8i4tRTPYZWWAMwSn/8nO7ga+NXOsMhQELHr pQa5sJQY1YyEMiZP8Z/Zyysu1DAkoMlt4NnWfmcyDaM2RV3ZeJYUVCKWa6kZJ/fAMn qoEAlYWQdfaw0KkFsFwihXs5g6J/GOSHIPvEjJ6w= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Hailiang Zhang , Peter Xu , Leonardo Bras , Paolo Bonzini Subject: [PATCH v4 08/10] migration: process_incoming_migration_co(): move colo part to colo Date: Fri, 28 Apr 2023 22:49:26 +0300 Message-Id: <20230428194928.1426370-9-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711510628100001 Content-Type: text/plain; charset="utf-8" Let's make better public interface for COLO: instead of colo_process_incoming_thread and not trivial logic around creating the thread let's make simple colo_incoming_co(), hiding implementation from generic code. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/migration/colo.h | 9 ++++++++- migration/colo.c | 39 ++++++++++++++++++++++++++++++++++++++- migration/migration.c | 28 ++-------------------------- stubs/colo.c | 6 ++---- 4 files changed, 50 insertions(+), 32 deletions(-) diff --git a/include/migration/colo.h b/include/migration/colo.h index 7ef315473e..eaac07f26d 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -28,7 +28,6 @@ bool migration_in_colo_state(void); int migration_incoming_enable_colo(void); void migration_incoming_disable_colo(void); bool migration_incoming_colo_enabled(void); -void *colo_process_incoming_thread(void *opaque); bool migration_incoming_in_colo_state(void); =20 COLOMode get_colo_mode(void); @@ -44,5 +43,13 @@ void colo_do_failover(void); */ void colo_checkpoint_delay_set(void); =20 +/* + * Starts COLO incoming process. Called from process_incoming_migration_co= () + * after loading the state. + * + * Called with BQL locked, may temporary release BQL. + */ +int coroutine_fn colo_incoming_co(void); + void colo_shutdown(void); #endif diff --git a/migration/colo.c b/migration/colo.c index a688ac553a..d775b442d8 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -817,7 +817,7 @@ void colo_shutdown(void) } } =20 -void *colo_process_incoming_thread(void *opaque) +static void *colo_process_incoming_thread(void *opaque) { MigrationIncomingState *mis =3D opaque; QEMUFile *fb =3D NULL; @@ -918,3 +918,40 @@ out: rcu_unregister_thread(); return NULL; } + +int coroutine_fn colo_incoming_co(void) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + Error *local_err =3D NULL; + QemuThread th; + + assert(!qemu_mutex_iothread_locked()); + + if (!migration_incoming_colo_enabled()) { + return 0; + } + + /* Make sure all file formats throw away their mutable metadata */ + bdrv_activate_all(&local_err); + if (local_err) { + error_report_err(local_err); + return -EINVAL; + } + + qemu_thread_create(&th, "COLO incoming", colo_process_incoming_thread, + mis, QEMU_THREAD_JOINABLE); + + mis->colo_incoming_co =3D qemu_coroutine_self(); + qemu_coroutine_yield(); + mis->colo_incoming_co =3D NULL; + + qemu_mutex_unlock_iothread(); + /* Wait checkpoint incoming thread exit before free resource */ + qemu_thread_join(&th); + qemu_mutex_lock_iothread(); + + /* We hold the global iothread lock, so it is safe here */ + colo_release_ram_cache(); + + return 0; +} diff --git a/migration/migration.c b/migration/migration.c index 23b2d187de..0d912ee0d7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -502,7 +502,6 @@ process_incoming_migration_co(void *opaque) MigrationIncomingState *mis =3D migration_incoming_get_current(); PostcopyState ps; int ret; - Error *local_err =3D NULL; =20 assert(mis->from_src_file); mis->largest_page_size =3D qemu_ram_pagesize_largest(); @@ -540,37 +539,14 @@ process_incoming_migration_co(void *opaque) goto fail; } =20 - /* we get COLO info, and know if we are in COLO mode */ - if (migration_incoming_colo_enabled()) { - QemuThread colo_incoming_thread; - - /* Make sure all file formats throw away their mutable metadata */ - bdrv_activate_all(&local_err); - if (local_err) { - error_report_err(local_err); - goto fail; - } - - qemu_thread_create(&colo_incoming_thread, "COLO incoming", - colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); - - mis->colo_incoming_co =3D qemu_coroutine_self(); - qemu_coroutine_yield(); - mis->colo_incoming_co =3D NULL; - - qemu_mutex_unlock_iothread(); - /* Wait checkpoint incoming thread exit before free resource */ - qemu_thread_join(&colo_incoming_thread); - qemu_mutex_lock_iothread(); - /* We hold the global iothread lock, so it is safe here */ - colo_release_ram_cache(); + if (colo_incoming_co() < 0) { + goto fail; } =20 mis->bh =3D qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); return; fail: - local_err =3D NULL; migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_FAILED); qemu_fclose(mis->from_src_file); diff --git a/stubs/colo.c b/stubs/colo.c index cf9816d368..f33379d0fd 100644 --- a/stubs/colo.c +++ b/stubs/colo.c @@ -10,11 +10,9 @@ void colo_shutdown(void) { } =20 -void *colo_process_incoming_thread(void *opaque) +int coroutine_fn colo_incoming_co(void) { - error_report("Impossible happend: trying to start COLO thread when COL= O " - "module is not built in"); - abort(); + return 0; } =20 void colo_checkpoint_delay_set(void) --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711524; cv=none; d=zohomail.com; s=zohoarc; b=QyjwMa1FHTW0ePPWpIIDRLsFX03kKrfN5fy0AqeJCQs5YsGnHYHzPNZldJ7kTJK4bzbwtfDprnGuZVEMmXpRRoP8bgkb5n56UWnc4wZn+k5/4ADFU7z4Le0JHI6I2OIcawBXTdWIERujbI2gqQCsKgMP+kwQDsFNOpklJTdq/u8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711524; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=B2qHv37nMRhw3yfiZx6NhyUq5cpbiXzOgJrOlkKnTXw=; b=G9GzZz5+pOz/kNES/f5qSrsnGr0HUWUsjkHB3cwoiGJQTUcsW189D72LS9pKiOPyIwBdjbM9rp6Yrv4K1QshdeLE+4mdh/VU5xnmHa1cgIb4r7syxuDHjYa0RH9nbHk6KONpEiLZ8yU6g7C4yt82bge7J8j65pa9GCS6ykaLoE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711524435607.8596872697623; Fri, 28 Apr 2023 12:52:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6Z-0000u9-8P; Fri, 28 Apr 2023 15:50:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6R-0000qB-TP for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:01 -0400 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6N-00017E-DU for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:49:58 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id B83895F768; Fri, 28 Apr 2023 22:49:48 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-7ktlBZag; Fri, 28 Apr 2023 22:49:48 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711388; bh=B2qHv37nMRhw3yfiZx6NhyUq5cpbiXzOgJrOlkKnTXw=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=IqgJaTfyEEVn+OCT1/9XlUcMzHApHt1+KK1eRxx8pE+WRf4AEZl+nc+Zm6MnBwP+N itSdM1cdveEPVOh/V55ULH1TWwALyS5YlPy2E3C/v1cB1StUIXKyHhBuJjjwJdmmLF 4k+aN+ElbAUzEBQ8ts7HG15T/jgRpkazY9fCPZ/Y= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Peter Xu , Leonardo Bras Subject: [PATCH v4 09/10] migration: disallow change capabilities in COLO state Date: Fri, 28 Apr 2023 22:49:27 +0300 Message-Id: <20230428194928.1426370-10-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711524875100001 Content-Type: text/plain; charset="utf-8" COLO is not listed as running state in migrate_is_running(), so, it's theoretically possible to disable colo capability in COLO state and the unexpected error in migration_iteration_finish() is reachable. Let's disallow that in qmp_migrate_set_capabilities. Than the error becomes absolutely unreachable: we can get into COLO state only with enabled capability and can't disable it while we are in COLO state. So substitute the error by simple assertion. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 5 +---- migration/options.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0d912ee0d7..8c5bbf3e94 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2751,10 +2751,7 @@ static void migration_iteration_finish(MigrationStat= e *s) runstate_set(RUN_STATE_POSTMIGRATE); break; case MIGRATION_STATUS_COLO: - if (!migrate_colo()) { - error_report("%s: critical error: calling COLO code without " - "COLO enabled", __func__); - } + assert(migrate_colo()); migrate_start_colo_process(s); s->vm_was_running =3D true; /* Fallthrough */ diff --git a/migration/options.c b/migration/options.c index 865a0214d8..f461d02eeb 100644 --- a/migration/options.c +++ b/migration/options.c @@ -598,7 +598,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, MigrationCapabilityStatusList *cap; bool new_caps[MIGRATION_CAPABILITY__MAX]; =20 - if (migration_is_running(s->state)) { + if (migration_is_running(s->state) || migration_in_colo_state()) { error_setg(errp, QERR_MIGRATION_ACTIVE); return; } --=20 2.34.1 From nobody Fri May 17 02:41:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1682711495; cv=none; d=zohomail.com; s=zohoarc; b=RXm03BM84Lwzmt76CHONlQRMyJcYb9agseWyENMVAjx7N+INuvMBxiVBgl1NSZRfYM0hwfvNIQDAj7XUu4BGvhqhiYargz38OCAmx4JwJsSkD6O8KzK+mT4ORUxQooKfX1rMvDNe0gbsu0I7uU3O7bJ5mA8K41CkVkA4NLqoQdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682711495; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OV0iXQLzRLTp2vN+Z8GCJ+NGvHDYEPz+faryG230/mQ=; b=PuN4PPvLdKy0afM3YpwrgPHm3eDx6SpsIsPJj84/a7KGG2mSrXO9I/WMNgQTq/7q2WUucIBxWuX4My39MZcfVQJbtMelbWRIjseitkdfPmViJj8coExunXHC5lkSyBO19sD4G4ipTwVq9lJJUTokmLvfbeYSFzSd5lbviL67dwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682711491381684.2998848760427; Fri, 28 Apr 2023 12:51:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psU6e-0000vt-Ss; Fri, 28 Apr 2023 15:50:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6U-0000rW-DQ for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:02 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1psU6N-00017R-Eg for qemu-devel@nongnu.org; Fri, 28 Apr 2023 15:50:02 -0400 Received: from mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:369a:0:640:c31a:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTP id 7FA6860F51; Fri, 28 Apr 2023 22:49:49 +0300 (MSK) Received: from vsementsov-nix.yandex-team.ru (unknown [2a02:6b8:b081:b432::1:18]) by mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id TnPWb50Oca60-EV3h3wTi; Fri, 28 Apr 2023 22:49:48 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1682711388; bh=OV0iXQLzRLTp2vN+Z8GCJ+NGvHDYEPz+faryG230/mQ=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=IGmZ1eRHMkonVZYyN6uzCmh/YpiAIc7258ooYq3yGJqw4PPBsY+vU4cqGI1CpplLv NXZ6cIXKE8znCfuId+bMhp810kPEkr8GK2P92gVn8bzpbMdlOaAEXojFUwQ5eEEsp2 xMvOQtXh0L8XvO8K8TxkFK0dS3TFCvYCVROVzR1g= Authentication-Results: mail-nwsmtp-smtp-corp-main-26.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: lukasstraub2@web.de, quintela@redhat.com, chen.zhang@intel.com, vsementsov@yandex-team.ru, Peter Xu , Leonardo Bras Subject: [PATCH v4 10/10] migration: block incoming colo when capability is disabled Date: Fri, 28 Apr 2023 22:49:28 +0300 Message-Id: <20230428194928.1426370-11-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230428194928.1426370-1-vsementsov@yandex-team.ru> References: <20230428194928.1426370-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1682711496653100001 Content-Type: text/plain; charset="utf-8" We generally require same set of capabilities on source and target. Let's require x-colo capability to use COLO on target. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Lukas Straub Reviewed-by: Peter Xu Reviewed-by: Zhang Chen --- migration/migration.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 8c5bbf3e94..5e162c0622 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -395,6 +395,12 @@ int migration_incoming_enable_colo(void) return -ENOTSUP; #endif =20 + if (!migrate_colo()) { + error_report("ENABLE_COLO command come in migration stream, but c-= colo " + "capability is not set"); + return -EINVAL; + } + if (ram_block_discard_disable(true)) { error_report("COLO: cannot disable RAM discard"); return -EBUSY; --=20 2.34.1