From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682342913; cv=none; d=zohomail.com; s=zohoarc; b=KWgqjD5dbg6An5hhz7vlqWQWQLXMPpNdFpH0zcN8a0zQwnl3DIJVG3I6jGh82g/tC/rjgzhRHcHNbRTM/arh9cjIt+u3BtMOy7qN50jwPVtWQxsrgMi1k066U1Sfm6yeZaXTBJcQoYaExfg/sgw65RO8J1qssCtRiHdZozE4/T4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682342913; 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=H8Zr7OBYELcFWPY+8wFqyTQvh5LLFNXEynktg69syV0=; b=XBPZ/ndYUrsAR2NhlW/nxDmma7Yc6I48Ijnbxk+yS/wAWIdJYNyEGeBXlR6RFM9TK8P1nccQ7BkW89o02duKytS3oTWk130Sq7CwGbwHfQL8dOyq6baQgmJTWhWWSP7oO16NIHE5DOhXPhJejw/DsFtUv656CFabWwlHoRBm4mA= 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 1682342913085923.9707749511313; Mon, 24 Apr 2023 06:28:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwEk-0006Rq-QH; Mon, 24 Apr 2023 09:28: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 1pqwEK-0006Fs-2U for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEI-0001Ee-4A for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-gN2Jta9QMu6jfsWEm-zWZA-1; Mon, 24 Apr 2023 09:27:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D4CD87A9E7; Mon, 24 Apr 2023 13:27:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21F1914171B8; Mon, 24 Apr 2023 13:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H8Zr7OBYELcFWPY+8wFqyTQvh5LLFNXEynktg69syV0=; b=gzs+dfTToyfEoRkQCQ+T1zzMgaHRnmRuQW+5aA4Ba4rB2YZhzWYLG5+CjIFLxs4s4m8F73 5+Qztz1n46tA+RZha0WRniGi8D02buHTROxcRcRlMyd8tRCttiUynWNYnd/m9MvqBdsXfq v3eWaN/pbEhj9uh7HhHUfnAsGNSMAek= X-MC-Unique: gN2Jta9QMu6jfsWEm-zWZA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 01/30] migration: Minor control flow simplification Date: Mon, 24 Apr 2023 15:27:01 +0200 Message-Id: <20230424132730.70752-2-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682342914516100003 Content-Type: text/plain; charset="utf-8" From: Eric Blake No need to declare a temporary variable. Suggested-by: Juan Quintela Fixes: 1df36e8c6289 ("migration: Handle block device inactivation failures = better") Signed-off-by: Eric Blake Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d91fe9fd86..9ec6c1e204 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3431,7 +3431,6 @@ static void migration_completion(MigrationState *s) ret =3D global_state_store(); =20 if (!ret) { - bool inactivate =3D !migrate_colo_enabled(); ret =3D vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); trace_migration_completion_vm_stop(ret); if (ret >=3D 0) { @@ -3439,10 +3438,10 @@ static void migration_completion(MigrationState *s) MIGRATION_STATUS_DEVICE); } if (ret >=3D 0) { - s->block_inactive =3D inactivate; + s->block_inactive =3D !migrate_colo_enabled(); qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX); ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file,= false, - inactivate); + s->block_inactive= ); } } qemu_mutex_unlock_iothread(); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682342992; cv=none; d=zohomail.com; s=zohoarc; b=QiMVV0UmKR8pSvZjm1+wQwAPfqSONh3znO/eTSgNHoCA1Zbc5047R4YlW8Lx/CzmOBsgVOqokz5hn/DPe7EWPHD92IpKNFDNLQfio/uCN4DIAq37+oEGf+t+YE9GFq0VywnsHeTgwY+tObETSNposoyfNeYA80I6neNA6bjgAec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682342992; 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=EOyXnCuABTRXnWg+aNYuAKDXYSICN2C6/C4RgK23tjQ=; b=T2obFg64Kkw9m4+g5r+KKxuJ6hv9CG6tKp1gXmLdIptBmt2XBCOOoivvuUDjG4IUB9gxVoTmFw5pX2t88rAAVr8J8gzAk2ScBb+zIa2swWvPF6Mbw1KB8n91Hyfybuhq62Ys8qXI+N8kfnsr21F023w/IQwAIAS8Vyv1PQ1sRpk= 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 1682342992068309.2956666352386; Mon, 24 Apr 2023 06:29:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwEm-0006SE-2S; Mon, 24 Apr 2023 09:28:13 -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 1pqwEQ-0006I3-Vv for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEN-0001Gf-6o for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-380-S0stMZg4Pg-K4tafbRGPzA-1; Mon, 24 Apr 2023 09:27:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6DE4787A9E3; Mon, 24 Apr 2023 13:27:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB4DA14171B8; Mon, 24 Apr 2023 13:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EOyXnCuABTRXnWg+aNYuAKDXYSICN2C6/C4RgK23tjQ=; b=eUJOtnuMnAyGb3vF5mOxEcpyLfoxLqCeliyHyEid+KQjmcGWWf9xVwoJGT5RGok6YHkSX0 IgfHWUbMOkJc3kDzeki+k8f5Jet5Q8c5RV7aaurIZfFWtZIlFeJiPjgHFrq5n7MMn8/0Lu tapApCo1w12KvJcLxCZM1OQ2urgGCBQ= X-MC-Unique: S0stMZg4Pg-K4tafbRGPzA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 02/30] migration: move migration_global_dump() to migration-hmp-cmds.c Date: Mon, 24 Apr 2023 15:27:02 +0200 Message-Id: <20230424132730.70752-3-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682342992376100009 It is only used there, so we can make it static. Once there, remove spice.h that it is not used. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- fix David Edmonson ui/qemu-spice.h unintended removal --- include/migration/misc.h | 1 - migration/migration-hmp-cmds.c | 22 +++++++++++++++++++++- migration/migration.c | 19 ------------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 8b49841016..5ebe13b4b9 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -66,7 +66,6 @@ bool migration_has_finished(MigrationState *); bool migration_has_failed(MigrationState *); /* ...and after the device transmission */ bool migration_in_postcopy_after_devices(MigrationState *); -void migration_global_dump(Monitor *mon); /* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */ bool migration_in_incoming_postcopy(void); /* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */ diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 72519ea99f..71da91967a 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -15,7 +15,6 @@ =20 #include "qemu/osdep.h" #include "block/qapi.h" -#include "migration/misc.h" #include "migration/snapshot.h" #include "monitor/hmp.h" #include "monitor/monitor.h" @@ -30,6 +29,27 @@ #include "qemu/sockets.h" #include "sysemu/runstate.h" #include "ui/qemu-spice.h" +#include "sysemu/sysemu.h" +#include "migration.h" + +static void migration_global_dump(Monitor *mon) +{ + MigrationState *ms =3D migrate_get_current(); + + monitor_printf(mon, "globals:\n"); + monitor_printf(mon, "store-global-state: %s\n", + ms->store_global_state ? "on" : "off"); + monitor_printf(mon, "only-migratable: %s\n", + only_migratable ? "on" : "off"); + monitor_printf(mon, "send-configuration: %s\n", + ms->send_configuration ? "on" : "off"); + monitor_printf(mon, "send-section-footer: %s\n", + ms->send_section_footer ? "on" : "off"); + monitor_printf(mon, "decompress-error-check: %s\n", + ms->decompress_error_check ? "on" : "off"); + monitor_printf(mon, "clear-bitmap-shift: %u\n", + ms->clear_bitmap_shift); +} =20 void hmp_info_migrate(Monitor *mon, const QDict *qdict) { diff --git a/migration/migration.c b/migration/migration.c index 9ec6c1e204..a867631ab0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4416,25 +4416,6 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) s->migration_thread_running =3D true; } =20 -void migration_global_dump(Monitor *mon) -{ - MigrationState *ms =3D migrate_get_current(); - - monitor_printf(mon, "globals:\n"); - monitor_printf(mon, "store-global-state: %s\n", - ms->store_global_state ? "on" : "off"); - monitor_printf(mon, "only-migratable: %s\n", - only_migratable ? "on" : "off"); - monitor_printf(mon, "send-configuration: %s\n", - ms->send_configuration ? "on" : "off"); - monitor_printf(mon, "send-section-footer: %s\n", - ms->send_section_footer ? "on" : "off"); - monitor_printf(mon, "decompress-error-check: %s\n", - ms->decompress_error_check ? "on" : "off"); - monitor_printf(mon, "clear-bitmap-shift: %u\n", - ms->clear_bitmap_shift); -} - #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682342988; cv=none; d=zohomail.com; s=zohoarc; b=dlyYzeMAKz2xDQBWGDNIA1z5MgQe7LDtCSCZ0ooe8kGGULmprUb40ZAdLo+fwMC58ang2jptofPT+9CONzKNbDIAPEnxaYojah2mMjdz6VoirpgoQZX3qUm4ECzK0zvQKrp4Bp/jsdvTKpG4OzeWSbEw7kp6Ie/vdlj6MMUPywo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682342988; 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=grDK+NcxNA0BJox8AMwqxJjVQg9kMniBMoiWpK59yqQ=; b=n8Qm/BiemKWg4TwkQSUB1gRpkIqbe67pySyR+XSQHeuaJbw87MvKHFpyXY7Q0+9Uuv7S+9PPOFaM5c0Ljskbw4lKue1Cs3zdoya4aVHRN0PjjYLl3xrXCN6c7+7YsVgH4PSpDQR0JVYrkVIMEDlPMz5etxRzFSgdO9XGXKKiyww= 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 1682342988713474.2046891355785; Mon, 24 Apr 2023 06:29:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwEw-0006fl-ME; Mon, 24 Apr 2023 09:28:24 -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 1pqwET-0006IJ-2J for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEO-0001Gr-V2 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-375-DEYfPCWJPCGJHWJvHbGhiw-1; Mon, 24 Apr 2023 09:27:44 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BA4261C09502; Mon, 24 Apr 2023 13:27:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC51914171B8; Mon, 24 Apr 2023 13:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=grDK+NcxNA0BJox8AMwqxJjVQg9kMniBMoiWpK59yqQ=; b=KigAjde8y26K0lsp9bpgvWO4h9yjcLZrfGrxZQ30srm89zccd352uVAD8izQ2YEWR917yP t65CpYZCT6APvR1ih1X5wJhlKGJtwUQRxKw3FnOGgshv6VcTgAE/3r4FbVCTvhCfIDRv2F sgXu/vBp9w+GBwO2xPJmi0e6DxG+/b4= X-MC-Unique: DEYfPCWJPCGJHWJvHbGhiw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 03/30] spice: move client_migrate_info command to ui/ Date: Mon, 24 Apr 2023 15:27:03 +0200 Message-Id: <20230424132730.70752-4-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682342990103100002 It has nothing to do with migration, except for the "migrate" in the name of the command. Move it with the rest of the ui commands. Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- migration/migration-hmp-cmds.c | 17 ----------------- migration/migration.c | 30 ------------------------------ qapi/migration.json | 28 ---------------------------- qapi/ui.json | 28 ++++++++++++++++++++++++++++ ui/ui-hmp-cmds.c | 17 +++++++++++++++++ ui/ui-qmp-cmds.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 75 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 71da91967a..4e9f00e7dc 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -636,23 +636,6 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) hmp_handle_error(mon, err); } =20 -void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) -{ - Error *err =3D NULL; - const char *protocol =3D qdict_get_str(qdict, "protocol"); - const char *hostname =3D qdict_get_str(qdict, "hostname"); - bool has_port =3D qdict_haskey(qdict, "port"); - int port =3D qdict_get_try_int(qdict, "port", -1); - bool has_tls_port =3D qdict_haskey(qdict, "tls-port"); - int tls_port =3D qdict_get_try_int(qdict, "tls-port", -1); - const char *cert_subject =3D qdict_get_try_str(qdict, "cert-subject"); - - qmp_client_migrate_info(protocol, hostname, - has_port, port, has_tls_port, tls_port, - cert_subject, &err); - hmp_handle_error(mon, err); -} - void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; diff --git a/migration/migration.c b/migration/migration.c index a867631ab0..80bc83f971 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -63,7 +63,6 @@ #include "sysemu/cpus.h" #include "yank_functions.h" #include "sysemu/qtest.h" -#include "ui/qemu-spice.h" =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 @@ -1018,35 +1017,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) return params; } =20 -void qmp_client_migrate_info(const char *protocol, const char *hostname, - bool has_port, int64_t port, - bool has_tls_port, int64_t tls_port, - const char *cert_subject, - Error **errp) -{ - if (strcmp(protocol, "spice") =3D=3D 0) { - if (!qemu_using_spice(errp)) { - return; - } - - if (!has_port && !has_tls_port) { - error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port"); - return; - } - - if (qemu_spice.migrate_info(hostname, - has_port ? port : -1, - has_tls_port ? tls_port : -1, - cert_subject)) { - error_setg(errp, "Could not set up display for migration"); - return; - } - return; - } - - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'"); -} - AnnounceParameters *migrate_announce_params(void) { static AnnounceParameters ap; diff --git a/qapi/migration.json b/qapi/migration.json index c84fa10e86..2c35b7b9cf 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1203,34 +1203,6 @@ { 'command': 'query-migrate-parameters', 'returns': 'MigrationParameters' } =20 -## -# @client_migrate_info: -# -# Set migration information for remote display. This makes the server -# ask the client to automatically reconnect using the new parameters -# once migration finished successfully. Only implemented for SPICE. -# -# @protocol: must be "spice" -# @hostname: migration target hostname -# @port: spice tcp port for plaintext channels -# @tls-port: spice tcp port for tls-secured channels -# @cert-subject: server certificate subject -# -# Since: 0.14 -# -# Example: -# -# -> { "execute": "client_migrate_info", -# "arguments": { "protocol": "spice", -# "hostname": "virt42.lab.kraxel.org", -# "port": 1234 } } -# <- { "return": {} } -# -## -{ 'command': 'client_migrate_info', - 'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int', - '*tls-port': 'int', '*cert-subject': 'str' } } - ## # @migrate-start-postcopy: # diff --git a/qapi/ui.json b/qapi/ui.json index 98322342f7..7ddd27a932 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1554,3 +1554,31 @@ { 'command': 'display-update', 'data': 'DisplayUpdateOptions', 'boxed' : true } + +## +# @client_migrate_info: +# +# Set migration information for remote display. This makes the server +# ask the client to automatically reconnect using the new parameters +# once migration finished successfully. Only implemented for SPICE. +# +# @protocol: must be "spice" +# @hostname: migration target hostname +# @port: spice tcp port for plaintext channels +# @tls-port: spice tcp port for tls-secured channels +# @cert-subject: server certificate subject +# +# Since: 0.14 +# +# Example: +# +# -> { "execute": "client_migrate_info", +# "arguments": { "protocol": "spice", +# "hostname": "virt42.lab.kraxel.org", +# "port": 1234 } } +# <- { "return": {} } +# +## +{ 'command': 'client_migrate_info', + 'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int', + '*tls-port': 'int', '*cert-subject': 'str' } } diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 5c456ecc02..c671389473 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -458,3 +458,20 @@ hmp_screendump(Monitor *mon, const QDict *qdict) end: hmp_handle_error(mon, err); } + +void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *protocol =3D qdict_get_str(qdict, "protocol"); + const char *hostname =3D qdict_get_str(qdict, "hostname"); + bool has_port =3D qdict_haskey(qdict, "port"); + int port =3D qdict_get_try_int(qdict, "port", -1); + bool has_tls_port =3D qdict_haskey(qdict, "tls-port"); + int tls_port =3D qdict_get_try_int(qdict, "tls-port", -1); + const char *cert_subject =3D qdict_get_try_str(qdict, "cert-subject"); + + qmp_client_migrate_info(protocol, hostname, + has_port, port, has_tls_port, tls_port, + cert_subject, &err); + hmp_handle_error(mon, err); +} diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c index dbc4afcd73..a37a7024f3 100644 --- a/ui/ui-qmp-cmds.c +++ b/ui/ui-qmp-cmds.c @@ -175,3 +175,32 @@ void qmp_display_update(DisplayUpdateOptions *arg, Err= or **errp) abort(); } } + +void qmp_client_migrate_info(const char *protocol, const char *hostname, + bool has_port, int64_t port, + bool has_tls_port, int64_t tls_port, + const char *cert_subject, + Error **errp) +{ + if (strcmp(protocol, "spice") =3D=3D 0) { + if (!qemu_using_spice(errp)) { + return; + } + + if (!has_port && !has_tls_port) { + error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port"); + return; + } + + if (qemu_spice.migrate_info(hostname, + has_port ? port : -1, + has_tls_port ? tls_port : -1, + cert_subject)) { + error_setg(errp, "Could not set up display for migration"); + return; + } + return; + } + + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'"); +} --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343627; cv=none; d=zohomail.com; s=zohoarc; b=i8mJc9rxz6ESRC9ejAHs422p3Se27J0fiGDJBaULJAEEDn26TZmcjXQCq6dZSvQF4GWOUxOj9L+qsK09RJQuOriZQPE4h1Sj8X67eyD1sUcsUDzHQnnFp8qwen+mn+p+CVye9knpYYJrPww8tKSkjkIeGQeVRw2/R762ZJ42yB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343627; 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=udgjzQWfjSGOjrMEYhQW64FvW0PuvZliS9XLnkgqz1Y=; b=gqLxvmGMYjZxmJ4O6liXimnx+MrE8aNj5oKaFidEGhCTDFVvy7K+39ePkI1trdy9n3yuh09zmmTjSblXMoonwepYz9Z3eR/wcyW6bZw6Jbqq9FEy+4E++nV+yU1sOo9LXdEHinb2TR0n7Jk06Z8PP5TrMnvEDHK/fD+i21RASB4= 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 1682343626918374.7846897184281; Mon, 24 Apr 2023 06:40:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwF4-0006pc-0t; Mon, 24 Apr 2023 09:28:31 -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 1pqwEV-0006IX-Rz for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwES-0001HQ-LA for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:55 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-616-D9xVDrOGP5akt_x93-hsNQ-1; Mon, 24 Apr 2023 09:27:47 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91BF1101A553; Mon, 24 Apr 2023 13:27:46 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0699914171B8; Mon, 24 Apr 2023 13:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342871; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=udgjzQWfjSGOjrMEYhQW64FvW0PuvZliS9XLnkgqz1Y=; b=HegY8mPrXmVYYVS6dLc5QDbH4MEQ24N30mtS71lYnplN7axvsF0YRotgt7+izav51LCA5l MC0s2DAtF8yy2GH0QAC3o5FzJowKarpCZ2ZPJd571bbJPz9hqN5tut/jqgac1wQQcuS9Le /838H3+HoGdQ3T2A9yMGsh+DNVbSrhc= X-MC-Unique: D9xVDrOGP5akt_x93-hsNQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 04/30] migration: Create migrate_cap_set() Date: Mon, 24 Apr 2023 15:27:04 +0200 Message-Id: <20230424132730.70752-5-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343627848100008 Content-Type: text/plain; charset="utf-8" And remove the convoluted use of qmp_migrate_set_capabilities() to enable disable MIGRATION_CAPABILITY_BLOCK. Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 80bc83f971..e667424513 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1912,25 +1912,24 @@ void migrate_set_state(int *state, int old_state, i= nt new_state) } } =20 -static MigrationCapabilityStatus *migrate_cap_add(MigrationCapability inde= x, - bool state) +static bool migrate_cap_set(int cap, bool value, Error **errp) { - MigrationCapabilityStatus *cap; + MigrationState *s =3D migrate_get_current(); + bool new_caps[MIGRATION_CAPABILITY__MAX]; =20 - cap =3D g_new0(MigrationCapabilityStatus, 1); - cap->capability =3D index; - cap->state =3D state; + if (migration_is_running(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return false; + } =20 - return cap; -} + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + new_caps[cap] =3D value; =20 -void migrate_set_block_enabled(bool value, Error **errp) -{ - MigrationCapabilityStatusList *cap =3D NULL; - - QAPI_LIST_PREPEND(cap, migrate_cap_add(MIGRATION_CAPABILITY_BLOCK, val= ue)); - qmp_migrate_set_capabilities(cap, errp); - qapi_free_MigrationCapabilityStatusList(cap); + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return false; + } + s->capabilities[cap] =3D value; + return true; } =20 static void migrate_set_block_incremental(MigrationState *s, bool value) @@ -1942,7 +1941,7 @@ static void block_cleanup_parameters(MigrationState *= s) { if (s->must_remove_block_options) { /* setting to false can never fail */ - migrate_set_block_enabled(false, &error_abort); + migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); migrate_set_block_incremental(s, false); s->must_remove_block_options =3D false; } @@ -2429,8 +2428,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, "current migration capabilities"); return false; } - migrate_set_block_enabled(true, &local_err); - if (local_err) { + if (!migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, true, &local_err)= ) { error_propagate(errp, local_err); return false; } --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343313; cv=none; d=zohomail.com; s=zohoarc; b=MrQdhX7514RJcZZwkO1Ntx3zlmRaoM6kgxeR2MaYDK/FMbvMZWmZXXCf1ZJT6GXwugqqL5E1FlX3vLSUecvBKkYMB6EVBRjtHVElYrZlx4IuofgFAq8Leo1TQ/+h5nkoD+oKAqopwqc1neeIp3Z265mh/7hrOldKCHFg7voCZA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343313; 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=4eFzJ0Zn5ehq7wgiknQhGZll9Y51cQ68WZ9yohhkjzM=; b=mYohPdjDqwbYWJxIkSrH9UGX6o6+6bG3OtuEYzLn9zUl178zIZ90iJVnEHbz2WmyxGvDdat9FeFxsn2YbRKzzzay5gPQbduUSzm28sBgM4Tg7jC7S58l2xs4lPFyr+UdyJ/m2AMKZYJEHmS5SS/g0mwubP0FwVJsC8onFp0wcoI= 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 1682343313445314.4896368404478; Mon, 24 Apr 2023 06:35:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFe-0007QC-9c; Mon, 24 Apr 2023 09:29:09 -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 1pqwEg-0006RF-Fc for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEc-0001IY-1G for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:06 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-471-egYBLC2wOgKL5b-ijQ4BxQ-1; Mon, 24 Apr 2023 09:27:51 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D740D3C10EC7; Mon, 24 Apr 2023 13:27:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D068314171BA; Mon, 24 Apr 2023 13:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4eFzJ0Zn5ehq7wgiknQhGZll9Y51cQ68WZ9yohhkjzM=; b=eLV0zIZBMau6EMzSM8gaI4aJNfHakRwUuI1FeKsNu0xVwhL7Ci+cMuZlUdB9FvdMx4ueeP 6LaA9GgRDkztsHPGzV3Cqmfipb4fFHdlIvpZ1juo9V1F8MiFFW59cxJUX5S8We/GwxCP2A xcacTdbuyrVmjpsk2SdwFy3ju41748U= X-MC-Unique: egYBLC2wOgKL5b-ijQ4BxQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , "Dr . David Alan Gilbert" Subject: [PULL 05/30] migration: Create options.c Date: Mon, 24 Apr 2023 15:27:05 +0200 Message-Id: <20230424132730.70752-6-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343315508100003 Content-Type: text/plain; charset="utf-8" We move there all capabilities helpers from migration.c. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Following David advise: - looked through the history, capabilities are newer than 2012, so we can remove that bit of the header. - This part is posterior to Anthony. Original Author is Orit. Once there, I put myself. Peter Xu also did quite a bit of work here. Anyone else wants/needs to be there? I didn't search too hard because nobody asked before to be added. What do you think? --- hw/virtio/virtio-balloon.c | 1 + migration/block-dirty-bitmap.c | 1 + migration/block.c | 1 + migration/colo.c | 1 + migration/meson.build | 1 + migration/migration.c | 109 +---------------------------- migration/migration.h | 12 ---- migration/options.c | 124 +++++++++++++++++++++++++++++++++ migration/options.h | 32 +++++++++ migration/postcopy-ram.c | 1 + migration/ram.c | 1 + migration/savevm.c | 1 + migration/socket.c | 1 + 13 files changed, 166 insertions(+), 120 deletions(-) create mode 100644 migration/options.c create mode 100644 migration/options.h diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 746f07c4d2..43092aa634 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -32,6 +32,7 @@ #include "qemu/error-report.h" #include "migration/misc.h" #include "migration/migration.h" +#include "migration/options.h" =20 #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index fe73aa94b1..a6ffae0002 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -79,6 +79,7 @@ #include "qapi/qapi-visit-migration.h" #include "qapi/clone-visitor.h" #include "trace.h" +#include "options.h" =20 #define CHUNK_SIZE (1 << 10) =20 diff --git a/migration/block.c b/migration/block.c index b2497bbd32..4b167fa5cf 100644 --- a/migration/block.c +++ b/migration/block.c @@ -28,6 +28,7 @@ #include "migration/vmstate.h" #include "sysemu/block-backend.h" #include "trace.h" +#include "options.h" =20 #define BLK_MIG_BLOCK_SIZE (1ULL << 20) #define BDRV_SECTORS_PER_DIRTY_CHUNK (BLK_MIG_BLOCK_SIZE >> BDRV_SECTOR_BI= TS) diff --git a/migration/colo.c b/migration/colo.c index 0716e64689..93b78c9270 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -36,6 +36,7 @@ #include "sysemu/cpus.h" #include "sysemu/runstate.h" #include "net/filter.h" +#include "options.h" =20 static bool vmstate_loading; static Notifier packets_compare_notifier; diff --git a/migration/meson.build b/migration/meson.build index 0d1bb9f96e..480ff6854a 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -22,6 +22,7 @@ softmmu_ss.add(files( 'migration.c', 'multifd.c', 'multifd-zlib.c', + 'options.c', 'postcopy-ram.c', 'savevm.c', 'socket.c', diff --git a/migration/migration.c b/migration/migration.c index e667424513..d8c9166200 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -63,6 +63,7 @@ #include "sysemu/cpus.h" #include "yank_functions.h" #include "sysemu/qtest.h" +#include "options.h" =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 @@ -357,15 +358,6 @@ static void migrate_generate_event(int new_state) } } =20 -static bool migrate_late_block_activate(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; -} - /* * Send a message on the return channel back to the source * of the migration. @@ -2525,56 +2517,11 @@ void qmp_migrate_continue(MigrationStatus state, Er= ror **errp) qemu_sem_post(&s->pause_sem); } =20 -bool migrate_release_ram(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; -} - -bool migrate_postcopy_ram(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; -} - bool migrate_postcopy(void) { return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -bool migrate_auto_converge(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; -} - -bool migrate_zero_blocks(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; -} - -bool migrate_postcopy_blocktime(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; -} - bool migrate_use_compression(void) { MigrationState *s; @@ -2620,33 +2567,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 -bool migrate_dirty_bitmaps(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; -} - -bool migrate_ignore_shared(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; -} - -bool migrate_validate_uuid(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; -} - bool migrate_use_events(void) { MigrationState *s; @@ -2665,15 +2585,6 @@ bool migrate_use_multifd(void) return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 -bool migrate_pause_before_switchover(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; -} - int migrate_multifd_channels(void) { MigrationState *s; @@ -2785,24 +2696,6 @@ bool migrate_use_block_incremental(void) return s->parameters.block_incremental; } =20 -bool migrate_background_snapshot(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; -} - -bool migrate_postcopy_preempt(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 04e0860b4e..a25fed6ef0 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,16 +449,7 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -bool migrate_release_ram(void); -bool migrate_postcopy_ram(void); -bool migrate_zero_blocks(void); -bool migrate_dirty_bitmaps(void); -bool migrate_ignore_shared(void); -bool migrate_validate_uuid(void); - -bool migrate_auto_converge(void); bool migrate_use_multifd(void); -bool migrate_pause_before_switchover(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); @@ -487,9 +478,6 @@ int migrate_compress_threads(void); int migrate_compress_wait_thread(void); int migrate_decompress_threads(void); bool migrate_use_events(void); -bool migrate_postcopy_blocktime(void); -bool migrate_background_snapshot(void); -bool migrate_postcopy_preempt(void); =20 /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, diff --git a/migration/options.c b/migration/options.c new file mode 100644 index 0000000000..88a9a45913 --- /dev/null +++ b/migration/options.c @@ -0,0 +1,124 @@ +/* + * QEMU migration capabilities + * + * Copyright (c) 2012-2023 Red Hat Inc + * + * Authors: + * Orit Wasserman + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "migration.h" +#include "options.h" + +bool migrate_auto_converge(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; +} + +bool migrate_background_snapshot(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; +} + +bool migrate_dirty_bitmaps(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; +} + +bool migrate_ignore_shared(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; +} + +bool migrate_late_block_activate(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; +} + +bool migrate_pause_before_switchover(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; +} + +bool migrate_postcopy_blocktime(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; +} + +bool migrate_postcopy_preempt(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; +} + +bool migrate_postcopy_ram(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; +} + +bool migrate_release_ram(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; +} + +bool migrate_validate_uuid(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; +} + +bool migrate_zero_blocks(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; +} diff --git a/migration/options.h b/migration/options.h new file mode 100644 index 0000000000..0dfa0af245 --- /dev/null +++ b/migration/options.h @@ -0,0 +1,32 @@ +/* + * QEMU migration capabilities + * + * Copyright (c) 2012-2023 Red Hat Inc + * + * Authors: + * Orit Wasserman + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_MIGRATION_OPTIONS_H +#define QEMU_MIGRATION_OPTIONS_H + +/* capabilities */ + +bool migrate_auto_converge(void); +bool migrate_background_snapshot(void); +bool migrate_dirty_bitmaps(void); +bool migrate_ignore_shared(void); +bool migrate_late_block_activate(void); +bool migrate_pause_before_switchover(void); +bool migrate_postcopy_blocktime(void); +bool migrate_postcopy_preempt(void); +bool migrate_postcopy_ram(void); +bool migrate_release_ram(void); +bool migrate_validate_uuid(void); +bool migrate_zero_blocks(void); + +#endif diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index d7b48dd920..0711500036 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -37,6 +37,7 @@ #include "tls.h" #include "qemu/userfaultfd.h" #include "qemu/mmap-alloc.h" +#include "options.h" =20 /* Arbitrary limit on size of each discard command, * keeps them around ~200 bytes diff --git a/migration/ram.c b/migration/ram.c index 229714045a..912ccd89fa 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -57,6 +57,7 @@ #include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "options.h" =20 #include "hw/boards.h" /* for machine_dump_guest_core() */ =20 diff --git a/migration/savevm.c b/migration/savevm.c index 589ef926ab..ebcf571e37 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -67,6 +67,7 @@ #include "qemu/yank.h" #include "yank_functions.h" #include "sysemu/qtest.h" +#include "options.h" =20 const unsigned int postcopy_ram_discard_version; =20 diff --git a/migration/socket.c b/migration/socket.c index e6fdf3c5e1..ebf9ac41af 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -27,6 +27,7 @@ #include "io/net-listener.h" #include "trace.h" #include "postcopy-ram.h" +#include "options.h" =20 struct SocketOutgoingArgs { SocketAddress *saddr; --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343300; cv=none; d=zohomail.com; s=zohoarc; b=LXFeDlocoD9xSXdoKw0pt7N6vqZ25faEN247Se2VW6e9S/3UlAEMRHDWaHxYcaE6hxPFBesmXtSluwe2m/PQT8J2V6HVEQKZMyOtnt/Zuw6bkHPXg7wM28ifCDxOF4WQqdseaq3I0QF3V5sIsWDD5zAWkMXDkUPqJirBmrmlKVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343300; 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=/qN2Z3OFhk0+jCKZH+8XTd3cVrrVdDBuNBmTpza50kc=; b=N5BxAlLKwVHaZoYoumDQwrdH3lgR1dx+3CalRkylzq1C+Fq9vu4bc0nvwNgHvJJc+uc73uphL/W1+B/yl8/Ynap3S4cVqdTpWiEj16mn0ZjkP7Li2CMMYbwZ+iXen698X41SU7j3qLKwjP+4FSe/PmNQJ2TSr9DoybiYdNmL9Ww= 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 1682343300175827.1680485220819; Mon, 24 Apr 2023 06:35:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFi-0007SK-G9; Mon, 24 Apr 2023 09:29:11 -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 1pqwEY-0006Il-7j for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEW-0001Hz-JV for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:27:57 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-49-u8Z6L3T-OLyX_or29Mul6g-1; Mon, 24 Apr 2023 09:27:54 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9F1887A9E2; Mon, 24 Apr 2023 13:27:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C0D214171B8; Mon, 24 Apr 2023 13:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/qN2Z3OFhk0+jCKZH+8XTd3cVrrVdDBuNBmTpza50kc=; b=dhA2fLflpH2NJrXDSSYqOdgVfaxfn9I4NeklexngkSgzptJaea2HWQXXkEbmxo382vFR6W 9Yor0YkNBMGmL+aJdSqLDpu6PGECQnCseZd9TIFdiRBN1GaEhW6g1ALab+SVXpLw08eTcc MNxOZ/e1/yRmb323NFDFuANvmkTbX+o= X-MC-Unique: u8Z6L3T-OLyX_or29Mul6g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 06/30] migration: Move migrate_colo_enabled() to options.c Date: Mon, 24 Apr 2023 15:27:06 +0200 Message-Id: <20230424132730.70752-7-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343301340100001 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_colo() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 16 +++++----------- migration/migration.h | 1 - migration/options.c | 6 ++++++ migration/options.h | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d8c9166200..7dfc31eeb8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2411,7 +2411,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, } =20 if (blk || blk_inc) { - if (migrate_colo_enabled()) { + if (migrate_colo()) { error_setg(errp, "No disk migration is required in COLO mode"); return false; } @@ -3299,7 +3299,7 @@ static void migration_completion(MigrationState *s) MIGRATION_STATUS_DEVICE); } if (ret >=3D 0) { - s->block_inactive =3D !migrate_colo_enabled(); + s->block_inactive =3D !migrate_colo(); qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX); ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file,= false, s->block_inactive= ); @@ -3352,7 +3352,7 @@ static void migration_completion(MigrationState *s) goto fail_invalidate; } =20 - if (migrate_colo_enabled() && s->state =3D=3D MIGRATION_STATUS_ACTIVE)= { + if (migrate_colo() && s->state =3D=3D MIGRATION_STATUS_ACTIVE) { /* COLO does not support postcopy */ migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); @@ -3431,12 +3431,6 @@ fail: MIGRATION_STATUS_FAILED); } =20 -bool migrate_colo_enabled(void) -{ - MigrationState *s =3D migrate_get_current(); - return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; -} - typedef enum MigThrError { /* No error detected */ MIG_THR_ERR_NONE =3D 0, @@ -3767,7 +3761,7 @@ static void migration_iteration_finish(MigrationState= *s) runstate_set(RUN_STATE_POSTMIGRATE); break; case MIGRATION_STATUS_COLO: - if (!migrate_colo_enabled()) { + if (!migrate_colo()) { error_report("%s: critical error: calling COLO code without " "COLO enabled", __func__); } @@ -3963,7 +3957,7 @@ static void *migration_thread(void *opaque) qemu_savevm_send_postcopy_advise(s->to_dst_file); } =20 - if (migrate_colo_enabled()) { + if (migrate_colo()) { /* Notify migration destination that we enable COLO */ qemu_savevm_send_colo_enable(s->to_dst_file); } diff --git a/migration/migration.h b/migration/migration.h index a25fed6ef0..42f0c68b6f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -463,7 +463,6 @@ bool migrate_use_zero_copy_send(void); int migrate_use_tls(void); int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); -bool migrate_colo_enabled(void); =20 bool migrate_use_block(void); bool migrate_use_block_incremental(void); diff --git a/migration/options.c b/migration/options.c index 88a9a45913..bd33c5da0a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -33,6 +33,12 @@ bool migrate_background_snapshot(void) return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 +bool migrate_colo(void) +{ + MigrationState *s =3D migrate_get_current(); + return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; +} + bool migrate_dirty_bitmaps(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 0dfa0af245..2a0ee61ff8 100644 --- a/migration/options.h +++ b/migration/options.h @@ -18,6 +18,7 @@ =20 bool migrate_auto_converge(void); bool migrate_background_snapshot(void); +bool migrate_colo(void); bool migrate_dirty_bitmaps(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343260; cv=none; d=zohomail.com; s=zohoarc; b=TpAggas27Z3+o7uYMk2EgC6G+7koy8vlt7jLuAT++GhNerOSF8oYLwKlkXXZ9TH0gFWyVxIHt2dMRoqj3L1iMfrjvhKRTI1COPDiUQwPUUgD2HItEg1qwmtb+naysSMekaGU8wmNm4IhZ27CQ8s9p2J8zIbqyNhluk0z8fuPhak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343260; 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=EN1BUpJu1HWmawQ17B+vRE6zhxn0ngY3v0wnH/r7R+c=; b=YpfAn47ONC747B4QFrsbxQHUukJ3/mG07Sm+6Yy6IzXPWQaS4yK5zrN9I4AH/FPv9yWQTPxoXrW8gyC67ihSHzgm2zUDohbjreNLeqkhNV969VDcQ7yplXqL3zwXrknkJaOkLUYlrt4D9GhG56GC8ASd9CW8LlkUpo7YpxO+evE= 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 1682343260329694.9484518293701; Mon, 24 Apr 2023 06:34:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwF3-0006p9-JL; Mon, 24 Apr 2023 09:28:29 -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 1pqwEi-0006SV-F6 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEa-0001IW-CE for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:07 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-232-jqXUHsFyPS-JGE9Ed7BvcQ-1; Mon, 24 Apr 2023 09:27:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A656487A9E0; Mon, 24 Apr 2023 13:27:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1460E14171BA; Mon, 24 Apr 2023 13:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EN1BUpJu1HWmawQ17B+vRE6zhxn0ngY3v0wnH/r7R+c=; b=d1LBoLh8rBFv5OALzzwoDlx51tlgPPaDnILtWNevuYa1zUoYK2rc5+0N5bJaa0SBifHFg1 kLftAxKUxEYfJRKdCOZp3nI3vTgHzaBa0fH/YfZksPY1sQAyE13Nt7fvnGXoU42eLooZSt N4bbGikWBobe45WReUinzVMleY+blAg= X-MC-Unique: jqXUHsFyPS-JGE9Ed7BvcQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 07/30] migration: Move migrate_use_compression() to options.c Date: Mon, 24 Apr 2023 15:27:07 +0200 Message-Id: <20230424132730.70752-8-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343261066100001 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_compress() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 7dfc31eeb8..2c409fa27c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1133,7 +1133,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->xbzrle_cache->overflow =3D xbzrle_counters.overflow; } =20 - if (migrate_use_compression()) { + if (migrate_compress()) { info->compression =3D g_malloc0(sizeof(*info->compression)); info->compression->pages =3D compression_counters.pages; info->compression->busy =3D compression_counters.busy; @@ -2522,15 +2522,6 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -bool migrate_use_compression(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; -} - int migrate_compress_level(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 42f0c68b6f..77aa91c840 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -471,7 +471,6 @@ bool migrate_use_return_path(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 -bool migrate_use_compression(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); diff --git a/migration/options.c b/migration/options.c index bd33c5da0a..fa7a13d3dc 100644 --- a/migration/options.c +++ b/migration/options.c @@ -39,6 +39,15 @@ bool migrate_colo(void) return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; } =20 +bool migrate_compress(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; +} + bool migrate_dirty_bitmaps(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 2a0ee61ff8..da2193fd94 100644 --- a/migration/options.h +++ b/migration/options.h @@ -19,6 +19,7 @@ bool migrate_auto_converge(void); bool migrate_background_snapshot(void); bool migrate_colo(void); +bool migrate_compress(void); bool migrate_dirty_bitmaps(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); diff --git a/migration/ram.c b/migration/ram.c index 912ccd89fa..d050d0c5fd 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -586,7 +586,7 @@ static void compress_threads_save_cleanup(void) { int i, thread_count; =20 - if (!migrate_use_compression() || !comp_param) { + if (!migrate_compress() || !comp_param) { return; } =20 @@ -625,7 +625,7 @@ static int compress_threads_save_setup(void) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } thread_count =3D migrate_compress_threads(); @@ -1155,7 +1155,7 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) rs->xbzrle_bytes_prev =3D xbzrle_counters.bytes; } =20 - if (migrate_use_compression()) { + if (migrate_compress()) { compression_counters.busy_rate =3D (double)(compression_counters.b= usy - rs->compress_thread_busy_prev) / page_count; rs->compress_thread_busy_prev =3D compression_counters.busy; @@ -2270,7 +2270,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr= _t start, ram_addr_t len) =20 static bool save_page_use_compression(RAMState *rs) { - if (!migrate_use_compression()) { + if (!migrate_compress()) { return false; } =20 @@ -3734,7 +3734,7 @@ static int wait_for_decompress_done(void) { int idx, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } =20 @@ -3753,7 +3753,7 @@ static void compress_threads_load_cleanup(void) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return; } thread_count =3D migrate_decompress_threads(); @@ -3794,7 +3794,7 @@ static int compress_threads_load_setup(QEMUFile *f) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } =20 @@ -4260,7 +4260,7 @@ static int ram_load_precopy(QEMUFile *f) int flags =3D 0, ret =3D 0, invalid_flags =3D 0, len =3D 0, i =3D 0; /* ADVISE is earlier, it shows the source has the postcopy capability = on */ bool postcopy_advised =3D migration_incoming_postcopy_advised(); - if (!migrate_use_compression()) { + if (!migrate_compress()) { invalid_flags |=3D RAM_SAVE_FLAG_COMPRESS_PAGE; } =20 --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343482; cv=none; d=zohomail.com; s=zohoarc; b=nbFjPU4yzYSrHnqzhLAPVXkSvK3KmFoal0MacCxrzrduzCINUSp4Cb2jp3Wuc4NB17EmBrjXtCzN6wqU7M5ROaytwn7+zFWcHxndLnGfoHo+MEP29+fP9NjXTPKRGymVUUs/L6m+JJqFSS9XpD+HdzbJu40kxb4DHLPwG0hsP3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343482; 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=XOqQ3mEQyXxMfcm7V3aOqynSHUTQaxXWKv+Y9TcpCqE=; b=YTSy1uBZeIfzUPDx53IUcf3gKPRv+QakHxr2ybXaINM3WwzynBm2E0gMfgB/52pNPoO0HGgf0kC4mnrQX4E7k4I9L8MGQh4heRbNdT94piv/2U+fBbM4rkl39PtuzjIa7rD7HWrqumGluW3Y6E4bdDAnQ0eaLNe+yBN9CrNDzMk= 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 1682343482945895.1326726385156; Mon, 24 Apr 2023 06:38:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwF0-0006kv-7Q; Mon, 24 Apr 2023 09:28:26 -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 1pqwEi-0006UK-Pj for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEf-0001Ke-1Y for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:08 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-17-UjKFJfjyNb2epSX6OP6prQ-1; Mon, 24 Apr 2023 09:28:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58B793C10EC7; Mon, 24 Apr 2023 13:28:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7A3F14171BA; Mon, 24 Apr 2023 13:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XOqQ3mEQyXxMfcm7V3aOqynSHUTQaxXWKv+Y9TcpCqE=; b=HdSCHUyhHBoIOlLsS2/mcY1zgXXZvZ0r8ZhVeYa8iShfOH0pSLE56nHgW8pifQv96N12aX vzwutFiUXgGx325WWWsMD6wG4peLiP8sYzeHHrhBekF34gYsqFeH0sxDyixmK69pjozEQ5 S7APXF0K73C0/ik0iS8vJuOGmfIc18o= X-MC-Unique: UjKFJfjyNb2epSX6OP6prQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 08/30] migration: Move migrate_use_events() to options.c Date: Mon, 24 Apr 2023 15:27:08 +0200 Message-Id: <20230424132730.70752-9-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343484071100003 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_events() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2c409fa27c..16800a624a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -353,7 +353,7 @@ void migration_incoming_state_destroy(void) =20 static void migrate_generate_event(int new_state) { - if (migrate_use_events()) { + if (migrate_events()) { qapi_event_send_migration(new_state); } } @@ -2558,15 +2558,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 -bool migrate_use_events(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; -} - bool migrate_use_multifd(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 77aa91c840..bd06520c19 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -475,7 +475,6 @@ int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); int migrate_decompress_threads(void); -bool migrate_use_events(void); =20 /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, diff --git a/migration/options.c b/migration/options.c index fa7a13d3dc..d2219ee0e4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -57,6 +57,15 @@ bool migrate_dirty_bitmaps(void) return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 +bool migrate_events(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; +} + bool migrate_ignore_shared(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index da2193fd94..b998024eba 100644 --- a/migration/options.h +++ b/migration/options.h @@ -21,6 +21,7 @@ bool migrate_background_snapshot(void); bool migrate_colo(void); bool migrate_compress(void); bool migrate_dirty_bitmaps(void); +bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); bool migrate_pause_before_switchover(void); diff --git a/migration/ram.c b/migration/ram.c index d050d0c5fd..ee454a3849 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1246,7 +1246,7 @@ static void migration_bitmap_sync(RAMState *rs) rs->num_dirty_pages_period =3D 0; rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } - if (migrate_use_events()) { + if (migrate_events()) { uint64_t generation =3D stat64_get(&ram_counters.dirty_sync_count); qapi_event_send_migration_pass(generation); } --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343364; cv=none; d=zohomail.com; s=zohoarc; b=iNuY7ysjdg6nDaq+Z/jfSLV+MhsbC5Xs9vj5Vji9czzWOV5FQIMNFSJGwHRiq57xHxUR6Ti2cwgaedoMXDmmrnGvfjQz+NmhOTgB4AFLTqC9FZASMmfyKz0dU8yaun3vfk1M68rzdTPY2B4arUz/3CbiyNlr5uLfWW58ztHa6no= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343364; 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=dA1YRXtNehBHbK3vNPyVEoRiAwSluNyC6adRuCvp5jQ=; b=FjCMZgDh+jyw8JvU0OwlTM7CFCdb/nh2h4L2aPiSgprPFIR2vGH/VUh7DyMN1XZbLG7QWoDQomAl9s7QiTWdNPdnGQUjlNZC1Jn9aAfPMGfft4kkTGtbY1zZfWXSxILgMtyRycASyJvCXgMnpzw/CbFJpxr9IJmB0hxJczlPApM= 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 1682343364335370.4833133121217; Mon, 24 Apr 2023 06:36:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFp-0007zx-As; Mon, 24 Apr 2023 09:29:17 -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 1pqwEl-0006Vs-Cn for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEj-0001Ok-LM for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:11 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-4_G4hZH9NJK6PxK-rOTRxQ-1; Mon, 24 Apr 2023 09:28:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E9963815F7B; Mon, 24 Apr 2023 13:28:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9777F14171B8; Mon, 24 Apr 2023 13:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dA1YRXtNehBHbK3vNPyVEoRiAwSluNyC6adRuCvp5jQ=; b=Y9/KbSNnYQGpShToOWqsFLJdWCqRj0iCmzvMuPjDARu5FjQ9rNWA8UrwXAuhHX6iBL4mcl w/6iu8bPmoODejEoKMgkBOjzD2cn3g2MZLxbr6rGLr0r+1PzG7KJY/h2aCbi/pXFMLvtVL /cgx5XqEMhJ9ybb92/Jjozjjc4wZ+WQ= X-MC-Unique: 4_G4hZH9NJK6PxK-rOTRxQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 09/30] migration: Move migrate_use_multifd() to options.c Date: Mon, 24 Apr 2023 15:27:09 +0200 Message-Id: <20230424132730.70752-10-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343364529100001 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_multifd() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 19 +++++-------------- migration/migration.h | 1 - migration/multifd.c | 16 ++++++++-------- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- migration/socket.c | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 16800a624a..77ceacc59f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -186,7 +186,7 @@ static void migrate_fd_cancel(MigrationState *s); =20 static bool migration_needs_multiple_sockets(void) { - return migrate_use_multifd() || migrate_postcopy_preempt(); + return migrate_multifd() || migrate_postcopy_preempt(); } =20 static bool uri_supports_multi_channels(const char *uri) @@ -732,7 +732,7 @@ void migration_fd_process_incoming(QEMUFile *f, Error *= *errp) static bool migration_should_start_incoming(bool main_channel) { /* Multifd doesn't start unless all channels are established */ - if (migrate_use_multifd()) { + if (migrate_multifd()) { return migration_has_all_channels(); } =20 @@ -759,7 +759,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Er= ror **errp) uint32_t channel_magic =3D 0; int ret =3D 0; =20 - if (migrate_use_multifd() && !migrate_postcopy_ram() && + if (migrate_multifd() && !migrate_postcopy_ram() && qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK)) { /* * With multiple channels, it is possible that we receive channels @@ -798,7 +798,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Er= ror **errp) } else { /* Multiple connections */ assert(migration_needs_multiple_sockets()); - if (migrate_use_multifd()) { + if (migrate_multifd()) { multifd_recv_new_channel(ioc, &local_err); } else { assert(migrate_postcopy_preempt()); @@ -834,7 +834,7 @@ bool migration_has_all_channels(void) return false; } =20 - if (migrate_use_multifd()) { + if (migrate_multifd()) { return multifd_recv_all_channels_created(); } =20 @@ -2558,15 +2558,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 -bool migrate_use_multifd(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; -} - int migrate_multifd_channels(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index bd06520c19..49c0e13f41 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,7 +449,6 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -bool migrate_use_multifd(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); diff --git a/migration/multifd.c b/migration/multifd.c index 903df2117b..6807328189 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -516,7 +516,7 @@ void multifd_save_cleanup(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_send_terminate_threads(NULL); @@ -587,7 +587,7 @@ int multifd_send_sync_main(QEMUFile *f) int i; bool flush_zero_copy; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return 0; } if (multifd_send_state->pages->num) { @@ -911,7 +911,7 @@ int multifd_save_setup(Error **errp) uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); uint8_t i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return 0; } =20 @@ -1016,7 +1016,7 @@ static void multifd_recv_terminate_threads(Error *err) =20 void multifd_load_shutdown(void) { - if (migrate_use_multifd()) { + if (migrate_multifd()) { multifd_recv_terminate_threads(NULL); } } @@ -1025,7 +1025,7 @@ void multifd_load_cleanup(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_recv_terminate_threads(NULL); @@ -1072,7 +1072,7 @@ void multifd_recv_sync_main(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } for (i =3D 0; i < migrate_multifd_channels(); i++) { @@ -1170,7 +1170,7 @@ int multifd_load_setup(Error **errp) * Return successfully if multiFD recv state is already initialised * or multiFD is not enabled. */ - if (multifd_recv_state || !migrate_use_multifd()) { + if (multifd_recv_state || !migrate_multifd()) { return 0; } =20 @@ -1216,7 +1216,7 @@ bool multifd_recv_all_channels_created(void) { int thread_count =3D migrate_multifd_channels(); =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return true; } =20 diff --git a/migration/options.c b/migration/options.c index d2219ee0e4..58673fc101 100644 --- a/migration/options.c +++ b/migration/options.c @@ -84,6 +84,15 @@ bool migrate_late_block_activate(void) return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } =20 +bool migrate_multifd(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; +} + bool migrate_pause_before_switchover(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index b998024eba..d07269ee38 100644 --- a/migration/options.h +++ b/migration/options.h @@ -24,6 +24,7 @@ bool migrate_dirty_bitmaps(void); bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); +bool migrate_multifd(void); bool migrate_pause_before_switchover(void); bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); diff --git a/migration/ram.c b/migration/ram.c index ee454a3849..859dd7b63f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2362,7 +2362,7 @@ static int ram_save_target_page_legacy(RAMState *rs, = PageSearchStatus *pss) * if host page size =3D=3D guest page size the dest guest during run = may * still see partially copied pages which is data corruption. */ - if (migrate_use_multifd() && !migration_in_postcopy()) { + if (migrate_multifd() && !migration_in_postcopy()) { return ram_save_multifd_page(pss->pss_channel, block, offset); } =20 diff --git a/migration/socket.c b/migration/socket.c index ebf9ac41af..f4835a256a 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -183,7 +183,7 @@ socket_start_incoming_migration_internal(SocketAddress = *saddr, =20 qio_net_listener_set_name(listener, "migration-socket-listener"); =20 - if (migrate_use_multifd()) { + if (migrate_multifd()) { num =3D migrate_multifd_channels(); } else if (migrate_postcopy_preempt()) { num =3D RAM_CHANNEL_MAX; --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343173; cv=none; d=zohomail.com; s=zohoarc; b=J2q2njqfiH+kngbhfrlIbaTXk+iR0/8YAogG5a7CKlz8iKGKEbHAiMUtYE/FI67szB+GaP4Vx7g4e0WHZxiLelhI7YvMsiu8CnKDxJmAQaaOnDM52lJza/tl8CZlElyTu+viD5IgkftzePl3uHOAvNSAst/b/tYAqcdMyEXhkIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343173; 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=hZqO/SlEbkj/z3pDxN0l3VHonLMpOLqG2ZBM0bMR4sk=; b=BvF64PFs+3WMfhtpwhySkOKOI4S63xHk3w3rRkJVvvlae3orh9YFj5MYTwwr3ofXo63d1nalU/lGG+35NMUPJoi/ht88u6L2w1wsQmClEVvrZvLnJFqvB2J5yxYaMc/sOHP9QKgDLDIGF4ZALUUDb2izk3vi42xjzcprpL3F2Xk= 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 1682343173769390.8222254941277; Mon, 24 Apr 2023 06:32:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFQ-00073V-KZ; Mon, 24 Apr 2023 09:28:55 -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 1pqwEo-0006Yd-OZ for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEm-0001PM-2r for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-126-kJknlJm3OtmmoIIPDf3RoQ-1; Mon, 24 Apr 2023 09:28:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03180185A7A7; Mon, 24 Apr 2023 13:28:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D6F814171B8; Mon, 24 Apr 2023 13:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hZqO/SlEbkj/z3pDxN0l3VHonLMpOLqG2ZBM0bMR4sk=; b=Vwp3XaTaJrCjk2M/7ZgDBiGnKb2kaSYZY1nq/LSDnfABIJ3JfbEiiEaZi61ixQaOpysCDW wRgUDE0th8i7RUuhJ3Axdo/wv4ggUbbRVC8QX2OJetUhdZ/2GVDo2oFErSmPfeuCo/LNt4 PCHdflT8Tj/CmMDoD0rY4XNJxiXFc00= X-MC-Unique: kJknlJm3OtmmoIIPDf3RoQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 10/30] migration: Move migrate_use_zero_copy_send() to options.c Date: Mon, 24 Apr 2023 15:27:10 +0200 Message-Id: <20230424132730.70752-11-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343175847100001 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_zero_copy_send() to be consistent with all other capabilities. We can remove the CONFIG_LINUX guard. We already check that we can't setup this capability in migrate_caps_check(). Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 13 +------------ migration/migration.h | 5 ----- migration/multifd.c | 8 ++++---- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/socket.c | 2 +- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 77ceacc59f..fbb61819ca 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1609,7 +1609,7 @@ static bool migrate_params_check(MigrationParameters = *params, Error **errp) } =20 #ifdef CONFIG_LINUX - if (migrate_use_zero_copy_send() && + if (migrate_zero_copy_send() && ((params->has_multifd_compression && params->multifd_compression) = || (params->tls_creds && *params->tls_creds))) { error_setg(errp, @@ -2595,17 +2595,6 @@ int migrate_multifd_zstd_level(void) return s->parameters.multifd_zstd_level; } =20 -#ifdef CONFIG_LINUX -bool migrate_use_zero_copy_send(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; -} -#endif - int migrate_use_tls(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 49c0e13f41..c939f82d53 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -454,11 +454,6 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); =20 -#ifdef CONFIG_LINUX -bool migrate_use_zero_copy_send(void); -#else -#define migrate_use_zero_copy_send() (false) -#endif int migrate_use_tls(void); int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); diff --git a/migration/multifd.c b/migration/multifd.c index 6807328189..cce3ad6988 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -25,7 +25,7 @@ #include "trace.h" #include "multifd.h" #include "threadinfo.h" - +#include "options.h" #include "qemu/yank.h" #include "io/channel-socket.h" #include "yank_functions.h" @@ -608,7 +608,7 @@ int multifd_send_sync_main(QEMUFile *f) * all the dirty bitmaps. */ =20 - flush_zero_copy =3D migrate_use_zero_copy_send(); + flush_zero_copy =3D migrate_zero_copy_send(); =20 for (i =3D 0; i < migrate_multifd_channels(); i++) { MultiFDSendParams *p =3D &multifd_send_state->params[i]; @@ -653,7 +653,7 @@ static void *multifd_send_thread(void *opaque) MigrationThread *thread =3D NULL; Error *local_err =3D NULL; int ret =3D 0; - bool use_zero_copy_send =3D migrate_use_zero_copy_send(); + bool use_zero_copy_send =3D migrate_zero_copy_send(); =20 thread =3D MigrationThreadAdd(p->name, qemu_get_thread_id()); =20 @@ -945,7 +945,7 @@ int multifd_save_setup(Error **errp) p->page_size =3D qemu_target_page_size(); p->page_count =3D page_count; =20 - if (migrate_use_zero_copy_send()) { + if (migrate_zero_copy_send()) { p->write_flags =3D QIO_CHANNEL_WRITE_FLAG_ZERO_COPY; } else { p->write_flags =3D 0; diff --git a/migration/options.c b/migration/options.c index 58673fc101..f357c99996 100644 --- a/migration/options.c +++ b/migration/options.c @@ -155,3 +155,12 @@ bool migrate_zero_blocks(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } + +bool migrate_zero_copy_send(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; +} diff --git a/migration/options.h b/migration/options.h index d07269ee38..ad22f4d24a 100644 --- a/migration/options.h +++ b/migration/options.h @@ -32,5 +32,6 @@ bool migrate_postcopy_ram(void); bool migrate_release_ram(void); bool migrate_validate_uuid(void); bool migrate_zero_blocks(void); +bool migrate_zero_copy_send(void); =20 #endif diff --git a/migration/socket.c b/migration/socket.c index f4835a256a..1b6f5baefb 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -98,7 +98,7 @@ static void socket_outgoing_migration(QIOTask *task, =20 trace_migration_socket_outgoing_connected(data->hostname); =20 - if (migrate_use_zero_copy_send() && + if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { error_setg(&err, "Zero copy send feature not detected in host kern= el"); } --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343564; cv=none; d=zohomail.com; s=zohoarc; b=b1udGEbW0Bpi1SBRHzwSSMmC+KN1CPm34tBARip8Zs2YkSx9AwCXHb3R6ibu8w0WlcZY3ISpoXHd9t1SnFjDvmQ9oDmXYpT6v5mYX7IQzEEh7skgtRHB8POxxNsQ4H32xjzeBEuUJ8jXROK3S2ZClDirT2Ywqtf1jCG1De2PCRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343564; 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=q9ahs+q7FcUaSl0xPsWuyFe/zAiH38ZcWWKpoDRd9rA=; b=Yh05JjT+Mt6CmslIqDtmN9Wxl2nGQD1Fl8gccmPhbwAt1Le32IUPRp4vIQqAG21+WPNpdg0xsS88avAu59z+8NvfL+8PgGrPKo8JpW2sdgWFmQTfUNNmDoN958ipWoapKxzHAC1mjU3AxLIDFRIgIG/t7KrwHiqiVpD7Dq6XHvk= 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 1682343564494492.26501858806535; Mon, 24 Apr 2023 06:39:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFn-0007nq-3N; Mon, 24 Apr 2023 09:29:15 -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 1pqwEq-0006bK-L9 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEn-0001Qa-A5 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-h4aK7-PsMxynvlsNYRLDAg-1; Mon, 24 Apr 2023 09:28:09 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D971C3815F69; Mon, 24 Apr 2023 13:28:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4291414171B8; Mon, 24 Apr 2023 13:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q9ahs+q7FcUaSl0xPsWuyFe/zAiH38ZcWWKpoDRd9rA=; b=AQiFGaOStTje9Tk2raM4kZDXDy43z4yapc86EN7qdYhRjWTyCrpMrCQcbUMIoXmF080GZ2 Xsr/Qte6YDpMPFR4Y4sPiGeMLlF9TqEJkX3O6LsFOlMqxW5RskQ7kNEoswPYgyEx5vOP27 phXdySmMGbEpaNp8t9/8HNBfw6S7weA= X-MC-Unique: h4aK7-PsMxynvlsNYRLDAg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 11/30] migration: Move migrate_use_xbzrle() to options.c Date: Mon, 24 Apr 2023 15:27:11 +0200 Message-Id: <20230424132730.70752-12-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343565679100008 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_xbzrle() to be consistent with all other capabilities. We change the type to return bool also for consistency. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index fbb61819ca..abb820cdb9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1122,7 +1122,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->downtime_bytes =3D stat64_get(&ram_counters.downtime_bytes); info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { info->xbzrle_cache =3D g_malloc0(sizeof(*info->xbzrle_cache)); info->xbzrle_cache->cache_size =3D migrate_xbzrle_cache_size(); info->xbzrle_cache->bytes =3D xbzrle_counters.bytes; @@ -2604,15 +2604,6 @@ int migrate_use_tls(void) return s->parameters.tls_creds && *s->parameters.tls_creds; } =20 -int migrate_use_xbzrle(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; -} - uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index c939f82d53..e2bb5b1e2f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -455,7 +455,6 @@ int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); =20 int migrate_use_tls(void); -int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); =20 bool migrate_use_block(void); diff --git a/migration/options.c b/migration/options.c index f357c99996..25264c500e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -147,6 +147,15 @@ bool migrate_validate_uuid(void) return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; } =20 +bool migrate_xbzrle(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; +} + bool migrate_zero_blocks(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index ad22f4d24a..8f76a88329 100644 --- a/migration/options.h +++ b/migration/options.h @@ -31,6 +31,7 @@ bool migrate_postcopy_preempt(void); bool migrate_postcopy_ram(void); bool migrate_release_ram(void); bool migrate_validate_uuid(void); +bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 diff --git a/migration/ram.c b/migration/ram.c index 859dd7b63f..4576d0d849 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -156,14 +156,14 @@ static struct { =20 static void XBZRLE_cache_lock(void) { - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { qemu_mutex_lock(&XBZRLE.lock); } } =20 static void XBZRLE_cache_unlock(void) { - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { qemu_mutex_unlock(&XBZRLE.lock); } } @@ -1137,7 +1137,7 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) return; } =20 - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { double encoded_size, unencoded_size; =20 xbzrle_counters.cache_miss_rate =3D (double)(xbzrle_counters.cache= _miss - @@ -1626,7 +1626,7 @@ static int find_dirty_block(RAMState *rs, PageSearchS= tatus *pss) /* Flag that we've looped */ pss->complete_round =3D true; /* After the first round, enable XBZRLE. */ - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { rs->xbzrle_enabled =3D true; } } @@ -2979,7 +2979,7 @@ static int xbzrle_init(void) { Error *local_err =3D NULL; =20 - if (!migrate_use_xbzrle()) { + if (!migrate_xbzrle()) { return 0; } =20 --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343564; cv=none; d=zohomail.com; s=zohoarc; b=lDVUZOGsjRUD0DGnQkGG3u85T3/+Jn9tcz219eM149RK5tMw3qES2OtxEyo6wRJTHQrwdnKEFfDkxcILo6/bk2WQUCTqXB+ZaWIuGnJOqonQgvxG94i0ABAOf/1O3G/fVq6MIvc/YeyCFQSfKHsDUcm/TAgZP3iA0ivD0eSiKy4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343564; 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=AjnI25kObyXcedTJG6dsPt3p71ooGwxu6v2cnBiQmTs=; b=gDNrlz+vroJL4XAyxHUTfZPt3oYp/hemjxmX9Ht1nbUD/OdaTFNHyJSsKT7Hgq4ygAkPulqzV/P5FCFMDUPjSg41u0yiYq0vlDcEIbTuxqz+gV+H8gepUPfWrES2XpYew+fay6WedDmt+ACxqzqEAxVDBZHZFCLKgqAnWUl813k= 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 1682343564435272.2824046793231; Mon, 24 Apr 2023 06:39:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFp-00080S-Fg; Mon, 24 Apr 2023 09:29:17 -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 1pqwFT-0007Hu-UD for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEr-0001Ra-Gk for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-540-YViARjAvNq6Dm6L7T8dCwg-1; Mon, 24 Apr 2023 09:28:12 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA0F8A0F383; Mon, 24 Apr 2023 13:28:11 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 273CE14171B8; Mon, 24 Apr 2023 13:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AjnI25kObyXcedTJG6dsPt3p71ooGwxu6v2cnBiQmTs=; b=VMmXggmuh/DSO8+hwH1+kVMp81V7SJ4ApvcweEn+hwLhEAIbH02JMUMyb0o6xqU6jH1eJu jho9K975l9+qTCq2zbkXgXzNoDAO6NL5uekYsUEjKybfWmiTCfIV8Ux7YvMgI7i5yoIGqB ydT0YnOSeUtDTrrjrlv2nFlzBo0M89U= X-MC-Unique: YViARjAvNq6Dm6L7T8dCwg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 12/30] migration: Move migrate_use_block() to options.c Date: Mon, 24 Apr 2023 15:27:12 +0200 Message-Id: <20230424132730.70752-13-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343565306100005 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_block() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/block.c | 2 +- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/savevm.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/migration/block.c b/migration/block.c index 4b167fa5cf..f0977217cf 100644 --- a/migration/block.c +++ b/migration/block.c @@ -1001,7 +1001,7 @@ static int block_load(QEMUFile *f, void *opaque, int = version_id) =20 static bool block_is_active(void *opaque) { - return migrate_use_block(); + return migrate_block(); } =20 static SaveVMHandlers savevm_block_handlers =3D { diff --git a/migration/migration.c b/migration/migration.c index abb820cdb9..1f8ba94fc4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2415,7 +2415,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, error_setg(errp, "No disk migration is required in COLO mode"); return false; } - if (migrate_use_block() || migrate_use_block_incremental()) { + if (migrate_block() || migrate_use_block_incremental()) { error_setg(errp, "Command options are incompatible with " "current migration capabilities"); return false; @@ -2622,15 +2622,6 @@ static int64_t migrate_max_postcopy_bandwidth(void) return s->parameters.max_postcopy_bandwidth; } =20 -bool migrate_use_block(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; -} - bool migrate_use_return_path(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index e2bb5b1e2f..d4b68b08a5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -457,7 +457,6 @@ int migrate_multifd_zstd_level(void); int migrate_use_tls(void); uint64_t migrate_xbzrle_cache_size(void); =20 -bool migrate_use_block(void); bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); bool migrate_use_return_path(void); diff --git a/migration/options.c b/migration/options.c index 25264c500e..fe1eadeed6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -33,6 +33,15 @@ bool migrate_background_snapshot(void) return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 +bool migrate_block(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; +} + bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 8f76a88329..e985a5233e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -18,6 +18,7 @@ =20 bool migrate_auto_converge(void); bool migrate_background_snapshot(void); +bool migrate_block(void); bool migrate_colo(void); bool migrate_compress(void); bool migrate_dirty_bitmaps(void); diff --git a/migration/savevm.c b/migration/savevm.c index ebcf571e37..9671211339 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1612,7 +1612,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) return -EINVAL; } =20 - if (migrate_use_block()) { + if (migrate_block()) { error_setg(errp, "Block migration and snapshots are incompatible"); return -EINVAL; } --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343626; cv=none; d=zohomail.com; s=zohoarc; b=hcShjWM+aF3yqXUQxgYNbfqbc+zdw1XjAt1IHLAjWJjftS76NXjo5H8PmLSc3VbeesP8T2OY3xInMD2WMA12adLaeZmcABuXUNt72fVY7MUUw5GC9Owoi1oQhSrx3kAm9R9KMCBnQJ7yB1tnu8KAIPJI5GL6rsCwItYbE1xAS8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343626; 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=mJYXepNCd+IEb9CaUQpf4FPu3H1QdSZpQwj0PKYW06k=; b=NIZz0q0UnHUv2mG1tYOcFTt+c1faJ838wqs4+giwvSgl6ZTM/aBsp1xHhdsC3nr6zsnJvnXGCqkqql22ayuBCIGB3NGwWSlH9jsTzsWgjZN94RQpDUh4BCvDHnFEHQdzto3XmD5ZcwMCrbceJZTOmd7HQOc+y/mFqBuKQmgCLIs= 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 1682343626227857.761908280998; Mon, 24 Apr 2023 06:40:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFt-0008CD-5V; Mon, 24 Apr 2023 09:29:21 -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 1pqwEw-0006gG-Ds for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEu-0001SC-5Y for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-543-VvbAA6SbPmmBueI1CFNdXw-1; Mon, 24 Apr 2023 09:28:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F6B0884EC0; Mon, 24 Apr 2023 13:28:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15A3B14171B8; Mon, 24 Apr 2023 13:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mJYXepNCd+IEb9CaUQpf4FPu3H1QdSZpQwj0PKYW06k=; b=YlMEkIRsDRKz+IjqzFCePk+8Kam8EmxrCYW6tTDKwiMb6acQ6lIYiww+MhaBl58r2kLk5W bQ+YW99RycOGlZCFPHQL1jo3Wob7TxACDrPv0172MaWnwfoi3m5KfM7QfBDiBMfwPsIk02 Un+/3tmOgRdwMokPYjEx/8RgBrTHRZo= X-MC-Unique: VvbAA6SbPmmBueI1CFNdXw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 13/30] migration: Move migrate_use_return() to options.c Date: Mon, 24 Apr 2023 15:27:13 +0200 Message-Id: <20230424132730.70752-14-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343627310100004 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_return_path() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/rdma.c | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 1f8ba94fc4..b03c4aa650 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2622,15 +2622,6 @@ static int64_t migrate_max_postcopy_bandwidth(void) return s->parameters.max_postcopy_bandwidth; } =20 -bool migrate_use_return_path(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; -} - bool migrate_use_block_incremental(void) { MigrationState *s; @@ -4171,7 +4162,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) * precopy, only if user specified "return-path" capability would * QEMU uses the return path. */ - if (migrate_postcopy_ram() || migrate_use_return_path()) { + if (migrate_postcopy_ram() || migrate_return_path()) { if (open_return_path_on_source(s, !resume)) { error_report("Unable to open return-path for postcopy"); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED= ); diff --git a/migration/migration.h b/migration/migration.h index d4b68b08a5..24184622a8 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -459,7 +459,6 @@ uint64_t migrate_xbzrle_cache_size(void); =20 bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); -bool migrate_use_return_path(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 diff --git a/migration/options.c b/migration/options.c index fe1eadeed6..2003e413da 100644 --- a/migration/options.c +++ b/migration/options.c @@ -147,6 +147,15 @@ bool migrate_release_ram(void) return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; } =20 +bool migrate_return_path(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; +} + bool migrate_validate_uuid(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index e985a5233e..316efd1063 100644 --- a/migration/options.h +++ b/migration/options.h @@ -31,6 +31,7 @@ bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); bool migrate_postcopy_ram(void); bool migrate_release_ram(void); +bool migrate_return_path(void); bool migrate_validate_uuid(void); bool migrate_xbzrle(void); bool migrate_zero_blocks(void); diff --git a/migration/rdma.c b/migration/rdma.c index f35f021963..bf55e2f163 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3373,7 +3373,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) * initialize the RDMAContext for return path for postcopy after first * connection request reached. */ - if ((migrate_postcopy() || migrate_use_return_path()) + if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { rdma_return_path =3D qemu_rdma_data_init(rdma->host_port, NULL); if (rdma_return_path =3D=3D NULL) { @@ -3456,7 +3456,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) } =20 /* Accept the second connection request for return path */ - if ((migrate_postcopy() || migrate_use_return_path()) + if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migrat= ion, NULL, @@ -4193,7 +4193,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 /* RDMA postcopy need a separate queue pair for return path */ - if (migrate_postcopy() || migrate_use_return_path()) { + if (migrate_postcopy() || migrate_return_path()) { rdma_return_path =3D qemu_rdma_data_init(host_port, errp); =20 if (rdma_return_path =3D=3D NULL) { --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343002; cv=none; d=zohomail.com; s=zohoarc; b=kwsqW3guRDiRfUFvas6hLZH0/YxFZ3ysBLAhCnL0QZEQzVDA6TjHkKAPVJUrQMylLIVuWzP3FKPsBxFyIWi43M5WahlXv00t38y5RQBy+8ePvVbXCJQMiGEo6RokwW1ESjnVrR5ywIRTuUEz6kU+AGx4ZbnIJF7U9SyoWTkdqPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343002; 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=DCWozSg17jO208j2dPB6qCCaE9Y/HEDFP5LypBPdwkg=; b=i+XTxr3c4RDjcW3MUVYSYGcTV/O0CE9BUU9ePJqjWjdGKSVpBXXTBIoGk/kBYgmAdSBCoBmHIT8yEUse0lH2s72MWTZEwxjrNnZODBOmtQ0Dn3Z+zXuRy8A+V9+nsNPcedtU/IbWIDZs3z3VH46jt6s1k1c0p2/kA2eDI21rz5U= 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 1682343002939838.6732946422385; Mon, 24 Apr 2023 06:30:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFv-0008J5-V4; Mon, 24 Apr 2023 09:29:23 -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 1pqwF1-0006ni-08 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwEw-0001Sq-5X for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:24 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-iTVxl9PIMiuh_-DGQzvhoA-1; Mon, 24 Apr 2023 09:28:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85707800B35; Mon, 24 Apr 2023 13:28:17 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D895B14171B8; Mon, 24 Apr 2023 13:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DCWozSg17jO208j2dPB6qCCaE9Y/HEDFP5LypBPdwkg=; b=ezJr/4GgGXD2XWBVJiISjnIz050PZgKqkL1NWQE88LLIcVRHX54V4dtrhQNEllQp3EOxpR X6R2MxhgujHJtg52S+uBlXtO4T1AjwxS/GphzBRi9DZThqvP6iSNJ7BaWw908JdBZzxZrm sLkLMEvsKaFCnig0EAb13b956G8ZZ/0= X-MC-Unique: iTVxl9PIMiuh_-DGQzvhoA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 14/30] migration: Create migrate_rdma_pin_all() function Date: Mon, 24 Apr 2023 15:27:14 +0200 Message-Id: <20230424132730.70752-15-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343004116100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- Fixed missing space after comma (fabiano) --- migration/options.c | 7 +++++++ migration/options.h | 1 + migration/rdma.c | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/options.c b/migration/options.c index 2003e413da..9c9b8e5863 100644 --- a/migration/options.c +++ b/migration/options.c @@ -138,6 +138,13 @@ bool migrate_postcopy_ram(void) return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; } =20 +bool migrate_rdma_pin_all(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL]; +} + bool migrate_release_ram(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 316efd1063..25c002b37a 100644 --- a/migration/options.h +++ b/migration/options.h @@ -30,6 +30,7 @@ bool migrate_pause_before_switchover(void); bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); bool migrate_postcopy_ram(void); +bool migrate_rdma_pin_all(void); bool migrate_release_ram(void); bool migrate_return_path(void); bool migrate_validate_uuid(void); diff --git a/migration/rdma.c b/migration/rdma.c index bf55e2f163..0af5e944f0 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -35,6 +35,7 @@ #include #include "trace.h" #include "qom/object.h" +#include "options.h" #include =20 /* @@ -4178,8 +4179,7 @@ void rdma_start_outgoing_migration(void *opaque, goto err; } =20 - ret =3D qemu_rdma_source_init(rdma, - s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); + ret =3D qemu_rdma_source_init(rdma, migrate_rdma_pin_all(), errp); =20 if (ret) { goto err; @@ -4201,7 +4201,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 ret =3D qemu_rdma_source_init(rdma_return_path, - s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); + migrate_rdma_pin_all(), errp); =20 if (ret) { goto return_path_err; --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343551; cv=none; d=zohomail.com; s=zohoarc; b=BZQvH+ZpZgUY+JrtFkwyDzVI9wIXQhiLc7v3crXys1yWTE/eInbuWQfc9WD58em5rJnp5kcMsSLJo1guZW+BJW/DkvXtsN1gDlniBwvpRuH9Eo4JehdDiRa7x+LhzRcCCVGTyTP75zt6SeuUIHIbyrUWl7v4TniQaOysSnkfiqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343551; 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=+ilFHZxDrcRGYVX2QseuGufDpyc7ILoqHDOQYTSQem0=; b=XWukIzJJrgSWhgqxatO1n2R1405IjOet9719NfmM/wyjT6gl1P7EFhVnjjFJBh1pMD70dftD2BUxpLGYB07BSBgdEoqZaqnFdjes1k+rRfGrkbJf52Yc+X8M6581MXoOEeQi7fbVhuI5q/ThrbiztmeLxY8WjPexicekT9ZP8C8= 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 1682343551652977.1119104685432; Mon, 24 Apr 2023 06:39:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFx-0008Mx-JP; Mon, 24 Apr 2023 09:29:25 -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 1pqwF4-0006ru-8m for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwF0-0001TX-5J for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:29 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-r3AMbTlIPii9fqRhCqMwag-1; Mon, 24 Apr 2023 09:28:20 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A17C101A553; Mon, 24 Apr 2023 13:28:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id C45FD14171B8; Mon, 24 Apr 2023 13:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+ilFHZxDrcRGYVX2QseuGufDpyc7ILoqHDOQYTSQem0=; b=Eg+mlMyGMxzCmyXbN/fEajTty8h9FCG7Hkri3VJgomtdR1wmrnQL8kk6REZBRv2yJuiqwZ XJ/clx8w7EDUhm0Ak4KNutKhpWZ0VJkbT7rDy7AZHUaMoOzhOo/K7/QuvB1hz3Q1dbzaIZ hmBRN63y2xoaAQ+68sO7o5jLlQ+bw7U= X-MC-Unique: r3AMbTlIPii9fqRhCqMwag-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 15/30] migration: Move migrate_caps_check() to options.c Date: Mon, 24 Apr 2023 15:27:15 +0200 Message-Id: <20230424132730.70752-16-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343552274100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 190 ----------------------------------------- migration/options.c | 192 ++++++++++++++++++++++++++++++++++++++++++ migration/options.h | 4 + 3 files changed, 196 insertions(+), 190 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b03c4aa650..431e3db278 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -136,39 +136,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 -/* Migration capabilities set */ -struct MigrateCapsSet { - int size; /* Capability set size */ - MigrationCapability caps[]; /* Variadic array of capabilities */ -}; -typedef struct MigrateCapsSet MigrateCapsSet; - -/* Define and initialize MigrateCapsSet */ -#define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \ - MigrateCapsSet _name =3D { \ - .size =3D sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \ - .caps =3D { __VA_ARGS__ } \ - } - -/* Background-snapshot compatibility check list */ -static const -INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot, - MIGRATION_CAPABILITY_POSTCOPY_RAM, - MIGRATION_CAPABILITY_DIRTY_BITMAPS, - MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME, - MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE, - MIGRATION_CAPABILITY_RETURN_PATH, - MIGRATION_CAPABILITY_MULTIFD, - MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER, - MIGRATION_CAPABILITY_AUTO_CONVERGE, - MIGRATION_CAPABILITY_RELEASE_RAM, - MIGRATION_CAPABILITY_RDMA_PIN_ALL, - MIGRATION_CAPABILITY_COMPRESS, - MIGRATION_CAPABILITY_XBZRLE, - MIGRATION_CAPABILITY_X_COLO, - MIGRATION_CAPABILITY_VALIDATE_UUID, - MIGRATION_CAPABILITY_ZERO_COPY_SEND); - /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -1235,163 +1202,6 @@ static void fill_source_migration_info(MigrationInf= o *info) info->status =3D state; } =20 -typedef enum WriteTrackingSupport { - WT_SUPPORT_UNKNOWN =3D 0, - WT_SUPPORT_ABSENT, - WT_SUPPORT_AVAILABLE, - WT_SUPPORT_COMPATIBLE -} WriteTrackingSupport; - -static -WriteTrackingSupport migrate_query_write_tracking(void) -{ - /* Check if kernel supports required UFFD features */ - if (!ram_write_tracking_available()) { - return WT_SUPPORT_ABSENT; - } - /* - * Check if current memory configuration is - * compatible with required UFFD features. - */ - if (!ram_write_tracking_compatible()) { - return WT_SUPPORT_AVAILABLE; - } - - return WT_SUPPORT_COMPATIBLE; -} - -/** - * @migration_caps_check - check capability compatibility - * - * @old_caps: old capability list - * @new_caps: new capability list - * @errp: set *errp if the check failed, with reason - * - * Returns true if check passed, otherwise false. - */ -static bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **err= p) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - -#ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (new_caps[MIGRATION_CAPABILITY_BLOCK]) { - error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " - "block migration"); - error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); - return false; - } -#endif - -#ifndef CONFIG_REPLICATION - if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { - error_setg(errp, "QEMU compiled without replication module" - " can't enable COLO"); - error_append_hint(errp, "Please enable replication before COLO.\n"= ); - return false; - } -#endif - - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { - /* This check is reasonably expensive, so only when it's being - * set the first time, also it's only the destination that needs - * special support. - */ - if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && - runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host(mis)) { - /* postcopy_ram_supported_by_host will have emitted a more - * detailed message - */ - error_setg(errp, "Postcopy is not supported"); - return false; - } - - if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { - error_setg(errp, "Postcopy is not compatible with ignore-share= d"); - return false; - } - } - - if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { - WriteTrackingSupport wt_support; - int idx; - /* - * Check if 'background-snapshot' capability is supported by - * host kernel and compatible with guest memory configuration. - */ - wt_support =3D migrate_query_write_tracking(); - if (wt_support < WT_SUPPORT_AVAILABLE) { - error_setg(errp, "Background-snapshot is not supported by host= kernel"); - return false; - } - if (wt_support < WT_SUPPORT_COMPATIBLE) { - error_setg(errp, "Background-snapshot is not compatible " - "with guest memory configuration"); - return false; - } - - /* - * Check if there are any migration capabilities - * incompatible with 'background-snapshot'. - */ - for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { - int incomp_cap =3D check_caps_background_snapshot.caps[idx]; - if (new_caps[incomp_cap]) { - error_setg(errp, - "Background-snapshot is not compatible with %s", - MigrationCapability_str(incomp_cap)); - return false; - } - } - } - -#ifdef CONFIG_LINUX - if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && - (!new_caps[MIGRATION_CAPABILITY_MULTIFD] || - new_caps[MIGRATION_CAPABILITY_COMPRESS] || - new_caps[MIGRATION_CAPABILITY_XBZRLE] || - migrate_multifd_compression() || - migrate_use_tls())) { - error_setg(errp, - "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); - return false; - } -#else - if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { - error_setg(errp, - "Zero copy currently only available on Linux"); - return false; - } -#endif - - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { - if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { - error_setg(errp, "Postcopy preempt requires postcopy-ram"); - return false; - } - - /* - * Preempt mode requires urgent pages to be sent in separate - * channel, OTOH compression logic will disorder all pages into - * different compression channels, which is not compatible with the - * preempt assumptions on channel assignments. - */ - if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { - error_setg(errp, "Postcopy preempt not compatible with compres= s"); - return false; - } - } - - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { - if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { - error_setg(errp, "Multifd is not compatible with compress"); - return false; - } - } - - return true; -} - static void fill_destination_migration_info(MigrationInfo *info) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/options.c b/migration/options.c index 9c9b8e5863..367c930f46 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,7 +12,10 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" +#include "sysemu/runstate.h" #include "migration.h" +#include "ram.h" #include "options.h" =20 bool migrate_auto_converge(void) @@ -198,3 +201,192 @@ bool migrate_zero_copy_send(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } +typedef enum WriteTrackingSupport { + WT_SUPPORT_UNKNOWN =3D 0, + WT_SUPPORT_ABSENT, + WT_SUPPORT_AVAILABLE, + WT_SUPPORT_COMPATIBLE +} WriteTrackingSupport; + +static +WriteTrackingSupport migrate_query_write_tracking(void) +{ + /* Check if kernel supports required UFFD features */ + if (!ram_write_tracking_available()) { + return WT_SUPPORT_ABSENT; + } + /* + * Check if current memory configuration is + * compatible with required UFFD features. + */ + if (!ram_write_tracking_compatible()) { + return WT_SUPPORT_AVAILABLE; + } + + return WT_SUPPORT_COMPATIBLE; +} + +/* Migration capabilities set */ +struct MigrateCapsSet { + int size; /* Capability set size */ + MigrationCapability caps[]; /* Variadic array of capabilities */ +}; +typedef struct MigrateCapsSet MigrateCapsSet; + +/* Define and initialize MigrateCapsSet */ +#define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \ + MigrateCapsSet _name =3D { \ + .size =3D sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \ + .caps =3D { __VA_ARGS__ } \ + } + +/* Background-snapshot compatibility check list */ +static const +INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot, + MIGRATION_CAPABILITY_POSTCOPY_RAM, + MIGRATION_CAPABILITY_DIRTY_BITMAPS, + MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME, + MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE, + MIGRATION_CAPABILITY_RETURN_PATH, + MIGRATION_CAPABILITY_MULTIFD, + MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER, + MIGRATION_CAPABILITY_AUTO_CONVERGE, + MIGRATION_CAPABILITY_RELEASE_RAM, + MIGRATION_CAPABILITY_RDMA_PIN_ALL, + MIGRATION_CAPABILITY_COMPRESS, + MIGRATION_CAPABILITY_XBZRLE, + MIGRATION_CAPABILITY_X_COLO, + MIGRATION_CAPABILITY_VALIDATE_UUID, + MIGRATION_CAPABILITY_ZERO_COPY_SEND); + +/** + * @migration_caps_check - check capability compatibility + * + * @old_caps: old capability list + * @new_caps: new capability list + * @errp: set *errp if the check failed, with reason + * + * Returns true if check passed, otherwise false. + */ +bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + +#ifndef CONFIG_LIVE_BLOCK_MIGRATION + if (new_caps[MIGRATION_CAPABILITY_BLOCK]) { + error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " + "block migration"); + error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); + return false; + } +#endif + +#ifndef CONFIG_REPLICATION + if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { + error_setg(errp, "QEMU compiled without replication module" + " can't enable COLO"); + error_append_hint(errp, "Please enable replication before COLO.\n"= ); + return false; + } +#endif + + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + /* This check is reasonably expensive, so only when it's being + * set the first time, also it's only the destination that needs + * special support. + */ + if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && + runstate_check(RUN_STATE_INMIGRATE) && + !postcopy_ram_supported_by_host(mis)) { + /* postcopy_ram_supported_by_host will have emitted a more + * detailed message + */ + error_setg(errp, "Postcopy is not supported"); + return false; + } + + if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { + error_setg(errp, "Postcopy is not compatible with ignore-share= d"); + return false; + } + } + + if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { + WriteTrackingSupport wt_support; + int idx; + /* + * Check if 'background-snapshot' capability is supported by + * host kernel and compatible with guest memory configuration. + */ + wt_support =3D migrate_query_write_tracking(); + if (wt_support < WT_SUPPORT_AVAILABLE) { + error_setg(errp, "Background-snapshot is not supported by host= kernel"); + return false; + } + if (wt_support < WT_SUPPORT_COMPATIBLE) { + error_setg(errp, "Background-snapshot is not compatible " + "with guest memory configuration"); + return false; + } + + /* + * Check if there are any migration capabilities + * incompatible with 'background-snapshot'. + */ + for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { + int incomp_cap =3D check_caps_background_snapshot.caps[idx]; + if (new_caps[incomp_cap]) { + error_setg(errp, + "Background-snapshot is not compatible with %s", + MigrationCapability_str(incomp_cap)); + return false; + } + } + } + +#ifdef CONFIG_LINUX + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && + (!new_caps[MIGRATION_CAPABILITY_MULTIFD] || + new_caps[MIGRATION_CAPABILITY_COMPRESS] || + new_caps[MIGRATION_CAPABILITY_XBZRLE] || + migrate_multifd_compression() || + migrate_use_tls())) { + error_setg(errp, + "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); + return false; + } +#else + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { + error_setg(errp, + "Zero copy currently only available on Linux"); + return false; + } +#endif + + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { + if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + error_setg(errp, "Postcopy preempt requires postcopy-ram"); + return false; + } + + /* + * Preempt mode requires urgent pages to be sent in separate + * channel, OTOH compression logic will disorder all pages into + * different compression channels, which is not compatible with the + * preempt assumptions on channel assignments. + */ + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { + error_setg(errp, "Postcopy preempt not compatible with compres= s"); + return false; + } + } + + if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { + error_setg(errp, "Multifd is not compatible with compress"); + return false; + } + } + + return true; +} diff --git a/migration/options.h b/migration/options.h index 25c002b37a..e779f14161 100644 --- a/migration/options.h +++ b/migration/options.h @@ -38,4 +38,8 @@ bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 +/* capabilities helpers */ + +bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); + #endif --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343108; cv=none; d=zohomail.com; s=zohoarc; b=dGd9etZUwFu4wjFQueQ8cKcbiS0Yzr1KVwo3UDSDb72nAJ20oUcQpMqUhJEiV5E9BNcYGAK1mAuOwoTSZmGduPQVtsWy+xmRkYUABF+lyKrKY+/34fAryI7W/GZMmVTvr4bAbphyXURCKtECTXcdbdu0XJXOooysXeZwxW06SvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343108; 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=Y9zmr5qXs6ASHFHbklg3YiDax5XC2gJKDtxNF5CqNQY=; b=TyX2n2PrKN/io8YKROrB9DTD/zf2zXGNqKAd5VNfOIlQW4HWG2OZhW857ZnL0q63vq+4D6G4R8lVKWa0G2mUKrSvHaWRvHRckzQ+xb6+SZHvgffOQFxz9oNsb77nYmPgQ4u2pG59234HmUSF9BeusCZEhIyw8enKQPq7IpbcUC8= 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 1682343108227802.3314575709215; Mon, 24 Apr 2023 06:31:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFz-0008Rb-9y; Mon, 24 Apr 2023 09:29:27 -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 1pqwFT-0007Ht-SI for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwF3-0001UB-I9 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:32 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-33VZsL6vMLWTtAZtF6Yt3w-1; Mon, 24 Apr 2023 09:28:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 305C73815F62; Mon, 24 Apr 2023 13:28:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD09314171B8; Mon, 24 Apr 2023 13:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y9zmr5qXs6ASHFHbklg3YiDax5XC2gJKDtxNF5CqNQY=; b=TvW3+KPhEin9kGhMuKFrfgMiCpeKPtGpSYxpH0TyGpfAxEu7crxEvUYqETw6bFKfh1ZCJN R3If5fll/uGqbsmh0/vIDt82qV6PQDtOppUojrPHXB80kqXaC/jzuy/aSsXtnoESbXaUQa pL+FV5I432v38rxU+WJNIBtBFtLq3mE= X-MC-Unique: 33VZsL6vMLWTtAZtF6Yt3w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 16/30] migration: Move qmp_query_migrate_capabilities() to options.c Date: Mon, 24 Apr 2023 15:27:16 +0200 Message-Id: <20230424132730.70752-17-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343109640100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 22 ---------------------- migration/options.c | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 431e3db278..0004c163a6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -886,28 +886,6 @@ void migrate_send_rp_resume_ack(MigrationIncomingState= *mis, uint32_t value) migrate_send_rp_message(mis, MIG_RP_MSG_RESUME_ACK, sizeof(buf), &buf); } =20 -MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) -{ - MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; - MigrationCapabilityStatus *caps; - MigrationState *s =3D migrate_get_current(); - int i; - - for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { -#ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (i =3D=3D MIGRATION_CAPABILITY_BLOCK) { - continue; - } -#endif - caps =3D g_malloc0(sizeof(*caps)); - caps->capability =3D i; - caps->state =3D s->capabilities[i]; - QAPI_LIST_APPEND(tail, caps); - } - - return head; -} - MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; diff --git a/migration/options.c b/migration/options.c index 367c930f46..ff621bdeb3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" #include "sysemu/runstate.h" #include "migration.h" #include "ram.h" @@ -390,3 +391,25 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) =20 return true; } + +MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) +{ + MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; + MigrationCapabilityStatus *caps; + MigrationState *s =3D migrate_get_current(); + int i; + + for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { +#ifndef CONFIG_LIVE_BLOCK_MIGRATION + if (i =3D=3D MIGRATION_CAPABILITY_BLOCK) { + continue; + } +#endif + caps =3D g_malloc0(sizeof(*caps)); + caps->capability =3D i; + caps->state =3D s->capabilities[i]; + QAPI_LIST_APPEND(tail, caps); + } + + return head; +} --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682342989; cv=none; d=zohomail.com; s=zohoarc; b=UA0P2gTFv9UKBwa7uEGMxTtqyqis55ZxGh8xTDK0haUnBPrBQG5DfkoLuPd6ay274rM1i2lxR9IPYt446DYYxuQ0CjfFy3g7cK5Bo+xfGoiZ6tdv2p350VpF7OeFtrzdN2+uM0iW8qGjpJlowcMN9FN60PEstZfO/yqhr9xSjJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682342989; 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=l5SVSDa+Hn077RLImjeAcHl3Y/Ae562x8fcEfFrkwX0=; b=aqpDAQmycBoLsGoeiNHEvuqzcVJp4VBpj5F6zWHIYav7hpewcsqxbAhe+K2jqGv0hQuf3X+59xSywzF9O3PHKFIMJGhk0L4huDDgwCYP4oDa+HtM37wd754+Q66CHyyh7BNsAuc43sfKMtRoUlKqIsHp9eZVsg896iF88BxUXsg= 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 168234298990623.23209251252331; Mon, 24 Apr 2023 06:29:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG1-0008VE-2t; Mon, 24 Apr 2023 09:29:29 -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 1pqwFV-0007LK-FZ for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFR-0001Ue-JQ for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:56 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173-f7zRKLL4PRC6WvdczjQQRA-1; Mon, 24 Apr 2023 09:28:26 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E13F02A59579; Mon, 24 Apr 2023 13:28:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FAFB14171B8; Mon, 24 Apr 2023 13:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l5SVSDa+Hn077RLImjeAcHl3Y/Ae562x8fcEfFrkwX0=; b=BxAjTFMBeKU0pue62YtWzJym9gEaHTXgKb2B0xt06JND+7jHX7+Bd0ZwQIYBc0O31CRQVy rJjErULsgra/MrWqaQ1Kd25qMibSmc0dxpD5m1aFdN31qfvYg1P73rQvTDS4p31eCMegSK LE2Zita8dx2sz16BU1qZyoXkXEnDv1U= X-MC-Unique: f7zRKLL4PRC6WvdczjQQRA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 17/30] migration: Move qmp_migrate_set_capabilities() to options.c Date: Mon, 24 Apr 2023 15:27:17 +0200 Message-Id: <20230424132730.70752-18-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682342991981100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 26 -------------------------- migration/options.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0004c163a6..b198f4acf5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1222,32 +1222,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) return info; } =20 -void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, - Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - MigrationCapabilityStatusList *cap; - bool new_caps[MIGRATION_CAPABILITY__MAX]; - - if (migration_is_running(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); - return; - } - - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - for (cap =3D params; cap; cap =3D cap->next) { - new_caps[cap->value->capability] =3D cap->value->state; - } - - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return; - } - - for (cap =3D params; cap; cap =3D cap->next) { - s->capabilities[cap->value->capability] =3D cap->value->state; - } -} - /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. diff --git a/migration/options.c b/migration/options.c index ff621bdeb3..4cbe77e35a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -413,3 +413,29 @@ MigrationCapabilityStatusList *qmp_query_migrate_capab= ilities(Error **errp) =20 return head; } + +void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, + Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + MigrationCapabilityStatusList *cap; + bool new_caps[MIGRATION_CAPABILITY__MAX]; + + if (migration_is_running(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return; + } + + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + for (cap =3D params; cap; cap =3D cap->next) { + new_caps[cap->value->capability] =3D cap->value->state; + } + + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return; + } + + for (cap =3D params; cap; cap =3D cap->next) { + s->capabilities[cap->value->capability] =3D cap->value->state; + } +} --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343271; cv=none; d=zohomail.com; s=zohoarc; b=Zsd3uFG9GC9uHW0wLZ7JlnD+8YJltzidVUWx3KVZQbIfOQyhrcOaojCwfGpk92ne5erLkk13/9LbUt9UeObNYL6jL2t6UerPR9nAon0kHtGaNDcyFOSx2EsCtVJHZlXv7pCg+z5jHPjfOe4m1wXJNR/e61lGirRkN8lrKex2mi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343271; 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=GVqz4Tm+qMhkrgna1X8FhBvifreZQnKw3QTGMGRmDAM=; b=gPeKkiH+R5dUYTbDqww4Bul0xPsZIhXJqhIqUE5LyeQ0qN1rL7Em4IpeVeT162Ll40KeHHyW208zoGm9j040R8drqC+0asf05baDwiXHMyNv7WkwyR01Y5B+Ym7Idx4Re2nZg+/ttwtublG1SeUgPWTlskh+qrBMxwwYI/YzXhc= 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 16823432717021013.8568101675825; Mon, 24 Apr 2023 06:34:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFu-0008Ft-W5; Mon, 24 Apr 2023 09:29:23 -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 1pqwFW-0007OI-V1 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001Uz-DF for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:57 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-648-S6suZdslOsOE5yIt6UwPpg-1; Mon, 24 Apr 2023 09:28:29 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DA60884EC1; Mon, 24 Apr 2023 13:28:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BA1514171B8; Mon, 24 Apr 2023 13:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GVqz4Tm+qMhkrgna1X8FhBvifreZQnKw3QTGMGRmDAM=; b=cPFtGCKy9V5FqzHxGtK0vbEhvduEfs6NwwNCQLHpFvBbG3YpnzgMAO891mpSob61UVxbF0 OVPZh6NGaS18LKCXcBIkeDhXf7+iA5ocLb3CAuwSqYOCfAnBHcHf2AcMFnbX1DYvijirwX S9f78GXQZPHgnwnNtfuy3K0mfpAp+ZQ= X-MC-Unique: S6suZdslOsOE5yIt6UwPpg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 18/30] migration: Move migrate_cap_set() to options.c Date: Mon, 24 Apr 2023 15:27:18 +0200 Message-Id: <20230424132730.70752-19-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343273205100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 20 -------------------- migration/options.c | 21 +++++++++++++++++++++ migration/options.h | 1 + 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b198f4acf5..ddd3fc361f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1666,26 +1666,6 @@ void migrate_set_state(int *state, int old_state, in= t new_state) } } =20 -static bool migrate_cap_set(int cap, bool value, Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - bool new_caps[MIGRATION_CAPABILITY__MAX]; - - if (migration_is_running(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); - return false; - } - - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - new_caps[cap] =3D value; - - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return false; - } - s->capabilities[cap] =3D value; - return true; -} - static void migrate_set_block_incremental(MigrationState *s, bool value) { s->parameters.block_incremental =3D value; diff --git a/migration/options.c b/migration/options.c index 4cbe77e35a..f3b2d6e482 100644 --- a/migration/options.c +++ b/migration/options.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" +#include "qapi/qmp/qerror.h" #include "sysemu/runstate.h" #include "migration.h" #include "ram.h" @@ -392,6 +393,26 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) return true; } =20 +bool migrate_cap_set(int cap, bool value, Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + bool new_caps[MIGRATION_CAPABILITY__MAX]; + + if (migration_is_running(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return false; + } + + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + new_caps[cap] =3D value; + + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return false; + } + s->capabilities[cap] =3D value; + return true; +} + MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; diff --git a/migration/options.h b/migration/options.h index e779f14161..5979e4ff90 100644 --- a/migration/options.h +++ b/migration/options.h @@ -41,5 +41,6 @@ bool migrate_zero_copy_send(void); /* capabilities helpers */ =20 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); +bool migrate_cap_set(int cap, bool value, Error **errp); =20 #endif --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343383; cv=none; d=zohomail.com; s=zohoarc; b=lfUEtsYrDmlwdv6npJUwg3rfKowZAI8LwmWJwdRbDNKdsEtHRiIv2CGaqcjbTZvt5YDArSLw1Xw8QHuIyNFbOpPsV73XoYfbce8fP0v2O23GK5EEHfFEzBR4FmzPcmuzG1TBLqwBbAH9LFTw9IknHuxJ5mFkulYBqBvOAFeynGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343383; 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=5Y7RGTDKI8ZvEqaVqwbEM/HOCZU6iz3m3HWBM8BTaYU=; b=kJMlHXyWgq91m9SsRb1aJEYBnl0QD36n3FmhA8eprmtfoltuWaO2pN9oUeDANhbywH6XW2nxsaUl/ryY0I+VOYge1qYF2KvIfTo5YmdfdMBUYTkR2twup7akeN571kUVSnLyHuU8Hc8gTpxQTqU0OkpZrL3m9Qbc85Iorh/DgdU= 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 1682343383835153.49203093713584; Mon, 24 Apr 2023 06:36:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFs-00089L-Bi; Mon, 24 Apr 2023 09:29:20 -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 1pqwFY-0007PI-3W for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001V7-FP for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:59 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-505-2BEW58Z7NGG9VVcssCEsrg-1; Mon, 24 Apr 2023 09:28:32 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8714D3815F64; Mon, 24 Apr 2023 13:28:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF41B14171B8; Mon, 24 Apr 2023 13:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Y7RGTDKI8ZvEqaVqwbEM/HOCZU6iz3m3HWBM8BTaYU=; b=R+HeK+3K0xzxdW28QSATZ+zej0gBZKsdhtT9i30l2HA53YSMXqjgAejrJeQrA1K5dmYTNC BRuuz7VNJGAIs36kOezWRrXbj1no+JIJmfgW0gE/YxCESTQPE53x3RDveq8TEzUCS8qSvV 0Lx2Er+4B20cBDYCEF0QYx3Bq7l8GrI= X-MC-Unique: 2BEW58Z7NGG9VVcssCEsrg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 19/30] migration: Move parameters functions to option.c Date: Mon, 24 Apr 2023 15:27:19 +0200 Message-Id: <20230424132730.70752-20-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343385461100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 91 --------------------------------------- migration/migration.h | 11 ----- migration/multifd-zlib.c | 1 + migration/multifd-zstd.c | 1 + migration/options.c | 93 ++++++++++++++++++++++++++++++++++++++++ migration/options.h | 13 ++++++ 6 files changed, 108 insertions(+), 102 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ddd3fc361f..f19ab592ae 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2264,79 +2264,6 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -int migrate_compress_level(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.compress_level; -} - -int migrate_compress_threads(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.compress_threads; -} - -int migrate_compress_wait_thread(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.compress_wait_thread; -} - -int migrate_decompress_threads(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.decompress_threads; -} - -int migrate_multifd_channels(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.multifd_channels; -} - -MultiFDCompression migrate_multifd_compression(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); - return s->parameters.multifd_compression; -} - -int migrate_multifd_zlib_level(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.multifd_zlib_level; -} - -int migrate_multifd_zstd_level(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.multifd_zstd_level; -} - int migrate_use_tls(void) { MigrationState *s; @@ -2346,24 +2273,6 @@ int migrate_use_tls(void) return s->parameters.tls_creds && *s->parameters.tls_creds; } =20 -uint64_t migrate_xbzrle_cache_size(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.xbzrle_cache_size; -} - -static int64_t migrate_max_postcopy_bandwidth(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.max_postcopy_bandwidth; -} - bool migrate_use_block_incremental(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 24184622a8..8451e5f2fe 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,24 +449,13 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -int migrate_multifd_channels(void); -MultiFDCompression migrate_multifd_compression(void); -int migrate_multifd_zlib_level(void); -int migrate_multifd_zstd_level(void); - int migrate_use_tls(void); -uint64_t migrate_xbzrle_cache_size(void); =20 bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 -int migrate_compress_level(void); -int migrate_compress_threads(void); -int migrate_compress_wait_thread(void); -int migrate_decompress_threads(void); - /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, uint32_t value); diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 37770248e1..81701250ad 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "migration.h" #include "trace.h" +#include "options.h" #include "multifd.h" =20 struct zlib_data { diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index f4a8e1ed1f..d1d29e76cc 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "migration.h" #include "trace.h" +#include "options.h" #include "multifd.h" =20 struct zstd_data { diff --git a/migration/options.c b/migration/options.c index f3b2d6e482..8d15be858c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -460,3 +460,96 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, s->capabilities[cap->value->capability] =3D cap->value->state; } } + +/* parameters */ + +int migrate_compress_level(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.compress_level; +} + +int migrate_compress_threads(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.compress_threads; +} + +int migrate_compress_wait_thread(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.compress_wait_thread; +} + +int migrate_decompress_threads(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.decompress_threads; +} + +int64_t migrate_max_postcopy_bandwidth(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.max_postcopy_bandwidth; +} + +int migrate_multifd_channels(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_channels; +} + +MultiFDCompression migrate_multifd_compression(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); + return s->parameters.multifd_compression; +} + +int migrate_multifd_zlib_level(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_zlib_level; +} + +int migrate_multifd_zstd_level(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_zstd_level; +} + +uint64_t migrate_xbzrle_cache_size(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.xbzrle_cache_size; +} diff --git a/migration/options.h b/migration/options.h index 5979e4ff90..b24ee92283 100644 --- a/migration/options.h +++ b/migration/options.h @@ -43,4 +43,17 @@ bool migrate_zero_copy_send(void); bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); bool migrate_cap_set(int cap, bool value, Error **errp); =20 +/* parameters */ + +int migrate_compress_level(void); +int migrate_compress_threads(void); +int migrate_compress_wait_thread(void); +int migrate_decompress_threads(void); +int64_t migrate_max_postcopy_bandwidth(void); +int migrate_multifd_channels(void); +MultiFDCompression migrate_multifd_compression(void); +int migrate_multifd_zlib_level(void); +int migrate_multifd_zstd_level(void); +uint64_t migrate_xbzrle_cache_size(void); + #endif --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343544; cv=none; d=zohomail.com; s=zohoarc; b=S6n2W4qNGRl8ENoAaHLxL7H9ISG/5uUwdE7FGcCjMue3ojxvaGyCMSywiVMXM21xsSKIsOOGD7wrhL/SgSf35AX+NJdatb0FgZfRHhNvkwoFXUp50OMh6gKrupsP8gioOy7kV8CPLHo3blnmJcUxj9lcJBAfHhJYIGWlqI1lDXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343544; 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=k5bzcZooZtB1ehj39FLgF5FrjIGqOSuQvTuDX70IDso=; b=fNQMOW5YzPEr73dVFGHn0han4gZYufLwovF8akCb9nkHIuhhuSRpZaNj81J2i1sxyHf4vPlXHZ32pl49XNftUwiCbI0l4Hy2t4dEGDRL57Rk09zWnKDIByDjYrgKt9EWn6TtiwQQ20rhQRiPR8jfQfCZXocM9YVOSA8ccdUv4ek= 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 1682343544535801.6498463262027; Mon, 24 Apr 2023 06:39:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG3-00006Z-11; Mon, 24 Apr 2023 09:29:31 -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 1pqwFZ-0007QR-SY for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001VK-I0 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-94-6bLoYhGDMNezc7NIAd8btQ-1; Mon, 24 Apr 2023 09:28:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D325884EC0; Mon, 24 Apr 2023 13:28:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id C613D14171B8; Mon, 24 Apr 2023 13:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k5bzcZooZtB1ehj39FLgF5FrjIGqOSuQvTuDX70IDso=; b=ahYGc+4wma94Hcl11TenXWYb5KKsNTDVzsUHa3nspCg/MUnyl13LeSZxg9ukULB/1FBRrM ZJPpbwiOYoSFpRhDDUdA1uBwl2DEWvJzxTdsGkink3aFmIjrD62b94wlamYSJx/AxD2zOS H7G0qcTCGgqh40Ot9sGW9hxjhPLf6EY= X-MC-Unique: 6bLoYhGDMNezc7NIAd8btQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 20/30] migration: Use migrate_max_postcopy_bandwidth() Date: Mon, 24 Apr 2023 15:27:20 +0200 Message-Id: <20230424132730.70752-21-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343546704100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index f19ab592ae..4a9e5310f1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3795,7 +3795,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) =20 if (resume) { /* This is a resumed migration */ - rate_limit =3D s->parameters.max_postcopy_bandwidth / + rate_limit =3D migrate_max_postcopy_bandwidth() / XFER_LIMIT_RATIO; } else { /* This is a fresh new migration */ --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343626; cv=none; d=zohomail.com; s=zohoarc; b=nopcxBNL7qS+0DGB/QMXUZkTk0vjgsnGZJTGOfyuvfskut6ASZ5DhEav+pZuARdy/sPr13rG7IbY08J/w0Nje37dZkjU98Oj5B3MgoEsK+5akF1qQZr0rxerLOs1dO/t/dz8fMX9BPHdTCV28cIPTlNdSAZ1WFaaov/ZOU6Z7ek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343626; 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=K1J6OxRTtglwpDj4Nlt4o9omlyc507QrI635JBEbBnU=; b=W19+c+Oe6Pg26US/Yt/yfGzuX0M0gM8+Vy1aZovXysHOstEuXnui/kX/G6NMECv0NJEIR81fI4z/BFGXxYpIB/JTeWMv26SknAiSK92XZiBhRf0bA2SiW/9K2y8SliMTtnCDy4PMIINdRNCY7XdInmWJJr36vSf9QqfgkgEvgJo= 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 1682343626294700.476833668892; Mon, 24 Apr 2023 06:40:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFt-0008CY-EZ; Mon, 24 Apr 2023 09:29:21 -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 1pqwFW-0007OK-Ul for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001VY-Bn for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:58 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-22-Se3WLglJPZ6kvnUPcV4YWQ-1; Mon, 24 Apr 2023 09:28:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1298E2823803; Mon, 24 Apr 2023 13:28:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BD7214171B8; Mon, 24 Apr 2023 13:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K1J6OxRTtglwpDj4Nlt4o9omlyc507QrI635JBEbBnU=; b=ey+bMsPuK6+IyWcWJiaza7aMSxr8EbabNu53CYCnFxmcybc4A9gttP5JwJ2aPMSYO4Ibhm zMTb22c0qpIjHZNb8YizmeV9yH1lj9LReXVhuPE+a/89kH1fgMStpyXiNSKynpG+F4xDtx 1KsuqiY0NtVykRNuKVFn4UHsr6RM2XA= X-MC-Unique: Se3WLglJPZ6kvnUPcV4YWQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela Subject: [PULL 21/30] migration: Move migrate_use_block_incremental() to option.c Date: Mon, 24 Apr 2023 15:27:21 +0200 Message-Id: <20230424132730.70752-22-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343626702100001 Content-Type: text/plain; charset="utf-8" To be consistent with every other parameter, rename to migrate_block_incremental(). Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/block.c | 2 +- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/block.c b/migration/block.c index f0977217cf..6d532ac7a2 100644 --- a/migration/block.c +++ b/migration/block.c @@ -417,7 +417,7 @@ static int init_blk_migration(QEMUFile *f) bmds->bulk_completed =3D 0; bmds->total_sectors =3D sectors; bmds->completed_sectors =3D 0; - bmds->shared_base =3D migrate_use_block_incremental(); + bmds->shared_base =3D migrate_block_incremental(); =20 assert(i < num_bs); bmds_bs[i].bmds =3D bmds; diff --git a/migration/migration.c b/migration/migration.c index 4a9e5310f1..5ab1e48f57 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2157,7 +2157,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, error_setg(errp, "No disk migration is required in COLO mode"); return false; } - if (migrate_block() || migrate_use_block_incremental()) { + if (migrate_block() || migrate_block_incremental()) { error_setg(errp, "Command options are incompatible with " "current migration capabilities"); return false; @@ -2273,15 +2273,6 @@ int migrate_use_tls(void) return s->parameters.tls_creds && *s->parameters.tls_creds; } =20 -bool migrate_use_block_incremental(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.block_incremental; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 8451e5f2fe..86051af132 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -451,7 +451,6 @@ bool migrate_postcopy(void); =20 int migrate_use_tls(void); =20 -bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); =20 uint64_t ram_get_total_transferred_pages(void); diff --git a/migration/options.c b/migration/options.c index 8d15be858c..2b6d88b4b9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -463,6 +463,15 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, =20 /* parameters */ =20 +bool migrate_block_incremental(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.block_incremental; +} + int migrate_compress_level(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index b24ee92283..96d5a8e6e4 100644 --- a/migration/options.h +++ b/migration/options.h @@ -45,6 +45,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp); =20 /* parameters */ =20 +bool migrate_block_incremental(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343551; cv=none; d=zohomail.com; s=zohoarc; b=Z7aSDuE9WVbiXql+tgYvMrGU/5iVrwlI4jHTMw4yWrRdV1AlN4eeDC7kiZ9jwI2M2dfsnLSVmIc+FtquNTAtggCRKJfhz1uiUf1lahbVRiBTZrR3ZUm93/zn+sDtVIJnJ9AQSPqURy/CrjUnZwEKvy0KlH9clCGavXAav/4Wl5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343551; 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=vJmuQZaPu7nH5PMbCykAi61yGtbRRpVMry4aq5TSKj0=; b=Sja7k/aFk5ysR+UirveYhCNJoDy7LQ97svn+P7e654zMSrwU+4E2kcWCmrSX6VnuW1C7alqTgjfvb6O93H82ykQYtfUBRLGkvcbC8dTIB805a3BBEd8L8owgS1pgWQhVgZI5SlAtJL+MwIe7KBWq4aDLEHj+YkUZul4tFEf/aQo= 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 16823435517142.971243075890925; Mon, 24 Apr 2023 06:39:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFy-0008OY-3F; Mon, 24 Apr 2023 09:29:26 -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 1pqwFZ-0007QK-C3 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001XH-Fg for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602-mlN6u0lZPuG42qc690AqqQ-1; Mon, 24 Apr 2023 09:28:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E23BF2A59541; Mon, 24 Apr 2023 13:28:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51AEB14171B8; Mon, 24 Apr 2023 13:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vJmuQZaPu7nH5PMbCykAi61yGtbRRpVMry4aq5TSKj0=; b=QPjwKwAsSPPdqfF78jC5nCa4Cjg1RbAdpzFWldpAZxHvm9UjwAwaUHWAskrkjCQVHfNB4J AhC2C/OLGqC2+V5mQ7UWBjem0Z4xyH/b+huthJSAMTjd7gwh1avnTcGIl8hTM3vkVpXUR5 jYmTcWa2JopVmAOHV6loRd9fxW3asAk= X-MC-Unique: mlN6u0lZPuG42qc690AqqQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 22/30] migration: Create migrate_throttle_trigger_threshold() Date: Mon, 24 Apr 2023 15:27:22 +0200 Message-Id: <20230424132730.70752-23-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343552250100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 2b6d88b4b9..b9f3815f7e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -554,6 +554,15 @@ int migrate_multifd_zstd_level(void) return s->parameters.multifd_zstd_level; } =20 +uint8_t migrate_throttle_trigger_threshold(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.throttle_trigger_threshold; +} + uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 96d5a8e6e4..aa54443353 100644 --- a/migration/options.h +++ b/migration/options.h @@ -55,6 +55,7 @@ int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); +uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 #endif diff --git a/migration/ram.c b/migration/ram.c index 4576d0d849..e82cee97c3 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1178,8 +1178,7 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) =20 static void migration_trigger_throttle(RAMState *rs) { - MigrationState *s =3D migrate_get_current(); - uint64_t threshold =3D s->parameters.throttle_trigger_threshold; + uint64_t threshold =3D migrate_throttle_trigger_threshold(); uint64_t bytes_xfer_period =3D stat64_get(&ram_counters.transferred) - rs->bytes_xfer_prev; uint64_t bytes_dirty_period =3D rs->num_dirty_pages_period * TARGET_PA= GE_SIZE; --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343259; cv=none; d=zohomail.com; s=zohoarc; b=AVd1XOBlwZktnX6GkFByep6iwQpIpAAkmxBMu+uYtII1+Chz2o9ShCbt0eIMBbwbNes143xOZi+rtCYfiMP9iA5OEH9wY7yaepDO2QETGfjqorOkgbq4gmfhtVk7fk26QkMhHhIajo8hpVB1hqlYkoiqRPC40SpkRe+cG/he89c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343259; 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=3BW2cEofA38FvKkbq7h7UpdhmSKQ87+6bcNHyn8dKC0=; b=h+QkKB/wslCy7BgT+EoBb2ufykNEdwisKijUQ5K7ffp9Y/AnJuKzE6Nb7jwQzqnhNMgb2dATZDHFpnG2Or1itKvoB/h97qZCWeCcdu9gUHQdl3i4BDFJPa7fMHdmP/1Wkj5ZNvgUr/7vokMeNQ3kCafOIhV5JEGB5COtyApf2QE= 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 1682343259969267.97497786427425; Mon, 24 Apr 2023 06:34:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG0-0008U2-8x; Mon, 24 Apr 2023 09:29:28 -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 1pqwFZ-0007PM-0b for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001XM-G7 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:00 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-mbwHkHWWPWuatBNRtRtMxA-1; Mon, 24 Apr 2023 09:28:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C72A02A5957D; Mon, 24 Apr 2023 13:28:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3195914171B8; Mon, 24 Apr 2023 13:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3BW2cEofA38FvKkbq7h7UpdhmSKQ87+6bcNHyn8dKC0=; b=dgeZ0jYuVLqcVn/ERB//Q8czleQvC2rUxOtwe8tncnQ1L5G40JNz1CTTJq7LuDKnjVUSHa UpBZh0AgySUA0Tjdp+qzLRp8ZLiSDH9SZbPMHbq3dlL0F11DPY5bvxpUK44OXZtno+/mwf h1H4euiEsd6ZYo4t5A5SUj/FLWzWCBs= X-MC-Unique: mbwHkHWWPWuatBNRtRtMxA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 23/30] migration: Create migrate_checkpoint_delay() Date: Mon, 24 Apr 2023 15:27:23 +0200 Message-Id: <20230424132730.70752-24-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343261897100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/colo.c | 5 ++--- migration/options.c | 9 +++++++++ migration/options.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 93b78c9270..07bfa21fea 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -576,7 +576,7 @@ static void colo_process_checkpoint(MigrationState *s) trace_colo_vm_state_change("stop", "run"); =20 timer_mod(s->colo_delay_timer, qemu_clock_get_ms(QEMU_CLOCK_HOST) + - s->parameters.x_checkpoint_delay); + migrate_checkpoint_delay()); =20 while (s->state =3D=3D MIGRATION_STATUS_COLO) { if (failover_get_state() !=3D FAILOVER_STATUS_NONE) { @@ -651,8 +651,7 @@ void colo_checkpoint_notify(void *opaque) =20 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 + - s->parameters.x_checkpoint_delay; + next_notify_time =3D s->colo_checkpoint_time + migrate_checkpoint_dela= y(); timer_mod(s->colo_delay_timer, next_notify_time); } =20 diff --git a/migration/options.c b/migration/options.c index b9f3815f7e..0e102e5700 100644 --- a/migration/options.c +++ b/migration/options.c @@ -472,6 +472,15 @@ bool migrate_block_incremental(void) return s->parameters.block_incremental; } =20 +uint32_t migrate_checkpoint_delay(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.x_checkpoint_delay; +} + int migrate_compress_level(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index aa54443353..adc2879bbb 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,6 +46,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp); /* parameters */ =20 bool migrate_block_incremental(void); +uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343561; cv=none; d=zohomail.com; s=zohoarc; b=iPxqkJcybVIbv+R5jI0TowroduzwrXa7czd+eeZ+U39kg0rehdhKFOFlhIxjxqXpy4+s2hy0Vy9vfhdJnklegcJ7JP2X8xlG0ikZR+TMCw0em8M7hnBr3k0PO3MhsVe6Xbxtn22+FQQa0sL6sM0ohRGe6G8T+BKYQJAFniNUC0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343561; 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=s3/fr4JERXH8o/w7crf1qLjlhfQ2akXnUepo6lQE9fU=; b=cHQZr6O6Xr4kpLY0FUoVHgs8PQJqARJsFhUp+ofeRbn0geKjmQwyqKHowbva4V4lcKaofNlA4Pw6ycwsxMO5ctiKkYIVsLa65w7sW8e4A4acrLJfxmgsOmnAX/Mr0cndwVytj5uInvrfX8ojHzk3gJc1ZI9r/RCSMpkBXIzXKAM= 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 1682343561369402.58932702883146; Mon, 24 Apr 2023 06:39:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG3-000099-V8; Mon, 24 Apr 2023 09:29:32 -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 1pqwFW-0007OM-Vr for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001XZ-DH for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:58 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-pHz1a1DcMtKeRocjIWN0cw-1; Mon, 24 Apr 2023 09:28:46 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A254DA0F386; Mon, 24 Apr 2023 13:28:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1114D14171B8; Mon, 24 Apr 2023 13:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s3/fr4JERXH8o/w7crf1qLjlhfQ2akXnUepo6lQE9fU=; b=EWPWYdTTWG4xi+admWgsO7y8Q5EhPli2H0lQ6NfQCRhCEgk7Ib7tJJzpi0nKklzMVnAih0 6+DZtAGFu8HKgN62fTBNrlOG0seY8zWO9GVeiYbOPP/aOK7f2im63+uXQhv+ghp6xXOpl1 q0s1HUhbPLzq0X6HN4s/JoFa0NYDjsQ= X-MC-Unique: pHz1a1DcMtKeRocjIWN0cw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 24/30] migration: Create migrate_max_cpu_throttle() Date: Mon, 24 Apr 2023 15:27:24 +0200 Message-Id: <20230424132730.70752-25-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343563389100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.h | 2 -- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 86051af132..3ae938b19c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -451,8 +451,6 @@ bool migrate_postcopy(void); =20 int migrate_use_tls(void); =20 -int migrate_max_cpu_throttle(void); - uint64_t ram_get_total_transferred_pages(void); =20 /* Sending on the return path - generic and then for each message type */ diff --git a/migration/options.c b/migration/options.c index 0e102e5700..2cb04fbbd1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -517,6 +517,15 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 +uint8_t migrate_max_cpu_throttle(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.max_cpu_throttle; +} + int64_t migrate_max_postcopy_bandwidth(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index adc2879bbb..72b1a320b7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -51,6 +51,7 @@ int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); int migrate_decompress_threads(void); +uint8_t migrate_max_cpu_throttle(void); int64_t migrate_max_postcopy_bandwidth(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); diff --git a/migration/ram.c b/migration/ram.c index e82cee97c3..5c786513ef 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -715,7 +715,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirt= y_period, uint64_t pct_initial =3D s->parameters.cpu_throttle_initial; uint64_t pct_increment =3D s->parameters.cpu_throttle_increment; bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; - int pct_max =3D s->parameters.max_cpu_throttle; + int pct_max =3D migrate_max_cpu_throttle(); =20 uint64_t throttle_now =3D cpu_throttle_get_percentage(); uint64_t cpu_now, cpu_ideal, throttle_inc; --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343113; cv=none; d=zohomail.com; s=zohoarc; b=YaGTL27WR6M/rm6QUDIIwSi+qLrzeduVig3nzGo7b4kI9unx9Xm/ieYObIAZcQRdjW15PI1MeLWBrXUihhg6v1n9WkayCpBCCn29DuZFKJUswtl0KPF5nKnLk81Zr/vFvE5v6cTJaD97+Vny0WNhMzSI48wogE3JWEEHndDqMUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343113; 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=hgJGEFiRHVuS3WT7CRUSzkwrJRjVinYV1YnNK5RBqrc=; b=YuMHT765LJIU7Pe2hpRTfhdEPKxpWNsMYoC6W4ez0a/sKkpaMvBi045HDCDkTmcCoz/QYqv2u6L3UROUskqJHrb5vX8JHBw7FxKxnFv0s/LTiLeVIwbBv0mEd8jGQufHpVDZfcBkCOtQON9XKLKD2RyZctXlkGkpMHAUG/guFMo= 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 1682343113140763.8310476660446; Mon, 24 Apr 2023 06:31:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFw-0008Jj-9f; Mon, 24 Apr 2023 09:29:24 -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 1pqwFY-0007PG-2K for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFT-0001Y4-EJ for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:28:59 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-33-nO-OBZV-Pp2-deWabiT0uA-1; Mon, 24 Apr 2023 09:28:49 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A040785A5A3; Mon, 24 Apr 2023 13:28:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id E177114171BA; Mon, 24 Apr 2023 13:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hgJGEFiRHVuS3WT7CRUSzkwrJRjVinYV1YnNK5RBqrc=; b=cH0MOjfckc6V0IttIEeI3IR6iAzIz9i/I8gwc+QF8BJjt6hVCaPOQbjB27hVbY7OB3fpeL cKc2MPZFViAxkWhNHQMYN52Ujwq7RZgqNmz8EnUoRzevb7nWmsHDu70NxnZPHuCObpYKnn ts/fZ4VVIBaIElgeummdKtF4mHToEuc= X-MC-Unique: nO-OBZV-Pp2-deWabiT0uA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 25/30] migration: Move migrate_announce_params() to option.c Date: Mon, 24 Apr 2023 15:27:25 +0200 Message-Id: <20230424132730.70752-26-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343113805100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- Fix extra whitespace (fabiano) --- migration/migration.c | 14 -------------- migration/options.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5ab1e48f57..dccad95a55 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -954,20 +954,6 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) return params; } =20 -AnnounceParameters *migrate_announce_params(void) -{ - static AnnounceParameters ap; - - MigrationState *s =3D migrate_get_current(); - - ap.initial =3D s->parameters.announce_initial; - ap.max =3D s->parameters.announce_max; - ap.rounds =3D s->parameters.announce_rounds; - ap.step =3D s->parameters.announce_step; - - return ≈ -} - /* * Return true if we're already in the middle of a migration * (i.e. any of the active or setup states) diff --git a/migration/options.c b/migration/options.c index 2cb04fbbd1..418aafac64 100644 --- a/migration/options.c +++ b/migration/options.c @@ -16,6 +16,7 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qmp/qerror.h" #include "sysemu/runstate.h" +#include "migration/misc.h" #include "migration.h" #include "ram.h" #include "options.h" @@ -589,3 +590,19 @@ uint64_t migrate_xbzrle_cache_size(void) =20 return s->parameters.xbzrle_cache_size; } + +/* parameters helpers */ + +AnnounceParameters *migrate_announce_params(void) +{ + static AnnounceParameters ap; + + MigrationState *s =3D migrate_get_current(); + + ap.initial =3D s->parameters.announce_initial; + ap.max =3D s->parameters.announce_max; + ap.rounds =3D s->parameters.announce_rounds; + ap.step =3D s->parameters.announce_step; + + return ≈ +} --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343570; cv=none; d=zohomail.com; s=zohoarc; b=GVGdGXKA3Awp13DCQXqzSDAak6rCpELsCLin6H1fFFZ0yZqfK9EfFIL+AbGfN2NxYbbMg9b64IEydCKpC/BQNC2nv81CAW92xAT9qpVLwFvHtPXxZhdIuftS2dHtBiY4mcHKRHIgKozNRyh0Pcjs2vLVKEA5R3BDYFkykwCU7ME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343570; 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=Fyo1VKcz0RR5OJ7mMFuCQZ0Nb4anDzlu8aUQGK9hxQY=; b=WYtfcW0c/64PM+SgRlo8u7DEo2LEF8xz8f0+4Sq18wvukLHkp1/Pt95cwSWEIOeGQ5fxDgavAXngA4wvit0NLEoJRce27yXCxNCgfovzWl63Wrb8NbKnSBwSN5iCJ4eqpO+TKibyGx0QYw6mPo+FI+HqRlGQsM6wBAF1e9R2xR4= 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 1682343570095577.6661889500247; Mon, 24 Apr 2023 06:39:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG5-0000Fj-W2; Mon, 24 Apr 2023 09:29:34 -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 1pqwFb-0007SQ-4M for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFU-0001YK-5O for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:02 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-1J4kEX0jOMCvm2exxANdVg-1; Mon, 24 Apr 2023 09:28:52 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 916B92A59541; Mon, 24 Apr 2023 13:28:51 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFC7914171B8; Mon, 24 Apr 2023 13:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fyo1VKcz0RR5OJ7mMFuCQZ0Nb4anDzlu8aUQGK9hxQY=; b=ZrSRkerKD6TL+7xuVzg1A+OOK4Wj8QB4GR/6dU54den0TFEmScl88ZHEroUePIKxjgVSep p3q1did5j21yFLYmEgwBIb+p2x7gnxi7+m7mZTS/lzOdwZv55p/X5EQ/KsX5r//t9qZ3hl MtnJfMc+O2UCxtwmK/NyxSuv9kA1vE4= X-MC-Unique: 1J4kEX0jOMCvm2exxANdVg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 26/30] migration: Create migrate_cpu_throttle_initial() to option.c Date: Mon, 24 Apr 2023 15:27:26 +0200 Message-Id: <20230424132730.70752-27-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343570414100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.c b/migration/options.c index 418aafac64..f7fb6999f7 100644 --- a/migration/options.c +++ b/migration/options.c @@ -509,6 +509,15 @@ int migrate_compress_wait_thread(void) return s->parameters.compress_wait_thread; } =20 +uint8_t migrate_cpu_throttle_initial(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.cpu_throttle_initial; +} + int migrate_decompress_threads(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 72b1a320b7..fd8b91d767 100644 --- a/migration/options.h +++ b/migration/options.h @@ -50,6 +50,7 @@ uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); +uint8_t migrate_cpu_throttle_initial(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); int64_t migrate_max_postcopy_bandwidth(void); diff --git a/migration/ram.c b/migration/ram.c index 5c786513ef..5e855d5c22 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -712,7 +712,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirt= y_period, uint64_t bytes_dirty_threshold) { MigrationState *s =3D migrate_get_current(); - uint64_t pct_initial =3D s->parameters.cpu_throttle_initial; + uint64_t pct_initial =3D migrate_cpu_throttle_initial(); uint64_t pct_increment =3D s->parameters.cpu_throttle_increment; bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; int pct_max =3D migrate_max_cpu_throttle(); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343577; cv=none; d=zohomail.com; s=zohoarc; b=Z4HEplG+2qfhrjBqm491awuVWgp880Y+j6xEg9fIlZMQiaUn46yIXTg2UY/7GhR1oG7BepSyWT7V+xU+zfSFV8Cs/qeKEyjrifDxhdzbPSdCsS2xK1R0FjbodSOSzDS6Crj/2cAh3RrsMeD1naL+n0JjKLD8ipWYzcl55NjWs9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343577; 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=03i664peNjOruQHOiUPJjbN+JXHLxMgYHGIdIGXbwrU=; b=IjaqsB2nE8kEiN/7lyUK8VUtVwYnHQwKvph4nvEyPPyM2t4FmM9I1mAFNzgWufH11VMujPFaU1t73W4rJ3YWhJg+ZJZla9rsoDa/5UiChcFStTb341/zLTDAFtvckMSuo7RRxnAf44RS3Cg2hk7NKLQlfZm7vIryQrkLbRIy4xM= 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 1682343576739355.87468289760045; Mon, 24 Apr 2023 06:39:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwFv-0008IG-RP; Mon, 24 Apr 2023 09:29:23 -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 1pqwFb-0007TJ-FV for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFZ-0001bN-A7 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:03 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-316-cfWzBIJ0Ow6-uAJM_1Y7Lg-1; Mon, 24 Apr 2023 09:28:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 88AC62A59579; Mon, 24 Apr 2023 13:28:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D126B14171B8; Mon, 24 Apr 2023 13:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03i664peNjOruQHOiUPJjbN+JXHLxMgYHGIdIGXbwrU=; b=aqQILXbso/k1mqe5nxrFHR4RSCO6Uf4r07t8PRFkj6zWQhY2t7bC5DL/p3Q3lwg+Dl+MkS M6RkyBfGTd/PjWI2JduCNC4jKqkXt0ir7I6NVa4AWRWDSV+Tl6Wpi/ThzwxJ0eeZHknBVu nAATI1lJ04tAMhhms+Ddh4gbJPQCBfA= X-MC-Unique: cfWzBIJ0Ow6-uAJM_1Y7Lg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 27/30] migration: Create migrate_cpu_throttle_increment() function Date: Mon, 24 Apr 2023 15:27:27 +0200 Message-Id: <20230424132730.70752-28-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343578402100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.c b/migration/options.c index f7fb6999f7..31435d2b45 100644 --- a/migration/options.c +++ b/migration/options.c @@ -509,6 +509,15 @@ int migrate_compress_wait_thread(void) return s->parameters.compress_wait_thread; } =20 +uint8_t migrate_cpu_throttle_increment(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.cpu_throttle_increment; +} + uint8_t migrate_cpu_throttle_initial(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index fd8b91d767..49b29bdafd 100644 --- a/migration/options.h +++ b/migration/options.h @@ -50,6 +50,7 @@ uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); +uint8_t migrate_cpu_throttle_increment(void); uint8_t migrate_cpu_throttle_initial(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); diff --git a/migration/ram.c b/migration/ram.c index 5e855d5c22..5645745a42 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -713,7 +713,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirt= y_period, { MigrationState *s =3D migrate_get_current(); uint64_t pct_initial =3D migrate_cpu_throttle_initial(); - uint64_t pct_increment =3D s->parameters.cpu_throttle_increment; + uint64_t pct_increment =3D migrate_cpu_throttle_increment(); bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; int pct_max =3D migrate_max_cpu_throttle(); =20 --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343499; cv=none; d=zohomail.com; s=zohoarc; b=F8wqND+Ve6Pkc1pIkeTyellmJQq78RfxDaRGtlkMm4ApIA1Y+OaDbwPHW1Hd2Fjn9gL2Qvh2I8c5AUBQDbQgUIDCO9OxERhMKT+0kR8hFzNXzVhC57XJM3t5BKZmEv2NRId1E8pC3ADcZbH6uJgB436icWjtrJSCQdbPegulKpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343499; 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=POIHjn/hGnJJjweM4fpqFFuKQqc53WvakhnGWxLjUu8=; b=Me9j/8H9nPnZ8piFkOMLW8ey9fmKE+osVVMWGpNWX9mq05BWjW24cIGCvN18/79wBblUcQNY58EcVhmzpl3m4bccvieyvq1DvxjX/+tdRNvtT/eKD8ppN3Ql779bZS+03pGFDo1ZvU+Vj51pVQx/NJpzn+RnuYsqgUi9LvzAWDg= 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 1682343499117327.88057323612634; Mon, 24 Apr 2023 06:38:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG5-0000DV-E3; Mon, 24 Apr 2023 09:29:33 -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 1pqwFe-0007VX-E6 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFc-0001d0-PJ for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:06 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-uhp62Og7NUK5pTQT5AxKrw-1; Mon, 24 Apr 2023 09:28:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 817F7185A78F; Mon, 24 Apr 2023 13:28:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7CDA14171BA; Mon, 24 Apr 2023 13:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342944; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=POIHjn/hGnJJjweM4fpqFFuKQqc53WvakhnGWxLjUu8=; b=gUfVereGSe0U9BcsJ9V3x9UKxTV68M8Z5Ar47YOKVyNzjDvDHwYFDm5PrbC9G3HUCHQbqg ukSV/zhu1u85ylGhPM3p4+4QX3DkmUfAkmCYGzsiQtK6cXNP9bZOA5H1/LtcwTYr6vClnm fPBDnx6ygnkJWFKHtvC+OZAkGeEYD7I= X-MC-Unique: uhp62Og7NUK5pTQT5AxKrw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 28/30] migration: Create migrate_cpu_throttle_tailslow() function Date: Mon, 24 Apr 2023 15:27:28 +0200 Message-Id: <20230424132730.70752-29-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343501203100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 31435d2b45..615534c151 100644 --- a/migration/options.c +++ b/migration/options.c @@ -527,6 +527,15 @@ uint8_t migrate_cpu_throttle_initial(void) return s->parameters.cpu_throttle_initial; } =20 +bool migrate_cpu_throttle_tailslow(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.cpu_throttle_tailslow; +} + int migrate_decompress_threads(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 49b29bdafd..99f6bbd7a1 100644 --- a/migration/options.h +++ b/migration/options.h @@ -52,6 +52,7 @@ int migrate_compress_threads(void); int migrate_compress_wait_thread(void); uint8_t migrate_cpu_throttle_increment(void); uint8_t migrate_cpu_throttle_initial(void); +bool migrate_cpu_throttle_tailslow(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); int64_t migrate_max_postcopy_bandwidth(void); diff --git a/migration/ram.c b/migration/ram.c index 5645745a42..01356f60a4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -711,10 +711,9 @@ static size_t save_page_header(PageSearchStatus *pss, = QEMUFile *f, static void mig_throttle_guest_down(uint64_t bytes_dirty_period, uint64_t bytes_dirty_threshold) { - MigrationState *s =3D migrate_get_current(); uint64_t pct_initial =3D migrate_cpu_throttle_initial(); uint64_t pct_increment =3D migrate_cpu_throttle_increment(); - bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; + bool pct_tailslow =3D migrate_cpu_throttle_tailslow(); int pct_max =3D migrate_max_cpu_throttle(); =20 uint64_t throttle_now =3D cpu_throttle_get_percentage(); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343551; cv=none; d=zohomail.com; s=zohoarc; b=j/is+RULAKLgAqlcpsNJEU2POTNuf2SJhYfxVB73WW97kwEp7iJw575VNH/RtBleG7gM34xBWicoOI8+MNnj0RfSmAlWmk9efkzyOE00D53kQwlGrVh+2IkekNYWKaKsGWoyLNMZa/1ZagfIijJRKnpjHRN3QUxseEqf8ODw8ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343551; 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=+6n+gAfOkuODCtOAVM6y39i4P0a+dylqFR14uo3fg14=; b=eB0+WM6Av57s6YCxENwSYzhQUKaW9nemCir3I8dvIiXJm3QZRoBn/jYQm9+h7fkT/hCQJZ3hJ+iy8OsUEzLgPa7OBNJfblDZGI5ssHWn2O5YcP24nC0k6LhP4Qiysj+ytn7l6D3WzQ3YVuiwOnY5vLFAimSeBrRV83Uc8glpHGw= 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 1682343551684746.2463044017801; Mon, 24 Apr 2023 06:39:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwGA-0000RM-IB; Mon, 24 Apr 2023 09:29:38 -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 1pqwFh-0007Zo-T2 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFg-0001de-DY for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-488-zyEeBVmjPOyTomDF_u9EjA-1; Mon, 24 Apr 2023 09:29:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 784DDA0F383; Mon, 24 Apr 2023 13:29:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id C053814171B8; Mon, 24 Apr 2023 13:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342947; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+6n+gAfOkuODCtOAVM6y39i4P0a+dylqFR14uo3fg14=; b=EDbvaBPcOo7t/Hx/mgOuYREH9k93WWlLQz9SPqx/4FBSdYBBa1XQztodSRgYpbi6MwhdCW bki5OeUxN6x6WnWjJsvlsT/UylpsrKV0DYmWutiHUsG9z6hP9tLEuY+AuYmV+eeAlCjdvh EcY1IHDN7Hzoc3S1GHm9vWVj7pEnl5w= X-MC-Unique: zyEeBVmjPOyTomDF_u9EjA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 29/30] migration: Move migrate_postcopy() to options.c Date: Mon, 24 Apr 2023 15:27:29 +0200 Message-Id: <20230424132730.70752-30-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 @redhat.com) X-ZM-MESSAGEID: 1682343553607100010 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 5 ----- migration/migration.h | 2 -- migration/options.c | 8 ++++++++ migration/options.h | 9 +++++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index dccad95a55..f20d7bcc06 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2245,11 +2245,6 @@ void qmp_migrate_continue(MigrationStatus state, Err= or **errp) qemu_sem_post(&s->pause_sem); } =20 -bool migrate_postcopy(void) -{ - return migrate_postcopy_ram() || migrate_dirty_bitmaps(); -} - int migrate_use_tls(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 3ae938b19c..dcf906868d 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -447,8 +447,6 @@ bool migration_is_blocked(Error **errp); bool migration_in_postcopy(void); MigrationState *migrate_get_current(void); =20 -bool migrate_postcopy(void); - int migrate_use_tls(void); =20 uint64_t ram_get_total_transferred_pages(void); diff --git a/migration/options.c b/migration/options.c index 615534c151..8bd2d949ae 100644 --- a/migration/options.c +++ b/migration/options.c @@ -204,6 +204,14 @@ bool migrate_zero_copy_send(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } + +/* pseudo capabilities */ + +bool migrate_postcopy(void) +{ + return migrate_postcopy_ram() || migrate_dirty_bitmaps(); +} + typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, diff --git a/migration/options.h b/migration/options.h index 99f6bbd7a1..093bc907a1 100644 --- a/migration/options.h +++ b/migration/options.h @@ -38,6 +38,15 @@ bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 +/* + * pseudo capabilities + * + * These are functions that are used in a similar way to capabilities + * check, but they are not a capability. + */ + +bool migrate_postcopy(void); + /* capabilities helpers */ =20 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); --=20 2.39.2 From nobody Tue Feb 10 13:16:24 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682343383; cv=none; d=zohomail.com; s=zohoarc; b=OVLtm7avv18LPbaARdFF/KkTEyck1+uRNyaBATFaEFhogxX+MGhYTvYlMxoJXOtQFW7mBfDBVE0mZtLPok2Nvg2qRnnBE9vRFOoPUwC45WQxWaupNmIi/42n8ay/HDASZG/iCX9BmqXotqfT5q/yjEBRxvdoYe5h6ISoN+KWsQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343383; 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=gAzce2EJ087fvLC7TBOC1YGvh71kLDmvPybq4Ac+vT8=; b=A1kNC/jcRRCvD6wVUoljwUN1x8il+LzmCXMdD2Cq7gWrInWGXAkxuZQmhSEgr8PMrN41TTNBjlousRrStsTdYYid3hplk6saDjB1e+S/D8KOtyB1RQewynMYZNLx9iOAWgbYa6/v3fLf1YMajRCrem/Wg3VVWBlaMrysU7igGuQ= 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 1682343383867333.89725485335225; Mon, 24 Apr 2023 06:36:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqwG8-0000MK-Lt; Mon, 24 Apr 2023 09:29:36 -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 1pqwFn-0007rq-9K for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqwFl-0001eX-CK for qemu-devel@nongnu.org; Mon, 24 Apr 2023 09:29:15 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-qURR1ThGOba7OX2wOm31wg-1; Mon, 24 Apr 2023 09:29:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C71E2823801; Mon, 24 Apr 2023 13:29:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id B86A614171B8; Mon, 24 Apr 2023 13:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682342952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gAzce2EJ087fvLC7TBOC1YGvh71kLDmvPybq4Ac+vT8=; b=hkOLbzsfbIW0H7z98xZnX83VaM81+XpVTLedAG05CoSEsOl8KOwjp3BdrS3n1ZCPQuVEEZ uXtBh7BFBbL6vD0y3LldQuVkQreQjDqF36aLRQKayq7fl4p6g2WoDfvbBMHZW7dfZjHUG9 OiSulv7yRR7WoYz0fpfqjWqSCvAQOSY= X-MC-Unique: qURR1ThGOba7OX2wOm31wg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Hailiang Zhang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Fam Zheng , Eric Blake , John Snow , Vladimir Sementsov-Ogievskiy , Gerd Hoffmann , Peter Xu , Markus Armbruster , Leonardo Bras , David Hildenbrand , Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-block@nongnu.org, Juan Quintela , Fabiano Rosas Subject: [PULL 30/30] migration: Create migrate_max_bandwidth() function Date: Mon, 24 Apr 2023 15:27:30 +0200 Message-Id: <20230424132730.70752-31-quintela@redhat.com> In-Reply-To: <20230424132730.70752-1-quintela@redhat.com> References: <20230424132730.70752-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 @redhat.com) X-ZM-MESSAGEID: 1682343385463100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 70 +------------------------------------- migration/options.c | 79 +++++++++++++++++++++++++++++++++++++++++++ migration/options.h | 1 + 3 files changed, 81 insertions(+), 69 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f20d7bcc06..53dd59f6f6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -886,74 +886,6 @@ void migrate_send_rp_resume_ack(MigrationIncomingState= *mis, uint32_t value) migrate_send_rp_message(mis, MIG_RP_MSG_RESUME_ACK, sizeof(buf), &buf); } =20 -MigrationParameters *qmp_query_migrate_parameters(Error **errp) -{ - MigrationParameters *params; - MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - params =3D g_malloc0(sizeof(*params)); - params->has_compress_level =3D true; - params->compress_level =3D s->parameters.compress_level; - params->has_compress_threads =3D true; - params->compress_threads =3D s->parameters.compress_threads; - params->has_compress_wait_thread =3D true; - params->compress_wait_thread =3D s->parameters.compress_wait_thread; - params->has_decompress_threads =3D true; - params->decompress_threads =3D s->parameters.decompress_threads; - params->has_throttle_trigger_threshold =3D true; - params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->has_cpu_throttle_initial =3D true; - params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->has_cpu_throttle_increment =3D true; - params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->has_cpu_throttle_tailslow =3D true; - params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D g_strdup(s->parameters.tls_creds); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); - params->tls_authz =3D g_strdup(s->parameters.tls_authz ? - s->parameters.tls_authz : ""); - params->has_max_bandwidth =3D true; - params->max_bandwidth =3D s->parameters.max_bandwidth; - params->has_downtime_limit =3D true; - params->downtime_limit =3D s->parameters.downtime_limit; - params->has_x_checkpoint_delay =3D true; - params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->has_block_incremental =3D true; - params->block_incremental =3D s->parameters.block_incremental; - params->has_multifd_channels =3D true; - params->multifd_channels =3D s->parameters.multifd_channels; - params->has_multifd_compression =3D true; - params->multifd_compression =3D s->parameters.multifd_compression; - params->has_multifd_zlib_level =3D true; - params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->has_multifd_zstd_level =3D true; - params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->has_xbzrle_cache_size =3D true; - params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->has_max_postcopy_bandwidth =3D true; - params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->has_max_cpu_throttle =3D true; - params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->has_announce_initial =3D true; - params->announce_initial =3D s->parameters.announce_initial; - params->has_announce_max =3D true; - params->announce_max =3D s->parameters.announce_max; - params->has_announce_rounds =3D true; - params->announce_rounds =3D s->parameters.announce_rounds; - params->has_announce_step =3D true; - params->announce_step =3D s->parameters.announce_step; - - if (s->parameters.has_block_bitmap_mapping) { - params->has_block_bitmap_mapping =3D true; - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - } - - return params; -} - /* * Return true if we're already in the middle of a migration * (i.e. any of the active or setup states) @@ -3771,7 +3703,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) XFER_LIMIT_RATIO; } else { /* This is a fresh new migration */ - rate_limit =3D s->parameters.max_bandwidth / XFER_LIMIT_RATIO; + rate_limit =3D migrate_max_bandwidth() / XFER_LIMIT_RATIO; =20 /* Notify before starting migration thread */ notifier_list_notify(&migration_state_notifiers, s); diff --git a/migration/options.c b/migration/options.c index 8bd2d949ae..8e8753d9be 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,8 +12,10 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/clone-visitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" #include "sysemu/runstate.h" #include "migration/misc.h" @@ -562,6 +564,15 @@ uint8_t migrate_max_cpu_throttle(void) return s->parameters.max_cpu_throttle; } =20 +uint64_t migrate_max_bandwidth(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.max_bandwidth; +} + int64_t migrate_max_postcopy_bandwidth(void) { MigrationState *s; @@ -641,3 +652,71 @@ AnnounceParameters *migrate_announce_params(void) =20 return ≈ } + +MigrationParameters *qmp_query_migrate_parameters(Error **errp) +{ + MigrationParameters *params; + MigrationState *s =3D migrate_get_current(); + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + params =3D g_malloc0(sizeof(*params)); + params->has_compress_level =3D true; + params->compress_level =3D s->parameters.compress_level; + params->has_compress_threads =3D true; + params->compress_threads =3D s->parameters.compress_threads; + params->has_compress_wait_thread =3D true; + params->compress_wait_thread =3D s->parameters.compress_wait_thread; + params->has_decompress_threads =3D true; + params->decompress_threads =3D s->parameters.decompress_threads; + params->has_throttle_trigger_threshold =3D true; + params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; + params->has_cpu_throttle_initial =3D true; + params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; + params->has_cpu_throttle_increment =3D true; + params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; + params->has_cpu_throttle_tailslow =3D true; + params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; + params->tls_creds =3D g_strdup(s->parameters.tls_creds); + params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); + params->tls_authz =3D g_strdup(s->parameters.tls_authz ? + s->parameters.tls_authz : ""); + params->has_max_bandwidth =3D true; + params->max_bandwidth =3D s->parameters.max_bandwidth; + params->has_downtime_limit =3D true; + params->downtime_limit =3D s->parameters.downtime_limit; + params->has_x_checkpoint_delay =3D true; + params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; + params->has_block_incremental =3D true; + params->block_incremental =3D s->parameters.block_incremental; + params->has_multifd_channels =3D true; + params->multifd_channels =3D s->parameters.multifd_channels; + params->has_multifd_compression =3D true; + params->multifd_compression =3D s->parameters.multifd_compression; + params->has_multifd_zlib_level =3D true; + params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; + params->has_multifd_zstd_level =3D true; + params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; + params->has_xbzrle_cache_size =3D true; + params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; + params->has_max_postcopy_bandwidth =3D true; + params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; + params->has_max_cpu_throttle =3D true; + params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; + params->has_announce_initial =3D true; + params->announce_initial =3D s->parameters.announce_initial; + params->has_announce_max =3D true; + params->announce_max =3D s->parameters.announce_max; + params->has_announce_rounds =3D true; + params->announce_rounds =3D s->parameters.announce_rounds; + params->has_announce_step =3D true; + params->announce_step =3D s->parameters.announce_step; + + if (s->parameters.has_block_bitmap_mapping) { + params->has_block_bitmap_mapping =3D true; + params->block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + s->parameters.block_bitmap_mapping); + } + + return params; +} diff --git a/migration/options.h b/migration/options.h index 093bc907a1..1b78fa9f3d 100644 --- a/migration/options.h +++ b/migration/options.h @@ -64,6 +64,7 @@ uint8_t migrate_cpu_throttle_initial(void); bool migrate_cpu_throttle_tailslow(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); +uint64_t migrate_max_bandwidth(void); int64_t migrate_max_postcopy_bandwidth(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); --=20 2.39.2