From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677774871; cv=none; d=zohomail.com; s=zohoarc; b=hofZxj4YhGf3+k3IcCPMy37igud6lBWAOhihlB9JOhbDmcryLOjtJ+3wJbmmU6Pp1fffpXoEycPIir8/6JtFATfu0gtvwie3uIjhE38M18KDdLMvsdStg+vR5LOf3M6faa//uOjLETDh2l26Rst4myW+x/B7mBDtPa2rQtXgQ4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677774871; 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=bgDh/Y2Of4zIROJLEjlKrhCwNenBgGZXKPd7oXbBBFk=; b=aUcKwIqNQ+7eqRW4EEbocj/bclG1YBOiv++ocKz9ny3mi5CEKXFxQjbNt/d6uN/mNT4ecdECdGySgcKRbgKo7DSikUWrv7j27PT78Ylwus3Lz767OwXxyHH4ufMuOLw0DW34jnG8sHWiB1WdigDL37Ls9Bm4HStp0SCWqSqsvEY= 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 1677774871787748.3615862829406; Thu, 2 Mar 2023 08:34:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlsw-000682-ML; Thu, 02 Mar 2023 11:34:27 -0500 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 1pXlss-00065Q-Pv for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:23 -0500 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 1pXlsq-0007CK-U5 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:22 -0500 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-528-sWRQSv26N5qOjv7x0JQ7qQ-1; Thu, 02 Mar 2023 11:34:16 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2F5E885622; Thu, 2 Mar 2023 16:34:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD489492B00; Thu, 2 Mar 2023 16:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774860; 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=bgDh/Y2Of4zIROJLEjlKrhCwNenBgGZXKPd7oXbBBFk=; b=ffIy4fDmPtbv3pQ7B6wITg4UNSR5K7jmihoqM3nQluWvVDtAHOsmvZqDj2h2QRuEmv0zuH CfOGJy9+n0mqJSp2wZmLrFU5XobYwo2YVMeyDSPHKpxRDADtl7cV4bDz01voM1FkqLu7op 9AdVo+Ur0YUKhNEhUArEFzuOIrc9xL0= X-MC-Unique: sWRQSv26N5qOjv7x0JQ7qQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 01/43] migration: rename enabled_capabilities to capabilities Date: Thu, 2 Mar 2023 17:33:28 +0100 Message-Id: <20230302163410.11399-2-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677774872414100001 Content-Type: text/plain; charset="utf-8" It is clear from the context what that means, and such a long name with the extra long names of the capabilities make very difficilut to stay inside the 80 columns limit. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.h | 2 +- migration/migration.c | 52 +++++++++++++++++++++---------------------- migration/rdma.c | 4 ++-- migration/savevm.c | 6 ++--- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 2da2f8a164..b07efaf259 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -299,7 +299,7 @@ struct MigrationState { int64_t downtime_start; int64_t downtime; int64_t expected_downtime; - bool enabled_capabilities[MIGRATION_CAPABILITY__MAX]; + bool capabilities[MIGRATION_CAPABILITY__MAX]; int64_t setup_time; /* * Whether guest was running when we enter the completion stage. diff --git a/migration/migration.c b/migration/migration.c index 67799f0958..f7e7c4f2b3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -363,8 +363,7 @@ static bool migrate_late_block_activate(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[ - MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; + return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } =20 /* @@ -943,7 +942,7 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabi= lities(Error **errp) #endif caps =3D g_malloc0(sizeof(*caps)); caps->capability =3D i; - caps->state =3D s->enabled_capabilities[i]; + caps->state =3D s->capabilities[i]; QAPI_LIST_APPEND(tail, caps); } =20 @@ -1462,13 +1461,13 @@ void qmp_migrate_set_capabilities(MigrationCapabili= tyStatusList *params, return; } =20 - memcpy(cap_list, s->enabled_capabilities, sizeof(cap_list)); + memcpy(cap_list, s->capabilities, sizeof(cap_list)); if (!migrate_caps_check(cap_list, params, errp)) { return; } =20 for (cap =3D params; cap; cap =3D cap->next) { - s->enabled_capabilities[cap->value->capability] =3D cap->value->st= ate; + s->capabilities[cap->value->capability] =3D cap->value->state; } } =20 @@ -2537,7 +2536,7 @@ bool migrate_release_ram(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; + return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; } =20 bool migrate_postcopy_ram(void) @@ -2546,7 +2545,7 @@ bool migrate_postcopy_ram(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; } =20 bool migrate_postcopy(void) @@ -2560,7 +2559,7 @@ bool migrate_auto_converge(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; + return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; } =20 bool migrate_zero_blocks(void) @@ -2569,7 +2568,7 @@ bool migrate_zero_blocks(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; + return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } =20 bool migrate_postcopy_blocktime(void) @@ -2578,7 +2577,7 @@ bool migrate_postcopy_blocktime(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME= ]; + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; } =20 bool migrate_use_compression(void) @@ -2587,7 +2586,7 @@ bool migrate_use_compression(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS]; + return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; } =20 int migrate_compress_level(void) @@ -2632,7 +2631,7 @@ bool migrate_dirty_bitmaps(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; + return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 bool migrate_ignore_shared(void) @@ -2641,7 +2640,7 @@ bool migrate_ignore_shared(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; + return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; } =20 bool migrate_validate_uuid(void) @@ -2650,7 +2649,7 @@ bool migrate_validate_uuid(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; + return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; } =20 bool migrate_use_events(void) @@ -2659,7 +2658,7 @@ bool migrate_use_events(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_EVENTS]; + return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; } =20 bool migrate_use_multifd(void) @@ -2668,7 +2667,7 @@ bool migrate_use_multifd(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 bool migrate_pause_before_switchover(void) @@ -2677,8 +2676,7 @@ bool migrate_pause_before_switchover(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[ - MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; + return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; } =20 int migrate_multifd_channels(void) @@ -2725,7 +2723,7 @@ bool migrate_use_zero_copy_send(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; + return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } #endif =20 @@ -2744,7 +2742,7 @@ int migrate_use_xbzrle(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; + return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; } =20 uint64_t migrate_xbzrle_cache_size(void) @@ -2771,7 +2769,7 @@ bool migrate_use_block(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK]; + return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; } =20 bool migrate_use_return_path(void) @@ -2780,7 +2778,7 @@ bool migrate_use_return_path(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; + return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; } =20 bool migrate_use_block_incremental(void) @@ -2798,7 +2796,7 @@ bool migrate_background_snapshot(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHO= T]; + return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 bool migrate_postcopy_preempt(void) @@ -2807,7 +2805,7 @@ bool migrate_postcopy_preempt(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; } =20 /* migration thread support */ @@ -3546,7 +3544,7 @@ fail: bool migrate_colo_enabled(void) { MigrationState *s =3D migrate_get_current(); - return s->enabled_capabilities[MIGRATION_CAPABILITY_X_COLO]; + return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; } =20 typedef enum MigThrError { @@ -4381,7 +4379,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) } =20 #define DEFINE_PROP_MIG_CAP(name, x) \ - DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false) + DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 static Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, @@ -4578,7 +4576,7 @@ static bool migration_object_check(MigrationState *ms= , Error **errp) } =20 for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (ms->enabled_capabilities[i]) { + if (ms->capabilities[i]) { QAPI_LIST_PREPEND(head, migrate_cap_add(i, true)); } } diff --git a/migration/rdma.c b/migration/rdma.c index 288eadc2d2..35f3d6bebe 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4178,7 +4178,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 ret =3D qemu_rdma_source_init(rdma, - s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); + s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); =20 if (ret) { goto err; @@ -4200,7 +4200,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 ret =3D qemu_rdma_source_init(rdma_return_path, - s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], er= rp); + s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); =20 if (ret) { goto return_path_err; diff --git a/migration/savevm.c b/migration/savevm.c index aa54a67fda..589ef926ab 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -253,7 +253,7 @@ static uint32_t get_validatable_capabilities_count(void) uint32_t result =3D 0; int i; for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->enabled_capabilities[i]) { + if (should_validate_capability(i) && s->capabilities[i]) { result++; } } @@ -275,7 +275,7 @@ static int configuration_pre_save(void *opaque) state->capabilities =3D g_renew(MigrationCapability, state->capabiliti= es, state->caps_count); for (i =3D j =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->enabled_capabilities[i]) { + if (should_validate_capability(i) && s->capabilities[i]) { state->capabilities[j++] =3D i; } } @@ -325,7 +325,7 @@ static bool configuration_validate_capabilities(SaveSta= te *state) continue; } source_state =3D test_bit(i, source_caps_bm); - target_state =3D s->enabled_capabilities[i]; + target_state =3D s->capabilities[i]; if (source_state !=3D target_state) { error_report("Capability %s is %s, but received capability is = %s", MigrationCapability_str(i), --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775053; cv=none; d=zohomail.com; s=zohoarc; b=aqPeZH13HHJrPMMt4IYZwtaRQT1ha7iHhcO22unuP9h4mJZnqjOTtmuskNFi8LhOq+SUskY6eZ0Cq8BjFMUmIbpw8Qag7o8IzZYuaI2p6hII6siGbOe5mPIsCo0w5J1gDgW8UtkVX7mvWExTWL5Q4QAkNmAEQ8Hp4RD+wneOykk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775053; 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=IZEpAP5Y8aP41NPFjBRieowkWvqu1YxdhWfCljNJgXc=; b=C69YZZgz1v9QqvsCoF3xBf+vLODMl0l+gYIaGcv/gXg5+4JxMurXeOuc2kzAIX1pY/DfFX7VK3NtSEMDmN8HVGrabEtPazrUL5Qlg0TAHHupOGcsLd+i+SK3dRnCb9bHg07EG4NbvNPsz7Ye7erGFEqy+XD72377k/9RjFwaw5c= 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 1677775053764227.50344495616957; Thu, 2 Mar 2023 08:37:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlt0-0006BI-V5; Thu, 02 Mar 2023 11:34:32 -0500 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 1pXlsu-00066O-VH for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:26 -0500 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 1pXlst-0007Ck-60 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:24 -0500 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-621-mS8fTb6IPTOSQLSKMLOjpg-1; Thu, 02 Mar 2023 11:34:19 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 695A187A9E2; Thu, 2 Mar 2023 16:34:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48A5F492C3E; Thu, 2 Mar 2023 16:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774862; 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=IZEpAP5Y8aP41NPFjBRieowkWvqu1YxdhWfCljNJgXc=; b=fg7ZwKuyAYIkmgUr3qC8/yYc7IbLCob2t6HQRWtoVN9djuhQJxIzov3/3XVl3pFL3lUKTk 6IF5ttw8/7UzS7XQ3H08C3pQbahJyAvZkeeIWPYuQ526IVlllM8AjNXJBtYgfVyNwwIJqZ lmgLSPtBVaaw2l2CG9/x7BQh4yDihcM= X-MC-Unique: mS8fTb6IPTOSQLSKMLOjpg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 02/43] migration: Pass migrate_caps_check() the old and new caps Date: Thu, 2 Mar 2023 17:33:29 +0100 Message-Id: <20230302163410.11399-3-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775056176100003 Content-Type: text/plain; charset="utf-8" We used to pass the old capabilities array and the new capabilities as a list. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 80 +++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f7e7c4f2b3..119027a656 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1267,30 +1267,20 @@ WriteTrackingSupport migrate_query_write_tracking(v= oid) } =20 /** - * @migration_caps_check - check capability validity + * @migration_caps_check - check capability compatibility * - * @cap_list: old capability list, array of bool - * @params: new capabilities to be applied soon + * @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 *cap_list, - MigrationCapabilityStatusList *params, - Error **errp) +static bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **err= p) { - MigrationCapabilityStatusList *cap; - bool old_postcopy_cap; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - old_postcopy_cap =3D cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]; - - for (cap =3D params; cap; cap =3D cap->next) { - cap_list[cap->value->capability] =3D cap->value->state; - } - #ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (cap_list[MIGRATION_CAPABILITY_BLOCK]) { + 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"); @@ -1299,7 +1289,7 @@ static bool migrate_caps_check(bool *cap_list, #endif =20 #ifndef CONFIG_REPLICATION - if (cap_list[MIGRATION_CAPABILITY_X_COLO]) { + 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"= ); @@ -1307,12 +1297,13 @@ static bool migrate_caps_check(bool *cap_list, } #endif =20 - if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + 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_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && + 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 @@ -1321,13 +1312,13 @@ static bool migrate_caps_check(bool *cap_list, return false; } =20 - if (cap_list[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { + if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { error_setg(errp, "Postcopy is not compatible with ignore-share= d"); return false; } } =20 - if (cap_list[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { + if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { WriteTrackingSupport wt_support; int idx; /* @@ -1351,7 +1342,7 @@ static bool migrate_caps_check(bool *cap_list, */ for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { int incomp_cap =3D check_caps_background_snapshot.caps[idx]; - if (cap_list[incomp_cap]) { + if (new_caps[incomp_cap]) { error_setg(errp, "Background-snapshot is not compatible with %s", MigrationCapability_str(incomp_cap)); @@ -1361,10 +1352,10 @@ static bool migrate_caps_check(bool *cap_list, } =20 #ifdef CONFIG_LINUX - if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && - (!cap_list[MIGRATION_CAPABILITY_MULTIFD] || - cap_list[MIGRATION_CAPABILITY_COMPRESS] || - cap_list[MIGRATION_CAPABILITY_XBZRLE] || + 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, @@ -1372,15 +1363,15 @@ static bool migrate_caps_check(bool *cap_list, return false; } #else - if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { error_setg(errp, "Zero copy currently only available on Linux"); return false; } #endif =20 - if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { - if (!cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { + if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { error_setg(errp, "Postcopy preempt requires postcopy-ram"); return false; } @@ -1391,14 +1382,14 @@ static bool migrate_caps_check(bool *cap_list, * different compression channels, which is not compatible with the * preempt assumptions on channel assignments. */ - if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) { + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { error_setg(errp, "Postcopy preempt not compatible with compres= s"); return false; } } =20 - if (cap_list[MIGRATION_CAPABILITY_MULTIFD]) { - if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) { + if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { error_setg(errp, "Multifd is not compatible with compress"); return false; } @@ -1454,15 +1445,19 @@ void qmp_migrate_set_capabilities(MigrationCapabili= tyStatusList *params, { MigrationState *s =3D migrate_get_current(); MigrationCapabilityStatusList *cap; - bool cap_list[MIGRATION_CAPABILITY__MAX]; + bool new_caps[MIGRATION_CAPABILITY__MAX]; =20 if (migration_is_running(s->state)) { error_setg(errp, QERR_MIGRATION_ACTIVE); return; } =20 - memcpy(cap_list, s->capabilities, sizeof(cap_list)); - if (!migrate_caps_check(cap_list, params, errp)) { + 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; } =20 @@ -4566,27 +4561,14 @@ static void migration_instance_init(Object *obj) */ static bool migration_object_check(MigrationState *ms, Error **errp) { - MigrationCapabilityStatusList *head =3D NULL; /* Assuming all off */ - bool cap_list[MIGRATION_CAPABILITY__MAX] =3D { 0 }, ret; - int i; + bool old_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; =20 if (!migrate_params_check(&ms->parameters, errp)) { return false; } =20 - for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (ms->capabilities[i]) { - QAPI_LIST_PREPEND(head, migrate_cap_add(i, true)); - } - } - - ret =3D migrate_caps_check(cap_list, head, errp); - - /* It works with head =3D=3D NULL */ - qapi_free_MigrationCapabilityStatusList(head); - - return ret; + return migrate_caps_check(old_caps, ms->capabilities, errp); } =20 static const TypeInfo migration_type =3D { --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677774917; cv=none; d=zohomail.com; s=zohoarc; b=GNigWXD9PHXhoNsNADBkAiXE1z9qvl97ZfHOHWB70RQuhtJLSKWSB5XxGgFc9wkI4VjAnjOzjpaSzLDmvRaWGE/GfsvbM4rw1nFujhx4wwxMzT6smb+xBlkFXZBcbsWXrUMeSB+XBI2I9mJL21e+BsjQXSw/4RmAwNHTwhkC92c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677774917; 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=a0HV/kXml4P5842yvs0TV9UWcCO8XWY2YK7v2yQj0os=; b=B9W8XTJJYFLlmmPIbtyk8ewpnEZbAf5XqvDLcf1oCBCMStxJSQyLmCOQLc+bRpRWUK3XPCT1w3O7JuWQwYdY6hAREQ2nrFaNzW6Kk2SWa1XzOdgYqoioXzIflAkrsYmNwyf0jyYsyt4uYb64QcrSGQ3EL9hRaTya8VMhD+4AQWQ= 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 1677774917651203.16306182140056; Thu, 2 Mar 2023 08:35:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltB-0006Ky-6c; Thu, 02 Mar 2023 11:34:43 -0500 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 1pXlsw-000672-EB for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:26 -0500 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 1pXlsu-0007DU-RP for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:26 -0500 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-631-p4uHMXW5Ora8kzyDjwU41A-1; Thu, 02 Mar 2023 11:34:21 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A59FD385F36B; Thu, 2 Mar 2023 16:34:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1F9E492C3E; Thu, 2 Mar 2023 16:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774864; 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=a0HV/kXml4P5842yvs0TV9UWcCO8XWY2YK7v2yQj0os=; b=Ucn4kzYiWXc9gEnRuKnZMe8g7qidCPcG0ovCQn5TY8szilbTn+QX86n4TyznBkTxKY55Yk QlLgsSFYe/pVK7QbmPn/oRR7WZP+nsu1pxXJebR93BIbLjMlRaHtrDZ9VCQsrAu/uxfBjg avAQFghEXDdsGHn4QCtwEggxOqhs82Q= X-MC-Unique: p4uHMXW5Ora8kzyDjwU41A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 03/43] migration: Create migration_cap_set() Date: Thu, 2 Mar 2023 17:33:30 +0100 Message-Id: <20230302163410.11399-4-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677774918740100005 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 --- migration/migration.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 119027a656..e3062530f0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1910,25 +1910,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) @@ -1940,7 +1939,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; } @@ -2427,8 +2426,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775258; cv=none; d=zohomail.com; s=zohoarc; b=j/FbS9Hczzsu0A9/9zxhUqGfSBUVNe0XfUFw/IXAIWb0DP0Bqa7vYf7R4OueI8u0OexlnSr2MRgZXJnmnMXFC1Yaov0G/teIqGQtSn5blmCH4ExuzAZxsXkKBAXG5EwknX7Pi3tKzdh7PkfzRqIQqe83RnyQsuRi2cvq9jgocak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775258; 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=qoLMfG0mBfkTQYAlT1OQhRtfwATsz+ClZSA35K5jxOI=; b=fGo3Y7YgZ8ZV2hGZXBsCMqbfYjQDHq2ZoedM1f76r3lUWUU34P3XqMNi3fCGr6ouhMdSl3wJ9Tda8aMviK4jqDyFAEWZFmcPt2cLVppUf0zDB19NrXuMkRP/b1qgFxWqnEEFbsVm27JPtTAkgPFSzqX67pg+btdFMKzHThD7VUI= 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 1677775258892226.73204081218068; Thu, 2 Mar 2023 08:40:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltD-0006MZ-7N; Thu, 02 Mar 2023 11:34:43 -0500 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 1pXlsy-00069B-8q for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:28 -0500 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 1pXlsv-0007Dm-Mi for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:28 -0500 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-364-0_wFJEGnOjyIJULEOpkv4Q-1; Thu, 02 Mar 2023 11:34:23 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 120071C3626C; Thu, 2 Mar 2023 16:34:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED557492B01; Thu, 2 Mar 2023 16:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774864; 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=qoLMfG0mBfkTQYAlT1OQhRtfwATsz+ClZSA35K5jxOI=; b=QvQxBxt36SxIkKJYRjQI1TiRMO6nfW33+s77pdJFuZzbJJt0nHDQ0LuQgVFDTCLlyLHJhy eTRmKfs5pksshabVJVoT3jPcKSnnXAyXaDOgyH9jM3hqEjyJSfQEcvwXJ+UJmEQwNxdwLy nzRFNUl7li8GraYFUyWNiagSSBO+tNI= X-MC-Unique: 0_wFJEGnOjyIJULEOpkv4Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 04/43] migration: create options.c Date: Thu, 2 Mar 2023 17:33:31 +0100 Message-Id: <20230302163410.11399-5-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775259402100001 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 --- migration/migration.h | 12 ---- migration/options.h | 34 +++++++++ hw/virtio/virtio-balloon.c | 1 + migration/block-dirty-bitmap.c | 1 + migration/block.c | 1 + migration/colo.c | 1 + migration/migration.c | 109 +--------------------------- migration/options.c | 126 +++++++++++++++++++++++++++++++++ migration/postcopy-ram.c | 1 + migration/ram.c | 1 + migration/savevm.c | 1 + migration/socket.c | 1 + migration/meson.build | 1 + 13 files changed, 170 insertions(+), 120 deletions(-) create mode 100644 migration/options.h create mode 100644 migration/options.c diff --git a/migration/migration.h b/migration/migration.h index b07efaf259..68851e485d 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -410,16 +410,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); @@ -448,9 +439,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.h b/migration/options.h new file mode 100644 index 0000000000..bae032375a --- /dev/null +++ b/migration/options.h @@ -0,0 +1,34 @@ +/* + * QEMU migration options + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#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/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 426a25bb19..c4fe9fea56 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/migration.c b/migration/migration.c index e3062530f0..790848ef1c 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. @@ -2523,56 +2515,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; @@ -2618,33 +2565,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; @@ -2663,15 +2583,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; @@ -2783,24 +2694,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/options.c b/migration/options.c new file mode 100644 index 0000000000..47337a9a29 --- /dev/null +++ b/migration/options.c @@ -0,0 +1,126 @@ +/* + * QEMU migration capabilities + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#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/postcopy-ram.c b/migration/postcopy-ram.c index f54f44d899..ce41670466 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -36,6 +36,7 @@ #include "yank_functions.h" #include "tls.h" #include "qemu/userfaultfd.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 af749b369b..1c786eb8f4 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; 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', --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775291; cv=none; d=zohomail.com; s=zohoarc; b=mZOi44MkAMo2f8l8sh+iKohwyiti0hHZ80yPQLg1+ysQ/L93aY19J/MTsfGTeBLmoUUYIIYcx+VDeM7lmTDZdbToM3kSm0Mttc2C8FHjYYtuLGZRgL6IYZ4sPl+5BHA6GaDQh4/Tqk1MnkmaA/6VynAnJANFS0xTKgiDJS4THN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775291; 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=OABLIhMGsB/k7QWfanJGjHNB0bNFcak0lyPB6W/1Mqc=; b=TuAI0Qfs/kkVGHxl81cz6v/N/Jme6eXlEtG8gK2RcD9HUAm4xEZTJSlf0E9arK0Z/n9AKHsktjsMk9AhlMEYNalRJrr/KRql4QkG8D4+zJy2y5kjm4WhM+KAP7UuoX3TCRlv38k0b0jpIzwdiieJ9kIuGn/ZdZfGWt25cqavpKE= 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 1677775291728389.517978689276; Thu, 2 Mar 2023 08:41:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltE-0006RJ-M1; Thu, 02 Mar 2023 11:34:44 -0500 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 1pXlt7-0006Jm-I0 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:39 -0500 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 1pXlt5-0007GJ-Lu for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:37 -0500 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-245-MmZ3UfEeMJqVwOCFlYWREA-1; Thu, 02 Mar 2023 11:34:26 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4AC958027FD; Thu, 2 Mar 2023 16:34:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 579AC492B00; Thu, 2 Mar 2023 16:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774873; 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=OABLIhMGsB/k7QWfanJGjHNB0bNFcak0lyPB6W/1Mqc=; b=Egx2w10PaCeQcAowzIMEIe3FhdgXDtd04ChWjOQlu6kLxMEjLYXjUnmp0ZzXVOpAPBet7e 6KlIutWsf/0dXCN7Zr0lsgDW/W0KEINDLgAMrqCjK/+o3U4bsKvANev1clkREbxpUs/DwW oRYB0JlrhShLK5NE8I59Q1r8vE5lVkA= X-MC-Unique: MmZ3UfEeMJqVwOCFlYWREA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 05/43] migration: Move migrate_colo_enabled() to options.c Date: Thu, 2 Mar 2023 17:33:32 +0100 Message-Id: <20230302163410.11399-6-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775293897100003 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.h | 1 - migration/options.h | 1 + migration/migration.c | 16 +++++----------- migration/options.c | 6 ++++++ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 68851e485d..1ac11fdba9 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -424,7 +424,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.h b/migration/options.h index bae032375a..5d2d4298cd 100644 --- a/migration/options.h +++ b/migration/options.h @@ -20,6 +20,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); diff --git a/migration/migration.c b/migration/migration.c index 790848ef1c..03884f2f73 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2409,7 +2409,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; } @@ -3290,7 +3290,7 @@ static void migration_completion(MigrationState *s) ret =3D global_state_store(); =20 if (!ret) { - bool inactivate =3D !migrate_colo_enabled(); + bool inactivate =3D !migrate_colo(); ret =3D vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); trace_migration_completion_vm_stop(ret); if (ret >=3D 0) { @@ -3349,7 +3349,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); @@ -3427,12 +3427,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, @@ -3763,7 +3757,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__); } @@ -3959,7 +3953,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/options.c b/migration/options.c index 47337a9a29..6904d054a9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -35,6 +35,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; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775324; cv=none; d=zohomail.com; s=zohoarc; b=jYze0BbezU3fp6zKZ2B51uOVffEb28wydWLS/8xaMRzcgQDTPaNuyc/LGGu2QGPy5XzJVhWfSVz3kXNirSTxHs8bTkqRYhnYepjPxZK/81q9A58BfCjrQTz+alIV3E+6Gcsl80myI0DUo78EwJmTGZ050x0HNUbgC4C56rN5rcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775324; 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=dtKAThh7Qu5vP3N53Vr3XZfnfm7whtBCeT0zArtkwqk=; b=nds9+Uo1Pn5aTb+17XnuKkmo9BCuzW1CGk6udfH2T5sNKdAjKlX+3zhDUbPYmeZPuRZar9O31X1W5NQrcruvlzr+NVAyM18qQdYJ3gYluNg6zvkTPP5dwpmopw1CsKEI5eqoqH62vc9/MvsETVaWCbscmmDANhBiBb8i0mRE4Ng= 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 1677775324784740.9046656864103; Thu, 2 Mar 2023 08:42:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltD-0006LY-4M; Thu, 02 Mar 2023 11:34:43 -0500 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 1pXlt3-0006Gc-2g for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:33 -0500 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 1pXlt0-0007FM-OQ for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:32 -0500 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-374-IzcGRuRYOhykMrjMtKmhBw-1; Thu, 02 Mar 2023 11:34:27 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CD47885620; Thu, 2 Mar 2023 16:34:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E91A492C3E; Thu, 2 Mar 2023 16:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774870; 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=dtKAThh7Qu5vP3N53Vr3XZfnfm7whtBCeT0zArtkwqk=; b=V6SWso243syPsbfXh3hdt0tDAh30gm/TQPUs6+CL5a2Og40ma/AByL/76TERodq2BXPoTZ FGpgWGueG0i5emvvBTE9sPQn/22tGxUgtgeCOVwPMm7nVOLLlFm5GBPz7IOQvoRDdW2LBL NbDrCMJaXhYGyo0k5WrfH6jELa7T2To= X-MC-Unique: IzcGRuRYOhykMrjMtKmhBw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 06/43] migration: Move migrate_use_compression() to options.c Date: Thu, 2 Mar 2023 17:33:33 +0100 Message-Id: <20230302163410.11399-7-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775326140100001 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.h | 1 - migration/options.h | 1 + migration/migration.c | 11 +---------- migration/options.c | 9 +++++++++ migration/ram.c | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 1ac11fdba9..394728dd44 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -432,7 +432,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.h b/migration/options.h index 5d2d4298cd..aa9c165c94 100644 --- a/migration/options.h +++ b/migration/options.h @@ -21,6 +21,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/migration.c b/migration/migration.c index 03884f2f73..661c7c33d8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1131,7 +1131,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; @@ -2520,15 +2520,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/options.c b/migration/options.c index 6904d054a9..d1c44462c5 100644 --- a/migration/options.c +++ b/migration/options.c @@ -41,6 +41,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/ram.c b/migration/ram.c index 1c786eb8f4..fb868312f4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -591,7 +591,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 @@ -630,7 +630,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(); @@ -1161,7 +1161,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; @@ -2276,7 +2276,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 @@ -3739,7 +3739,7 @@ static int wait_for_decompress_done(void) { int idx, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } =20 @@ -3758,7 +3758,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(); @@ -3799,7 +3799,7 @@ static int compress_threads_load_setup(QEMUFile *f) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } =20 @@ -4265,7 +4265,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775237; cv=none; d=zohomail.com; s=zohoarc; b=GUGgGGoEtvjK+Q0yMiT97VxYbkTqO1lkdnTxR3TO1k/1D7ZBy0t+1x17OqH/zGETmUk/sdjid526PKUMX3w6FWAsMusR72Z1prLHkLd88HIeLoLWTT6a1PcZKAWiuNHFX6TRQQf1qMZAATfVYOUZ+oVGw4eydJVhEDeQ8M8txHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775237; 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=/p8MKO/JiEqlgCEusWTnSUa7UTtSaJ+G6H9bI7s/llE=; b=kLMFNkc5JyRS3FSFA9K853FZnt0WwUsolqShSDLKjpwxI5TIj3ljFJr1xzpWg6/hW822HvQeJ/j4IcDTAL6N9eL87jlmNVgLyI/RoRue27vy1XWBhRav+TEOZhpHo9MG9MacOSAo3vw2T/CX5XCZgi5l5YeSsaeZVAxSkF+8xAY= 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 1677775237680169.69600817046455; Thu, 2 Mar 2023 08:40:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltE-0006R3-AF; Thu, 02 Mar 2023 11:34:44 -0500 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 1pXlt6-0006Ja-5p for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:39 -0500 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 1pXlt4-0007GP-A1 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:35 -0500 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-665-YR_kGV8iPtik5c_19d-sbQ-1; Thu, 02 Mar 2023 11:34:30 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD8A9857A84; Thu, 2 Mar 2023 16:34:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id C347F492C3E; Thu, 2 Mar 2023 16:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774873; 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=/p8MKO/JiEqlgCEusWTnSUa7UTtSaJ+G6H9bI7s/llE=; b=FXDPiegMrQyiZbvp+ljJ4mySeN20HI91dK1aP1kW607AjbSC9euJir+gYrpIQIz4hPoxPN dAfUjyFts1oGTGmGGCj0PZGZcDWkfzogh/SWe9Uk8JpfkEY9khbc5Heebp04BvcpLY5r1S UnziSPo4REdhfNfgax1I5SQ/oMMYQ14= X-MC-Unique: YR_kGV8iPtik5c_19d-sbQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 07/43] migration: Move migrate_use_events() to options.c Date: Thu, 2 Mar 2023 17:33:34 +0100 Message-Id: <20230302163410.11399-8-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775239271100003 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.h | 1 - migration/options.h | 1 + migration/migration.c | 11 +---------- migration/options.c | 9 +++++++++ migration/ram.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 394728dd44..9d0b1fa45b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -436,7 +436,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.h b/migration/options.h index aa9c165c94..caf3b3aa69 100644 --- a/migration/options.h +++ b/migration/options.h @@ -23,6 +23,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/migration.c b/migration/migration.c index 661c7c33d8..6c87aab8af 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); } } @@ -2556,15 +2556,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/options.c b/migration/options.c index d1c44462c5..507b71631e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -59,6 +59,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/ram.c b/migration/ram.c index fb868312f4..98ad8e0130 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1252,7 +1252,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()) { qapi_event_send_migration_pass(ram_counters.dirty_sync_count); } } --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775059; cv=none; d=zohomail.com; s=zohoarc; b=CgRxMuXVe5cGSSZUHXYqpCA96Qg3zO0GCotFNp4LiZze3Sq3UgyodD8KxmHiECeyaSI+nq0JyYmdMjqAcDdaMgJBNQk66KWeuhuBmu63FdGpvS/oqPYxqJNmdkz//KFX6BOkUhZ6Fmeg3FffZAlv1k31uOGIwcBLeydohoZCpN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775059; 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=fer3j9NtghzJYSkTE1TqfTK5BJVt+M9orsQGr13PCpU=; b=B497RRM1KEdbPqHTrUSnpFJy7h6MKWHbhEcH0lFedvlxatV5GOMirSjhE1k5B8bOmLw5JL9Nk00hp3Xqb7fKqSpGMbNZGroOX6S7uRDmYOh2fyCl/sc8eG48vllMiO9ujABCB/Ci03xJXCMrc1ipjGnD3/Umhf1EfjLYWQ6Ambc= 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 16777750598271000.7953660827682; Thu, 2 Mar 2023 08:37:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltG-0006YJ-Gg; Thu, 02 Mar 2023 11:34:46 -0500 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 1pXltF-0006TB-Pj for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:45 -0500 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 1pXltD-0007Io-RV for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:45 -0500 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-219-rl03NQWzNRuuCTWPkiayCw-1; Thu, 02 Mar 2023 11:34:32 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A341280048A; Thu, 2 Mar 2023 16:34:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F55E492C3E; Thu, 2 Mar 2023 16:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774883; 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=fer3j9NtghzJYSkTE1TqfTK5BJVt+M9orsQGr13PCpU=; b=AJp9jMwhkttpSQobFQ1muMlKLEQk9GOcvSRt/dNYZgYdX6x0xTEu+0urNV1cf0vLzQztMS 1+zvL/sSE/3TaAl3wnVFi9OeJIU70b0KxJzjL2mcqqRjQjS6iWqSjul4VFJH7XDbStT4BA dMHOJhdsORNBdAmT1jBD3uSYLqJDbA0= X-MC-Unique: rl03NQWzNRuuCTWPkiayCw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 08/43] migration: Move migrate_use_multifd() to options.c Date: Thu, 2 Mar 2023 17:33:35 +0100 Message-Id: <20230302163410.11399-9-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775062012100003 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.h | 1 - migration/options.h | 1 + migration/migration.c | 19 +++++-------------- migration/multifd.c | 16 ++++++++-------- migration/options.c | 9 +++++++++ migration/ram.c | 2 +- migration/socket.c | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 9d0b1fa45b..19008fae0b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -410,7 +410,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/options.h b/migration/options.h index caf3b3aa69..a4f05a5e13 100644 --- a/migration/options.h +++ b/migration/options.h @@ -26,6 +26,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/migration.c b/migration/migration.c index 6c87aab8af..97daab9fd4 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 @@ -2556,15 +2556,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/multifd.c b/migration/multifd.c index 91552d33bf..95127feb8b 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) { @@ -910,7 +910,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 @@ -1015,7 +1015,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); } } @@ -1024,7 +1024,7 @@ void multifd_load_cleanup(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_recv_terminate_threads(NULL); @@ -1071,7 +1071,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++) { @@ -1169,7 +1169,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 @@ -1215,7 +1215,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 507b71631e..59663c460e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -86,6 +86,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/ram.c b/migration/ram.c index 98ad8e0130..59a624f59a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2368,7 +2368,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775042; cv=none; d=zohomail.com; s=zohoarc; b=ZgZXbCmi23/fen8tL6OPYrManGRowIfXczjy81RR91hMl+5sfm7qkk/5/HUBcVY+0wMzKNWRU33Hhsud64PVuDQbKnsjqZir8/cnJJQpuR3N6dS6kHpzV1MQ2bhNvRUVdpKC9zBLcvHbGUzKqcJWX+0IA1WNW20H6twAd3hLQ9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775042; 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=A9zsSFC4/kM0MDFasX8xKeCT7aacfG5AyYtYcQFRorw=; b=nrg9v1YqvzzuJ0jVWBSjMsUDsiuhfhpU06JNEZdNZYv2UKlUnKBetEpfnX0MNifOzATCrj01shvLcuO0SWMeAJw8kzM35cZccUnVTcUPaaVnS46CsDtEbogstXqYagsuFKHAkex1QzBsCJoEbcfqmPD0oWgZxoMi7EkV7yVmpO8= 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 1677775042691487.11049022058774; Thu, 2 Mar 2023 08:37:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltF-0006Ri-3T; Thu, 02 Mar 2023 11:34:45 -0500 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 1pXlt9-0006K2-01 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:39 -0500 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 1pXlt7-0007Go-AP for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:38 -0500 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-622-rbNHe_YwP6iCc1mjjCvQng-1; Thu, 02 Mar 2023 11:34:35 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CB2F3C10C92; Thu, 2 Mar 2023 16:34:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64EB3492B00; Thu, 2 Mar 2023 16:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774876; 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=A9zsSFC4/kM0MDFasX8xKeCT7aacfG5AyYtYcQFRorw=; b=O9ka+uu9M1FlV1d+D+EMat0GX1g4s85nfmFcZA3+qB9J9WOdfjTamomh+HHylSm/Wuo+xN iJkw4RCIuupmFN+yZuSikx8cj196eB55etXLxT82+6lQPaYtik4kkcjQoCGur4HjhFsFOv KdN5jGmBBjIJWbS3Nwoic1vKYGx6iCc= X-MC-Unique: rbNHe_YwP6iCc1mjjCvQng-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 09/43] migration: Move migrate_use_zero_copy_send() to options.c Date: Thu, 2 Mar 2023 17:33:36 +0100 Message-Id: <20230302163410.11399-10-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775043845100001 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.h | 5 ----- migration/options.h | 1 + migration/migration.c | 13 +------------ migration/multifd.c | 8 ++++---- migration/options.c | 9 +++++++++ migration/socket.c | 2 +- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 19008fae0b..7b82913c62 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -415,11 +415,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/options.h b/migration/options.h index a4f05a5e13..413ef29a2a 100644 --- a/migration/options.h +++ b/migration/options.h @@ -34,5 +34,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/migration.c b/migration/migration.c index 97daab9fd4..48cffab413 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1607,7 +1607,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, @@ -2593,17 +2593,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/multifd.c b/migration/multifd.c index 95127feb8b..29d66f5860 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 @@ -944,7 +944,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 59663c460e..2e00609b7b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -157,3 +157,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/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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677774936; cv=none; d=zohomail.com; s=zohoarc; b=jro1bPdrt8hVLOOXYDDYam2kv+KLRfwIr9rK3GaB3FCFD0mAxc9JSuVq0QqRFxcR791tmcfneDkBjG0JPAfkp0YVStJNFjvvx52WamO2SIEaY8AbyR+5SEwnVVioiI/rG6woHWSNiXZy0TPhZITwLyRnK23/ChUnUaFI5BtVh+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677774936; 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=9DuG+tx/kz7k4WTTmF8EACv1boJ/psLleMkJBSaQUMg=; b=Tc6hs1wK4Lxj5VFxk8VpAoGUvwWgut7BC6jZBN52QkRl/KpCn/W1gJPUlYTKoNxmH+tcGRN3fPI5ly1U4pCsA5VZIKG97SuhNkvzbBmux6ovVN20ayWOSG1kyXFwn9on+IEG8HYQAutBzz1x5DBAC01vEAbXjalKmEqwN21ZyrE= 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 1677774936049514.8858001672944; Thu, 2 Mar 2023 08:35:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltH-0006e1-Bk; Thu, 02 Mar 2023 11:34:47 -0500 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 1pXltC-0006Mg-R5 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:43 -0500 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 1pXltB-0007Hs-59 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:42 -0500 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-332-19vyYtYKMteg_5Qz7-Wwfg-1; Thu, 02 Mar 2023 11:34:37 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D17E829A9CA7; Thu, 2 Mar 2023 16:34:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8B54492B01; Thu, 2 Mar 2023 16:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774880; 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=9DuG+tx/kz7k4WTTmF8EACv1boJ/psLleMkJBSaQUMg=; b=Xydkg48VR/pRu3gilGQWwl17oTXEN68NjfKyJT5UrMZXfQ/lt9lGqOsF1dCGmJJnkZ8LTH /nb3yKxVyJh48TdcLqkZxzOaUOqzRngbw1DW6ACmhGxqgmHEA+LEK8Kn/jP9B85gi5ije+ 5wbg1vtQGd1EW9y50pp89oryK6RzWhI= X-MC-Unique: 19vyYtYKMteg_5Qz7-Wwfg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 10/43] migration: Move migrate_use_xbzrle() to options.c Date: Thu, 2 Mar 2023 17:33:37 +0100 Message-Id: <20230302163410.11399-11-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677774936812100003 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.h | 1 - migration/options.h | 1 + migration/migration.c | 11 +---------- migration/options.c | 9 +++++++++ migration/ram.c | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 7b82913c62..13d5c7f149 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -416,7 +416,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.h b/migration/options.h index 413ef29a2a..e4e7879f40 100644 --- a/migration/options.h +++ b/migration/options.h @@ -33,6 +33,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/migration.c b/migration/migration.c index 48cffab413..e1a8972c0b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1120,7 +1120,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->downtime_bytes =3D 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; @@ -2602,15 +2602,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/options.c b/migration/options.c index 2e00609b7b..a5b1b1dfda 100644 --- a/migration/options.c +++ b/migration/options.c @@ -149,6 +149,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/ram.c b/migration/ram.c index 59a624f59a..93c9d016c4 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); } } @@ -1143,7 +1143,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 - @@ -1632,7 +1632,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; } } @@ -2985,7 +2985,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775359; cv=none; d=zohomail.com; s=zohoarc; b=jWWyzaIX92TAV2eHTtTEuFdgYziDZO9qJUUG4GXRwFQ/ixqA2m2FS473Ayoqz6er3SrSCny/OxRx1xwPmuHU+Qq8h0hsLll+I3MGt9jv3EtUbT4Kqo94CWn+/5mj5oApYPjAbJu3GhWtyNu0+z/uf+MgsmWPTXOCopywf1FVJQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775359; 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=WnusWWZFlAFVaz85DDL/k8LJX62Y0AE4FVr9j6bG++Y=; b=ifJuEr/xLbWEBE+e051uK1YN/iWf50Jjw6vJbsbnZM4Nt5BZs9S9gViFh5VLiQIGc45DmE/kfxPCgdHrfbfdlexhZFSzszBAE2QeovuFs2BGO561HGWUs+0Txx08QAXa+HyrQdHePzlyqDwA5UxP09Iz5Bw+ka7gwSLZBfm2nAk= 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 1677775359908207.54026865705828; Thu, 2 Mar 2023 08:42:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltI-0006iK-CY; Thu, 02 Mar 2023 11:34:48 -0500 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 1pXltD-0006P5-Kn for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:43 -0500 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 1pXltB-0007I2-VY for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:43 -0500 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-532-RY-6opL8NXCcoeHnjjxFfg-1; Thu, 02 Mar 2023 11:34:39 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 15DC31881423; Thu, 2 Mar 2023 16:34:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26F54492C3E; Thu, 2 Mar 2023 16:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774881; 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=WnusWWZFlAFVaz85DDL/k8LJX62Y0AE4FVr9j6bG++Y=; b=SGzGauyniK0YQgPQuLYssHudNIKa2Y8WG0XdhtlgiBeYRcQdrA/8XVLLiGO6kwye2vLnrZ g/mJA8UQCoVV9nvzj+4PSD4znLVpV4kd4lhAkPWfrCrqdB9KnRdj4FBD5tjwiW5lFOOuZ0 LfMQh7lQ4ySU7Sv97Ey+rl/1zQSLGMg= X-MC-Unique: RY-6opL8NXCcoeHnjjxFfg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 11/43] migration: Move migrate_use_block() to options.c Date: Thu, 2 Mar 2023 17:33:38 +0100 Message-Id: <20230302163410.11399-12-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775360880100001 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/migration.h | 1 - migration/options.h | 1 + migration/block.c | 2 +- migration/migration.c | 11 +---------- migration/options.c | 9 +++++++++ migration/savevm.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 13d5c7f149..ecd6f7658d 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -418,7 +418,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.h b/migration/options.h index e4e7879f40..541a4a2026 100644 --- a/migration/options.h +++ b/migration/options.h @@ -20,6 +20,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/block.c b/migration/block.c index c4fe9fea56..2cacd5a184 100644 --- a/migration/block.c +++ b/migration/block.c @@ -1002,7 +1002,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 e1a8972c0b..66847e52cc 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2413,7 +2413,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; @@ -2620,15 +2620,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/options.c b/migration/options.c index a5b1b1dfda..66735c1cd9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -35,6 +35,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/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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775327; cv=none; d=zohomail.com; s=zohoarc; b=LAiK305wUJVp2DuSwNF5JRA9Zq/ztLRXkEPz6z+6GW58+c3NLtL47ULVDPrf/vPFsrWzKCHMbn08QzKdxte831pXY2q6hcRgPANYj2aMWJu3qqUe0qswBlNw5GejE7NJJVGF99/J1iUYe8O49Xsb7TYqsgeeP7E5bwksr8wpBcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775327; 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=LM6fOWW5Jv3JQzsSp8Kvb6okLlcueio9Mo4TxpP4LAM=; b=c5AWhiUZa+mM/MzHe0MtOt/Q/PpmJIp8A+wJwj6PUfeTAnoJetsfxyJPADlAFa8hpIu95aF4FxvRnmL9Dt2w5oekPHC5hhYJH6HWNjml/ZRP+Cs4tIDm7vI7dlKwbq5jcQzamvVOVFkVowAz9otQuWElhF7CoPDa8wqJb5lwSqk= 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 1677775327078732.2306408706885; Thu, 2 Mar 2023 08:42:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltK-0006vC-MH; Thu, 02 Mar 2023 11:34:50 -0500 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 1pXltJ-0006kf-1b for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:49 -0500 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 1pXltH-0007Jd-IX for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:48 -0500 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-14-8hZz5S3_OUicekLhqVIdyw-1; Thu, 02 Mar 2023 11:34:41 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D7D329A9CA4; Thu, 2 Mar 2023 16:34:41 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DE42492B00; Thu, 2 Mar 2023 16:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774887; 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=LM6fOWW5Jv3JQzsSp8Kvb6okLlcueio9Mo4TxpP4LAM=; b=gsg+PJ3FtsUIWkoHHpVvxPfcGbiskIjDUjvzyJhtDhnkpJ09HdKlnMruNm4D8OegAsJq85 CQ8UteXBVJQb4rZHWzwF1yOOFR/oQwi4LMJ6vKkcGaNl2toqCcH4rZUU/NaLXZPDK3JI/B +yee/pKNawz8KfZpwBQVLRg4fe5gpCc= X-MC-Unique: 8hZz5S3_OUicekLhqVIdyw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 12/43] migration: Move migrate_use_return() to options.c Date: Thu, 2 Mar 2023 17:33:39 +0100 Message-Id: <20230302163410.11399-13-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775328161100005 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.h | 1 - migration/options.h | 1 + migration/migration.c | 11 +---------- migration/options.c | 9 +++++++++ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index ecd6f7658d..34fbaa15a3 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -420,7 +420,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.h b/migration/options.h index 541a4a2026..51c7f2a043 100644 --- a/migration/options.h +++ b/migration/options.h @@ -33,6 +33,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/migration.c b/migration/migration.c index 66847e52cc..8424eaf2e2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2620,15 +2620,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; @@ -4167,7 +4158,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/options.c b/migration/options.c index 66735c1cd9..c1182bf01a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -149,6 +149,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; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775354; cv=none; d=zohomail.com; s=zohoarc; b=K9BeoW6tFocpof7Gf2JVDICb4ZWXHK05eI2aNawCigxqLGsBZMKkqiYmFVnQHR7QRwPKSMjlGUoKrFMNFHJMXmeLX+HxCJ9pHUrZNzBUPl3dqNlaaDteqqcSU6ehuh94DozJjG5EGy/sXYkSWOCWAeBEQXR8kanWn5Jb1Ok2/No= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775354; 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=N29sYsRVsE2T8XrRKtIwhOxqpJLcijz8qGaO0Oyn9aE=; b=D7YFaCHDU+OUb/OKHch/VashJLqDgEsadZ/OfxLBwXdbFSuxGLXZKOPEP1+iKmLWBlW6IkcSNd/LUD91HGZN8hB/erpIPiuldXBeIBJ4++rRhMgLER3EpV0DwHcZrSBy5KwtsHs5E34dc2l5Es2b2OaLlZjnIXqcLs27xETXwaU= 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 1677775354553189.2490655708815; Thu, 2 Mar 2023 08:42:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltK-0006ve-P7; Thu, 02 Mar 2023 11:34:50 -0500 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 1pXltJ-0006kh-4Z for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:49 -0500 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 1pXltH-0007Jg-Mq for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:48 -0500 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-q77KDZGEPo-d4hO80sOCDA-1; Thu, 02 Mar 2023 11:34:44 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7903B3C14104; Thu, 2 Mar 2023 16:34:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94371492C3E; Thu, 2 Mar 2023 16:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774887; 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=N29sYsRVsE2T8XrRKtIwhOxqpJLcijz8qGaO0Oyn9aE=; b=HohazijhNMFdQMTMIwWiZWVb3ypy0zjA/Qug3KMxDq6h5cgXlhivQ3pb1F58bEdRzcl6tG hp2Kai5NTvzYcyhm198nlou8iW4QNXGJOfBJrjkYSuIQET/p75pJsBX07Sh5yariKR7a+n 0QV0OYffVpdSuKYbq2hQCbZyw3OnTWc= X-MC-Unique: q77KDZGEPo-d4hO80sOCDA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 13/43] migration: Create migrate_rdma_pin_all() function Date: Thu, 2 Mar 2023 17:33:40 +0100 Message-Id: <20230302163410.11399-14-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775354793100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/options.h | 1 + migration/options.c | 7 +++++++ migration/rdma.c | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/options.h b/migration/options.h index 51c7f2a043..eaa2b6d2cb 100644 --- a/migration/options.h +++ b/migration/options.h @@ -32,6 +32,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/options.c b/migration/options.c index c1182bf01a..ddf23ede6f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -140,6 +140,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/rdma.c b/migration/rdma.c index 35f3d6bebe..a13578318c 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 /* @@ -4177,8 +4178,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; @@ -4200,7 +4200,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775354; cv=none; d=zohomail.com; s=zohoarc; b=iLwGcnWe7+fQmRTMtGDNbpA1hxfq2O7Ac/hnFTDR1p366JJIsCJJCNz8grqS8L76DlOPhMFs7rap4djFrvq4IIMFX7DSAoCglCTKsQWxnjr7mAWDAXFE91v48XI9dkbUYtjn8Dvim6bI3UaPefjO9M8KmTBNc7TwFhujRaN1Otk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775354; 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=GPi2HwTpwFxmLV7ZCRjdlgDMSYxUZj5L3Q1NrDvDaFo=; b=fUGNJcLyPv0txTXAg478ZoQnE+0NxF5EWCtS0IMljZ+ibh6Kf2PwYgQbGrYv6wMq8nclJPHpJrsaLhMqAavWlsYkBrqY6LhQxIGHvotaSLojGn6lwG32e5zqoNjvBoWm4/rHHzsx7FvkAlnjDETzqIJXnAPvV5GhdI5YKiK1JyI= 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 167777535447512.995457090263699; Thu, 2 Mar 2023 08:42:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltV-00087v-4D; Thu, 02 Mar 2023 11:35:01 -0500 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 1pXltT-00083C-IV for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:59 -0500 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 1pXltR-0007LJ-3q for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:59 -0500 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-665-7V0hJeMaNx-CyvaS3b2WFg-1; Thu, 02 Mar 2023 11:34:53 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 985F0889047; Thu, 2 Mar 2023 16:34:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE79F492C3E; Thu, 2 Mar 2023 16:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774896; 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=GPi2HwTpwFxmLV7ZCRjdlgDMSYxUZj5L3Q1NrDvDaFo=; b=FoBMwbTTg56W4+gh8qUnHr3wzpYaAlHSCWve0BHSo8haT9kv9ud2S00a7E1TaMFzC2yQok 1mEyCq7GIPakAuqZm4uHkV/o2rKt3gFpNXerIWpRTxewOX1ovs82cE7Ah4Yv75T+ITLmQn IE8MVPuihp/0HtsC3qKKyd2aY9A02Gg= X-MC-Unique: 7V0hJeMaNx-CyvaS3b2WFg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 14/43] migration: Move migrate_caps_check() to options.c Date: Thu, 2 Mar 2023 17:33:41 +0100 Message-Id: <20230302163410.11399-15-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775354839100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 4 + migration/migration.c | 190 ----------------------------------------- migration/options.c | 192 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 190 deletions(-) diff --git a/migration/options.h b/migration/options.h index eaa2b6d2cb..2f928eb563 100644 --- a/migration/options.h +++ b/migration/options.h @@ -40,4 +40,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 diff --git a/migration/migration.c b/migration/migration.c index 8424eaf2e2..dd8df53684 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 */ @@ -1233,163 +1200,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 ddf23ede6f..2cae0b8f08 100644 --- a/migration/options.c +++ b/migration/options.c @@ -14,7 +14,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) @@ -200,3 +203,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; +} --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775044; cv=none; d=zohomail.com; s=zohoarc; b=a2diBnGQ7rDk87S/Omfp+Q/XfqjlpXV0R116PYmBP/Y46+slZt157XarQPzfBXHPU9Fihcz7GNAt8Q/fxYHZWwxNQzqdSui8f1FazQi/q70C4HRkN5O9JFsTbTgNTWZXk02eT3jWgaDBU6YwfnhE8B+KYGECTKPve1NVsJKiAWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775044; 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=gyOZF0bPnWCURMNhh/OOxKx1HC5vnkMb+FdPeHzBliM=; b=LUytws9Bl4KKtbCVXQg3fgsTWFNZYbZMyR+USho9bFTf5r0JLflQBCvJsjn3wL+El4x2ALsafbVX92r9OU7r1GORwjKQqIHbwAoIVZCm0s1De4wOod6EWWE/RwYfIcSnjK1IQ847+ITaAaW8TMyUXKnCuy7f635W0GIFrVw9UqQ= 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 1677775044580857.324440207837; Thu, 2 Mar 2023 08:37:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltU-00086z-P2; Thu, 02 Mar 2023 11:35:00 -0500 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 1pXltS-0007w2-RE for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:58 -0500 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 1pXltR-0007LL-3j for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:34:58 -0500 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-259-XxFiQrRaOFOfx6-v2pnrBQ-1; Thu, 02 Mar 2023 11:34:55 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C47001C3D380; Thu, 2 Mar 2023 16:34:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB03B492C3E; Thu, 2 Mar 2023 16:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774896; 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=gyOZF0bPnWCURMNhh/OOxKx1HC5vnkMb+FdPeHzBliM=; b=GPoR30JBB25Cmd1sCgBTuo8geVRfkvoYM75GRrx4Z7qg45ryu2e8rH23wcoJ6U/oWRAi36 4LHy162W+vq18mgWdk3bhTyncct4R52Nh5ig+6j+6UkV9Q8qcn/JF5zMJcMeLlj3j+Sdcn 6oY1sTALa2r5yUTv798OaP3eTgtA3vg= X-MC-Unique: XxFiQrRaOFOfx6-v2pnrBQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 15/43] migration: Move qmp_query_migrate_capabilities() to options.c Date: Thu, 2 Mar 2023 17:33:42 +0100 Message-Id: <20230302163410.11399-16-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775045875100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 dd8df53684..5c70bb3153 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 2cae0b8f08..ac9098fbfb 100644 --- a/migration/options.c +++ b/migration/options.c @@ -15,6 +15,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" @@ -392,3 +393,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775088; cv=none; d=zohomail.com; s=zohoarc; b=Y+5/vZeBjzZpkY5RQxESIBRO/QZmgt7ZM+w4hHy7n67J52gH1NVOpYyrG0v1mDib+HeYxI2Vus3i2wimt2ku4am8TGB+Ob1XPmJPFjgAvLD8GteXuykEzVN331JHJMr+FlDAcr9pvKjkBKGFrKBs72K4TEmKO8IqKvMScAjCQIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775088; 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=ndppjIbVvz8jma2GmFuQAa1NSKUMWKwvLonh6OzMiLk=; b=P7cMk1YolKi+zgZQzxXaCpwVDQAZsO3hi9RYocGTNNdovMCodO1bfcg8EI2zdO03YoyWH4Xh+jheZw1A6TwNxra98CpF0NFNV64MQufx1VJ/6d7OeJTcAno8yXyoKXEdth1pE8fYJJRCVraPkLToW7L9bKl/QzQqGYaug8SA2VY= 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 1677775088291741.2897956413392; Thu, 2 Mar 2023 08:38:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltY-0008HM-PA; Thu, 02 Mar 2023 11:35:04 -0500 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 1pXltX-0008Eu-60 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:03 -0500 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 1pXltV-0007SA-Ji for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:02 -0500 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-294-PJfEdOWKO8mKC_m-y8coVA-1; Thu, 02 Mar 2023 11:34:57 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 217EC3C14100; Thu, 2 Mar 2023 16:34:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13898492B01; Thu, 2 Mar 2023 16:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774901; 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=ndppjIbVvz8jma2GmFuQAa1NSKUMWKwvLonh6OzMiLk=; b=AjbMFV538/9vvx69UyAgUbkXmgdjvGkUuvdCQ/dl6Qw2Ah+DxhdzdhPnrR9eQbRO/GIdhT DHIwmwaGcgw1Xymy88OeWCfxHoSJA/fJfCknwrBg+JvnAHFMouZgr74LcGwbtioYs0XDTc u3tBUGDY8bIeIeygnwaF2gy7OvkY3qM= X-MC-Unique: PJfEdOWKO8mKC_m-y8coVA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 16/43] migration: Move qmp_migrate_set_capabilities() to options.c Date: Thu, 2 Mar 2023 17:33:43 +0100 Message-Id: <20230302163410.11399-17-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775090072100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- 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 5c70bb3153..1dd2ccf9ee 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1220,32 +1220,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 ac9098fbfb..1436bf42c2 100644 --- a/migration/options.c +++ b/migration/options.c @@ -415,3 +415,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775032; cv=none; d=zohomail.com; s=zohoarc; b=CfKmi3MyWw3johWcSagl1GwD8jOfdbwDj7haURHdm4U20/WwucHAs5woHFvbEnwGbqxY+CSSYq7+VN7a+PE6TYuQ/07oyqHsnGsGw6aZ0dcTPlfwSlAW1aQHHq7oKLD0vPMjdCqJQNOnqpqqgO7y9I6YyDmApInOM2/Czkqxleo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775032; 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=y/xriMu3wRawDUgddzVeSEg4tSTuNO7UymYYzQD1wLc=; b=Q+VoYaqHKqhv2ayQvE6H8Mq9+Mc7ubM/PMukR+hnx3sWQDQFKm+C/YSjexNkm9ZYnUM4Dh1M56A+TRbI9wgS3jM9UMOTpT26RfDvy9zG2/qZVg48JpkmOuh1wWXHQNX/ZtbKxwWWC0VDI7VYEwKr+sxlOjH3Y0tNb8cJqau5sh0= 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 1677775032847615.3909006536256; Thu, 2 Mar 2023 08:37:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlta-0008LF-Nx; Thu, 02 Mar 2023 11:35:06 -0500 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 1pXltY-0008Hq-Sk for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:04 -0500 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 1pXltX-0007V4-7O for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:04 -0500 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-39-m29IixrDO9-OUrtfFnYG5g-1; Thu, 02 Mar 2023 11:35:00 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5EBD33804515; Thu, 2 Mar 2023 16:34:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63FCF492C3E; Thu, 2 Mar 2023 16:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774902; 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=y/xriMu3wRawDUgddzVeSEg4tSTuNO7UymYYzQD1wLc=; b=eDo+eKnnV0AXX0xuYTOKUeovz8orAuxKqncbIRr7z4psijXt7A/MX5nO+U2+jCaaO8DD/t S62s1bOIOejG8wiLmvakYgVYO84EVz/0MXQGOhXs2olSeOgaVeUXcotSkop/itle3+dtyL d6qJti1eYGbfu344SwHEIKBXi090gOQ= X-MC-Unique: m29IixrDO9-OUrtfFnYG5g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 17/43] migration: Move migrate_cap_set() to options.c Date: Thu, 2 Mar 2023 17:33:44 +0100 Message-Id: <20230302163410.11399-18-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775033694100010 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/migration.c | 20 -------------------- migration/options.c | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/migration/options.h b/migration/options.h index 2f928eb563..c4ca321b98 100644 --- a/migration/options.h +++ b/migration/options.h @@ -43,5 +43,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 diff --git a/migration/migration.c b/migration/migration.c index 1dd2ccf9ee..219ca3d37a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1664,26 +1664,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 1436bf42c2..cd0ffb8a20 100644 --- a/migration/options.c +++ b/migration/options.c @@ -16,6 +16,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" @@ -394,6 +395,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; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775075; cv=none; d=zohomail.com; s=zohoarc; b=MRBCZoDGTgxxhWjP/NZJielSxF2FGua/+1WBiol7UrqA4owKbxfp7oXYYH1GcT4GDa3RvpXyc0YQ4YOHhw3Rb88i+iL85ppZGtiuF95cPp0HJOUC2iPXRBjJjm8Mnpr96IFWki4ieqrGf6Bh9gXUawQyfHcnP0jNstBhxaySvuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775075; 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=cfmBlzjZVZw1XdBLtMKc7cikeGp6GAJCTBwc8Cve+Qg=; b=ebUKIw1pd73x571r7CAVFo8fT8+P/YmFFSe/DMWwUD7xyq5MIRDKCwbYVLQSTiuMuu5ep5mchRAlNswV8G9opYTcNrz7DP89BglfkTQ53X4L/vV6jBrXIAqCf4P6VE0pSFN0J3qIzqi0fYu3wylTGevWxHChD9l0LIs+HP+e0KU= 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 1677775075271668.726418572542; Thu, 2 Mar 2023 08:37:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltm-0000D7-T6; Thu, 02 Mar 2023 11:35:19 -0500 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 1pXltj-0008QA-5u for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:15 -0500 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 1pXltg-00080l-Km for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:14 -0500 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-ck18AsNQMXKZo1oyg6A5sQ-1; Thu, 02 Mar 2023 11:35:08 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECBC9857A84; Thu, 2 Mar 2023 16:35:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4EA0492C3E; Thu, 2 Mar 2023 16:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774911; 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=cfmBlzjZVZw1XdBLtMKc7cikeGp6GAJCTBwc8Cve+Qg=; b=VzjwDk056CMntB4lsCJhOZJ7pwhX+wzO6Ji3VUybKbiALnWKwLQTr4nBDMrIH2vwyl3XZe RnUxB85/cd+CLEbxy7O9Gm9BAfMwDPULSgYgwmvINgOYf5P3gxIl302cic7eUpDRM8/nw5 59vU9irjy6muODlrL83yRvXqYRLpItc= X-MC-Unique: ck18AsNQMXKZo1oyg6A5sQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 18/43] migration: Move parameters functions to option.c Date: Thu, 2 Mar 2023 17:33:45 +0100 Message-Id: <20230302163410.11399-19-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775076080100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.h | 11 ----- migration/options.h | 13 ++++++ migration/migration.c | 91 --------------------------------------- migration/multifd-zlib.c | 1 + migration/multifd-zstd.c | 1 + migration/options.c | 93 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 108 insertions(+), 102 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 34fbaa15a3..5509924c57 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -410,24 +410,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/options.h b/migration/options.h index c4ca321b98..1c1f1a6d47 100644 --- a/migration/options.h +++ b/migration/options.h @@ -45,4 +45,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 diff --git a/migration/migration.c b/migration/migration.c index 219ca3d37a..a04b323fc7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2262,79 +2262,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; @@ -2344,24 +2271,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/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 cd0ffb8a20..cd5a131c69 100644 --- a/migration/options.c +++ b/migration/options.c @@ -462,3 +462,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; +} --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775032; cv=none; d=zohomail.com; s=zohoarc; b=blShi1FZ/7j/bIhAu05cq/EMdhZvc/Dxw/XdYS0/13Q5TcZU/HpVLjwcgQfJohwI/4J7X8oZiV8FeVFhGbOjvWrnL85xQjnXqSHqXPpRC0a3NA9Kbg0mDHYfpwN02LvPcK8yd/VL8HILJNCfugwbjcVd6/YGRXOIRNjIngxLorQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775032; 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=Ik2rq8cyLpUVwJss9iojXErd20/OXl4ufeJ2WnBu8uE=; b=euyLbYIk/L0mDYTDgndidUvq44KmUjJ0QqmkID90iQpxIz/U14gJkt18N4VpWxmWP9uuAjRbamFtnVScWxeYCBqO5NjNF5gWhg/kixYbYAVhg2GDdvoaLIPUUhrU04xuMVDjaXoAthGyNdgU9+IxPikhVTuOHpZs7cv3f8nm8KQ= 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 1677775032597765.6663871895797; Thu, 2 Mar 2023 08:37:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltp-0000JW-6F; Thu, 02 Mar 2023 11:35:21 -0500 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 1pXltk-0008TV-ES for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:17 -0500 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 1pXlti-00081C-Ue for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:16 -0500 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-518-xUqAyILQNcuef9Q6DXRuRg-1; Thu, 02 Mar 2023 11:35:10 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 318F8811726; Thu, 2 Mar 2023 16:35:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D286492C3E; Thu, 2 Mar 2023 16:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774913; 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=Ik2rq8cyLpUVwJss9iojXErd20/OXl4ufeJ2WnBu8uE=; b=eAPfTpcl0OmUEwRdRuH/Q9Bnsr2wv8oCpd+7dujcySxHlQZN4mjh0Bwe6i0F4w4hWOoRDL t/jinAI66VU6Mcx4+lG8no2uAEYCgnSUwIu2xAKHk+r836h/xU/w3PpERiqKaYCdOW5geD YyBfjeq7Icmi165Jq/p1OJLwrHukbvg= X-MC-Unique: xUqAyILQNcuef9Q6DXRuRg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 19/43] migration: Use migrate_max_postcopy_bandwidth() Date: Thu, 2 Mar 2023 17:33:46 +0100 Message-Id: <20230302163410.11399-20-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775033653100008 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index a04b323fc7..713eba06ac 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3791,7 +3791,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775143; cv=none; d=zohomail.com; s=zohoarc; b=dcgqmopyoLR5KqJYENxTiE7ezEh/3nuaKk/FtSEEO3euQbLYqiXBpq1Fqb8QGfo2yb5D4ykNCpXcudRFDZiqo/iLafBzBmvHk2d1vzKztezDuu5d4qNekx/fMy6Xzym4WLRPc49DfsjrNQtb35coYdqZ2A5CtU3T0h9jLJQki+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775143; 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=GwpzEuB6c08fTi0dZzjYe8/PMgocUsLa/fJGKYbgnYU=; b=gBguEOcnbvjW1pu5RNVuaOOeR73yVyzpU4yTOtgS0NHpiE2IKr9nVkhFFCGdO4rWUhe5JMctZG0WcjOrXFKn1fLAjhRyWvBacS9JZRUTDxB4fRen1FRZnO1NenKyJtvfqG3lnGwrXc/0ba+qUbuBfUfOm7vBN8I77kyRkWWGbY4= 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 1677775143102636.1859604312409; Thu, 2 Mar 2023 08:39:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlui-0001Gy-Si; Thu, 02 Mar 2023 11:36:17 -0500 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 1pXlto-0000GM-6z for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:20 -0500 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 1pXltm-00082D-3z for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:19 -0500 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-511-7okEX_hnMgin5L7BKvwrEw-1; Thu, 02 Mar 2023 11:35:13 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 737D03C14103; Thu, 2 Mar 2023 16:35:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78450492C3E; Thu, 2 Mar 2023 16:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774917; 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=GwpzEuB6c08fTi0dZzjYe8/PMgocUsLa/fJGKYbgnYU=; b=inNaL4ijzLDTW5D0WLrzkY45zJce4WvSGC5sxlRbDzFdVB2Ugs86MDBoFruRYmJoK0Vldl VPCHozI7MLiQX7e8UaRBO0mN5FtgCs352+HlIkz9tXxcMSLgXf0A446yCCPDhy1ICqsUGV CeOSqoPdhVDgBukH+6Sj5yJITNsuu/Q= X-MC-Unique: 7okEX_hnMgin5L7BKvwrEw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 20/43] migration: Move migrate_use_block_incremental() to option.c Date: Thu, 2 Mar 2023 17:33:47 +0100 Message-Id: <20230302163410.11399-21-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775144536100011 Content-Type: text/plain; charset="utf-8" To be consistent with every other parameter, rename to migrate_block_increm= ental(). Signed-off-by: Juan Quintela --- migration/migration.h | 1 - migration/options.h | 1 + migration/block.c | 2 +- migration/migration.c | 11 +---------- migration/options.c | 9 +++++++++ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 5509924c57..bf24a0d471 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -412,7 +412,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.h b/migration/options.h index 1c1f1a6d47..ea45c87cfe 100644 --- a/migration/options.h +++ b/migration/options.h @@ -47,6 +47,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); diff --git a/migration/block.c b/migration/block.c index 2cacd5a184..11541a28ff 100644 --- a/migration/block.c +++ b/migration/block.c @@ -418,7 +418,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 713eba06ac..62478ac8c1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2155,7 +2155,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; @@ -2271,15 +2271,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/options.c b/migration/options.c index cd5a131c69..b2f15eda6c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -465,6 +465,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; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775072; cv=none; d=zohomail.com; s=zohoarc; b=Ro9GheXEvFl2/viIChG3vdLsMu4gR1zOdWtaDowipHaGY34GHs7h6SzBwKJg2WhWTrpaW/IkgSHcNCzEGE+s8ioDFQfR7hThHxohqynbpsfIJMKo34A9TRzt/JLQ2BgDmm1dDSXam6Kzg6lYtGSJ4yU+HYEcTv2BsoTwhgnd7gM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775072; 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=n58oOHqvhbanlic4JG+WVIIG11yqcC7BcHYEYeeQkdM=; b=dKgHPaz/ywyf8IfU3wCWMD/JzOI/HzIumqK+g6AawXk7C+th5mFZuQqsQsPotRI+5eKQLMcavGiCZHx19Idb3IOjTjLFnGw4CU1niq1YJEZqAkwUqdjKUNhzUtEPFEWwVc3RTVRb3RIvbJyVGgNCbkh7w+lAXfi/13iBZ/GlCT0= 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 16777750721801010.1127698081409; Thu, 2 Mar 2023 08:37:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXltq-0000RO-BO; Thu, 02 Mar 2023 11:35:24 -0500 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 1pXltn-0000G2-Ha for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:20 -0500 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 1pXltm-000828-09 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:19 -0500 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-459-NxvD68uyNyObd5VY8Z6psA-1; Thu, 02 Mar 2023 11:35:15 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7924800050; Thu, 2 Mar 2023 16:35:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8ECC492C3E; Thu, 2 Mar 2023 16:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774917; 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=n58oOHqvhbanlic4JG+WVIIG11yqcC7BcHYEYeeQkdM=; b=I7JRi7HkcA6LeacbTlzZJ0f16oMfDv9XxsHosvJb5lcI/8DXQcTX8Wm1E43AgsYmGDqlzz KJHd1clFmdi33tXtZnG8YTo5fRiD6jRT1DRCzi6n+8nIt5QRUf+GiT75A7O2R5RNfaECXN w+M0tCxDr/RPx45PuSmTg9+xiCbFHro= X-MC-Unique: NxvD68uyNyObd5VY8Z6psA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 21/43] migration: Create migrate_throttle_trigger_threshold() Date: Thu, 2 Mar 2023 17:33:48 +0100 Message-Id: <20230302163410.11399-22-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775074066100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 9 +++++++++ migration/ram.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.h b/migration/options.h index ea45c87cfe..c9955e87f8 100644 --- a/migration/options.h +++ b/migration/options.h @@ -57,6 +57,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/options.c b/migration/options.c index b2f15eda6c..50d982673c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -556,6 +556,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/ram.c b/migration/ram.c index 93c9d016c4..fc456074ee 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1184,8 +1184,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775032; cv=none; d=zohomail.com; s=zohoarc; b=nrrWXgf2nkMOGMGyLgZBDH3c+GqHKrdhKKTnnslkjCecAGK5Kz5X2RcMJNPh2OO8xGCqoe8mC6xcxqm/RhAdF16aHwaiOidZQ+F6goJh3wAUe32Og9tAD62vi1vqOk7YKQfWUb3gcl+nEP03mDRGuTsdHPZjN3DyKm0KO3F7PKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775032; 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=MNO5JPVXQVsOJKTImGsW6K0gJUshCvfuJpxAhcKoniU=; b=hcL4bnr6Iy5mOJJQj2E6w9sQ5L+pwjVaB4Et0wdRv+IL70036icEFO2qSOSfo9IVKc6b/fjdGQWDNp9DCGsnlmWuyq8EDknW+nNanky71MQ1ep8eFIOMU116Yoc6Z85NuqBIBfDk4JXDWxsdfgJ7WQrUMzDGvGK+yRuW+ir/UcY= 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 1677775032578179.1516845405389; Thu, 2 Mar 2023 08:37:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlup-0001ly-I1; Thu, 02 Mar 2023 11:36:23 -0500 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 1pXlu6-0000jQ-Dw for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:49 -0500 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 1pXltz-00089f-3i for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:34 -0500 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-85-UKy7z9oMOXag1pdR5l11Gg-1; Thu, 02 Mar 2023 11:35:17 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0CA51C3D380; Thu, 2 Mar 2023 16:35:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED409492C3E; Thu, 2 Mar 2023 16:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774928; 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=MNO5JPVXQVsOJKTImGsW6K0gJUshCvfuJpxAhcKoniU=; b=MJcgseQO8+MJB5WJMBtFoUfOw1xlhuUsYoGFMa0AP/Prdw8dV+DEZGh9gNhaEUe+5CiK8E h5VNeAZhrv/D/WNFq/dmr6XGlMJ9NR7HAEBOeFysOfTEYHemBd+CMNCyqzTmA137ZgYTpJ tQH4ahbzmHFoS/hAIRdl4cfJmzvRbDE= X-MC-Unique: UKy7z9oMOXag1pdR5l11Gg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 22/43] migration: Create migrate_checkpoint_delay() Date: Thu, 2 Mar 2023 17:33:49 +0100 Message-Id: <20230302163410.11399-23-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775033634100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/colo.c | 5 ++--- migration/options.c | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/migration/options.h b/migration/options.h index c9955e87f8..ccdeebfee7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -48,6 +48,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); 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 50d982673c..0dbc4bdea8 100644 --- a/migration/options.c +++ b/migration/options.c @@ -474,6 +474,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; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775140; cv=none; d=zohomail.com; s=zohoarc; b=MG24kqZZ931hn8tEm5cbm71EHQ+etSr6cG+4JFMJHabV9GhtikMHpCzC8uqd9B2AOLV83AjHYkhs/k6Zd7eyuTDYWta6Crk4HRNDRt4A2CWjOc3wVhHZ2DDKG9TFmc849HhxVnALvSSgIbkaSFox0LRTr42QzPJBJmWSompgm8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775140; 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=5gmqO07UE2HYZtRxbtwedSz7QCPj0b1AsY/WPaBdgvQ=; b=KQtxwNILBcB0yt0z1DFRHt7SHQp9fp8u/vDKFfs5imYB3+XYWeNqtLiTlYe/z1kgx4aCf5FDJ7YqrGzXyAZngBOAR/ZlryXBl+l9WSvRFPd2mYvj53ibU5sDzS3s2DydHjiVB/vgG6IcnFtUnGmYqLlx7IxDNzTXX1dJ57U4axI= 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 1677775140072175.77722793350472; Thu, 2 Mar 2023 08:39:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXluj-0001ZX-Pc; Thu, 02 Mar 2023 11:36:18 -0500 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 1pXltv-0000bx-4F for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:29 -0500 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 1pXltr-000854-Kd for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:25 -0500 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-79-ajKmaQH2MIqP_ibwiKHsyA-1; Thu, 02 Mar 2023 11:35:19 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22E378027FD; Thu, 2 Mar 2023 16:35:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 317EB492C3E; Thu, 2 Mar 2023 16:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774922; 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=5gmqO07UE2HYZtRxbtwedSz7QCPj0b1AsY/WPaBdgvQ=; b=P6a6zaBBctWTVd95EQLBR47yazWNRtauBfP3xUwA7mNbmtcI/TnYs5/r0J9DQbcQ7dB5Gb Jak3wIyP8UvbmtVycImbBvA7jNPHLSoWcqGCfKgWzqnCRoJ42Dxva0CQyz9YmlQ/fOIDu4 F1eE2tulcD96rSglkUdNt59qB+WI1gE= X-MC-Unique: ajKmaQH2MIqP_ibwiKHsyA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 23/43] migration: Create migrate_max_cpu_throttle() Date: Thu, 2 Mar 2023 17:33:50 +0100 Message-Id: <20230302163410.11399-24-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775140536100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.h | 2 -- migration/options.h | 1 + migration/options.c | 9 +++++++++ migration/ram.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index bf24a0d471..8ee70cec76 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -412,8 +412,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.h b/migration/options.h index ccdeebfee7..0e026bc150 100644 --- a/migration/options.h +++ b/migration/options.h @@ -53,6 +53,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/options.c b/migration/options.c index 0dbc4bdea8..472982f91e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -519,6 +519,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/ram.c b/migration/ram.c index fc456074ee..daa880fb80 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -721,7 +721,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775304; cv=none; d=zohomail.com; s=zohoarc; b=XKumLyFBrEBtq49d6IlhjQMsSc6msn9c0z8pemAfeONM0w3WDb+Ix9kwt3LMQiyoAeXFXPPOhFgOiXz7ThlXEzjnUzi2n+M9k96pYp4lgyTqCVGhtTjs9ZqobVy2LT48O6B5HXUKckv3PeTQF3PFxq2/qrxja/HHIZdBLRA5Wdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775304; 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=WMzGNaSobuOBHSnKt+YhSzVSMN5z96etunxXMWAhEts=; b=HuvwvBF7TY3vAeFeqvwfJA+uRD1VdV0mgYLO9zWF3EKEDpZwgLKFp7S92juwSGg+f9sScOEwD+/I8thTC9dkoOjf0qYFHZBxUISGFPwlHgzcoIELU4TFZ1cthjriIYQNARLuSkeBvgY2zeSJ6r6pUGSJfjSGr2apscOnBR7A+SQ= 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 1677775304399884.430860220248; Thu, 2 Mar 2023 08:41:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXluQ-0000xH-Az; Thu, 02 Mar 2023 11:35:58 -0500 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 1pXltv-0000bw-49 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:29 -0500 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 1pXltr-00085B-Rv for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:26 -0500 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-435-BimmcHtjP4yYwQl9CS-ykA-1; Thu, 02 Mar 2023 11:35:22 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 723C829A9CA9; Thu, 2 Mar 2023 16:35:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69FC5492C3E; Thu, 2 Mar 2023 16:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774923; 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=WMzGNaSobuOBHSnKt+YhSzVSMN5z96etunxXMWAhEts=; b=GB+aOu8vfdQTDaIPeRruWf5JrdYaVpQ5qwe0xLGe85W/TIKz+5AJoSMNW88jfSA9ppCWIL NjwHEWZTsyKloYVil+XUeiewQoCMzO9pFe2NBUwc7lRfqbhu77OaGt+C3MFlWB11mSGsNr hVXCqfKNWjNBUATb1Dq4Jk14ut2M3ps= X-MC-Unique: BimmcHtjP4yYwQl9CS-ykA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 24/43] migration: Move migrate_announce_params() to option.c Date: Thu, 2 Mar 2023 17:33:51 +0100 Message-Id: <20230302163410.11399-25-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775305994100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 14 -------------- migration/options.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 62478ac8c1..176ddb51f1 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 472982f91e..afb7794cec 100644 --- a/migration/options.c +++ b/migration/options.c @@ -18,6 +18,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" @@ -591,3 +592,21 @@ 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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775048; cv=none; d=zohomail.com; s=zohoarc; b=BIdNSjYuX7RBovBMr8pU6NrsSomGJXmz8Zx7VLBPVUvPt434PZXiZIsFPqnNO8ptOLdP6uFMOM83QlLBlsJ4s4AG3TJHNd1QkWBuaRW1VLCQx8TRlqrRoHAWBBrtFavR8qKnmF/V5ygCQFICemW3MOyiSWFUcMAwdZoQmGn0plc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775048; 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=dmVLfOecxTCsPIZ66JEUKhyFg0AJzphdGVbm0tuB8Cc=; b=dMRsHx7pnv0b2x9AnXHaq/3Z9XjCoMWctEfLtB8KuPH8O7A6zNxX3kPnkJutlJ1P/Xr+zxrxrWHyWHCKxh9rCE2Wy/JKfSS9kuQAjB8yYNtxbx2GbVZ+vLdk8xs/RLgXM1VROiUelGbPexoXsZMPlHbJQ75zNKhvPRoDFezGVHA= 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 1677775048557384.4689407981896; Thu, 2 Mar 2023 08:37:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlup-0001md-Ii; Thu, 02 Mar 2023 11:36:23 -0500 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 1pXltz-0000ey-Uy for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:35 -0500 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 1pXltu-00087S-SG for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:29 -0500 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-66-yfZGuzvjOnSMrwPuDAzLkg-1; Thu, 02 Mar 2023 11:35:24 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF6773C1410B; Thu, 2 Mar 2023 16:35:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9B5D492C3E; Thu, 2 Mar 2023 16:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774925; 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=dmVLfOecxTCsPIZ66JEUKhyFg0AJzphdGVbm0tuB8Cc=; b=iyQBP6GSdA9ltzQp781hGNPzC5sMr9Gspuy2g+25OAUcpFXQEY9DBONdJf/YG2s2Bqz09n QyV3nLyLOeMzUhNPSAxQJbMaD4iffn942/FT6nMqJ+Ayo9PrO/zLIyanJVlmrJEZkj3Lyj EX+YfOQ6SKOHU1L6BDqo60E8mb8W9jE= X-MC-Unique: yfZGuzvjOnSMrwPuDAzLkg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 25/43] migration: Create migrate_cpu_throttle_initial() to option.c Date: Thu, 2 Mar 2023 17:33:52 +0100 Message-Id: <20230302163410.11399-26-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775049996100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 9 +++++++++ migration/ram.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.h b/migration/options.h index 0e026bc150..fc34ad49c7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -52,6 +52,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/options.c b/migration/options.c index afb7794cec..f7dd7280b9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -511,6 +511,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/ram.c b/migration/ram.c index daa880fb80..416688f508 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -718,7 +718,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775104; cv=none; d=zohomail.com; s=zohoarc; b=aNlF3vUJp6Z9gFjBxE5uiNmW4nMfYllustu6YY/+DK0fcCJXpHxgXrr+ZzMNEKObnIJq9/ackQyBNNS3LJrDJEtf1uT+GI0hOx39fsLj83FTQ10v+g5fedV4NXLQ5zACRxtIeX+XL8ZIE59VZH6+XA9R5NJm0BxOiXqVlMybUiU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775104; 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=i6mou6nBoMLJ2nHWCwtgrwNZUpK1r3rKau02RSC8mBc=; b=Z4Mg6S/gS3AQn/R2JwfY6QwIMQ5cPo+EV7RTVvsLfCRZ39Gr+maeILRYpvMJL20Xbf9Jy1e6KOZUYjq8m1DgZgMLW2jFvv9Ia/HzcdKJ7tLU5EXCxlk161e7vHRejagO4mRceU7mDIYRyYgQHkTiLk+gUQQyRmi0QRyWv43GMuU= 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 1677775104950640.9192788615046; Thu, 2 Mar 2023 08:38:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlv6-0002fO-63; Thu, 02 Mar 2023 11:36:40 -0500 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 1pXlu6-0000jR-E0 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:49 -0500 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 1pXltz-00089p-3x for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:34 -0500 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-288-G4l2qjuENJGY8AkPcVXRMw-1; Thu, 02 Mar 2023 11:35:26 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8A2F3C14850; Thu, 2 Mar 2023 16:35:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0127E492B00; Thu, 2 Mar 2023 16:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774929; 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=i6mou6nBoMLJ2nHWCwtgrwNZUpK1r3rKau02RSC8mBc=; b=PnS+EGUn2MokNyyCxSy/9rdCNFxWVzAEnbK3OGkOHOt3iahXmi833v/RzGpNbBWDnJwftg RmrKvN15h5BCnzvaVk9KYR2aeHDV3oWU83f6Fn09MOJdimcsBX5AER52Qm96qpnQJyjpEK TtFvFMcxZfOp665kUxYR+aILTyocop8= X-MC-Unique: G4l2qjuENJGY8AkPcVXRMw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 26/43] migration: Create migrate_cpu_throttle_increment() function Date: Thu, 2 Mar 2023 17:33:53 +0100 Message-Id: <20230302163410.11399-27-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775106188100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 9 +++++++++ migration/ram.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.h b/migration/options.h index fc34ad49c7..253c7f73e6 100644 --- a/migration/options.h +++ b/migration/options.h @@ -52,6 +52,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/options.c b/migration/options.c index f7dd7280b9..c9ef08483c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -511,6 +511,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/ram.c b/migration/ram.c index 416688f508..7c764bbb3d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -719,7 +719,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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775280; cv=none; d=zohomail.com; s=zohoarc; b=mdRukhnMGrk1319kxjS5Nf+xZuTZAfJ+UnhwepIoIkPlFHS1E9m5tHZaQH00OYDkGKDXBTX0xItqc97yw1kC3co5IuZyf0qmubw3XL4Z5IEEW/CEUjVEC46pOR+2HJ6H0hrMP9dJgUQSyZRfwpC9khR6NUlXs2ZSH+IzlrQzu5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775280; 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=BQyPBApgA6lYcgAwKwlL6iMib1F31JELafOqc3kczH8=; b=EwGTzrUSCJsCtjXYXPzCWAsRYSphyR0Nj80sj6F+wDe8UJWGMhEoCwNiNaa4YBN4HmexH0KnPXD3umflfudTAIVncFazH9xHpoiRXrMajhuOZy9XfaT/y20xqe4bEa8KQ+lZF+wq+qJAqL125emfmUihI8EJHs+dToLA6In7Ty4= 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 1677775280209261.3442386071714; Thu, 2 Mar 2023 08:41:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXluu-0002C7-SC; Thu, 02 Mar 2023 11:36:28 -0500 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 1pXlu6-0000jP-DB for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:49 -0500 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 1pXlu1-0008AH-01 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:34 -0500 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-465-KFUptgb7OPWZlohgFEWfvg-1; Thu, 02 Mar 2023 11:35:28 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2871481172B; Thu, 2 Mar 2023 16:35:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38C82492C3E; Thu, 2 Mar 2023 16:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774931; 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=BQyPBApgA6lYcgAwKwlL6iMib1F31JELafOqc3kczH8=; b=b/yvQzNWDYMUITnSPViTwQIzSlj1HTp5JNErt5fUsbcS3fPGR5QNP/RFIsuuQ2XcR5SKjf 9nGeftPeNod6V54bHWZIMkkIhwPw235WxYoZAN2CzfVtRazJwO6U+QCPIRsYHLGh1zvdZU yyNkzRbMVZfHpNcXcn4vgy+7thWxbM0= X-MC-Unique: KFUptgb7OPWZlohgFEWfvg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 27/43] migration: Create migrate_cpu_throttle_tailslow() function Date: Thu, 2 Mar 2023 17:33:54 +0100 Message-Id: <20230302163410.11399-28-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775281686100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 9 +++++++++ migration/ram.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.h b/migration/options.h index 253c7f73e6..432d9ccc2e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -54,6 +54,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/options.c b/migration/options.c index c9ef08483c..5e08680ba2 100644 --- a/migration/options.c +++ b/migration/options.c @@ -529,6 +529,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/ram.c b/migration/ram.c index 7c764bbb3d..18fafb414a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -717,10 +717,9 @@ static size_t save_page_header(PageSearchStatus *pss, = RAMBlock *block, 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 Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775083; cv=none; d=zohomail.com; s=zohoarc; b=iYwoID4X2SkykP/k/BWRXAKvVh5SNq8aEFWYesRe9cjNB4Uc4oJmGNFIn1tam7dPs2zQAgpsAZdPxkHy6lVDpx2M+HGnKmjjq59uAYgY778nk/OLcLXtCz2e1abmGwpabO12kxtPU7YohX0IYb0tTqxUGabXA6dZRyaLi1XFiKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775083; 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=d7tLTFnXxMuaHW5q2uBt1SwiuUATe52eHfZ//+/Qwl8=; b=NoNBPlbAVYba6PCN1zeiCfy6Sq9MXPyNcVR/iQbytIul1NSOIZqqmhxc3VvigFOXX2iLbl3VRG6Rr2uSMYAwEYaEh7zeSK2FAw/Q1AmYRoW837Y3hxt9VyVRIsB8yX53hMkWl2ZQFg4oKcLaK0Mnp2Y8P8NHIs3M/9pccUHaSU8= 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 1677775083125407.0108707969031; Thu, 2 Mar 2023 08:38:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlv6-0002gk-Nk; Thu, 02 Mar 2023 11:36:40 -0500 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 1pXlu8-0000mY-V3 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:49 -0500 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 1pXlu4-0008B2-I5 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:39 -0500 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-625-r_ui3XmgOQuG2CEJphstzQ-1; Thu, 02 Mar 2023 11:35:31 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 655968027FD; Thu, 2 Mar 2023 16:35:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C760492C3E; Thu, 2 Mar 2023 16:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774935; 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=d7tLTFnXxMuaHW5q2uBt1SwiuUATe52eHfZ//+/Qwl8=; b=IHs2ofM0pcq7uqrMlSmxUjmfw0yRrY4JSrOhgtgMJv6ccZJOdpAigaRp0/vD6HCSDLkmR7 7405sTKDHxnC2ZrlyDRHODMeo+47IdyxA0SKfa4zs8FTmI17Ex1P8ctmbIKR8nXeRFpg+R zvUwOX7euvHCpeR18geOyafczxHfe+g= X-MC-Unique: r_ui3XmgOQuG2CEJphstzQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 28/43] migration: Move migrate_use_tls() to options.c Date: Thu, 2 Mar 2023 17:33:55 +0100 Message-Id: <20230302163410.11399-29-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775084074100003 Content-Type: text/plain; charset="utf-8" Once there, rename it to migrate_tls() and make it return bool for consistency. Signed-off-by: Juan Quintela --- migration/migration.h | 2 -- migration/options.h | 9 +++++++++ migration/migration.c | 9 --------- migration/options.c | 16 +++++++++++++++- migration/tls.c | 3 ++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 8ee70cec76..57efcb7c9f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -410,8 +410,6 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -int migrate_use_tls(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.h b/migration/options.h index 432d9ccc2e..4fbe4cb411 100644 --- a/migration/options.h +++ b/migration/options.h @@ -40,6 +40,15 @@ bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 +/* + * pseudo capabilities + * + * This are functions that are used in a similar way that capabilities + * check, but they are not a capability. + */ + +bool migrate_tls(void); + /* capabilities helpers */ =20 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index 176ddb51f1..7c4b49deda 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2248,15 +2248,6 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -int migrate_use_tls(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.tls_creds && *s->parameters.tls_creds; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/options.c b/migration/options.c index 5e08680ba2..0ea3500b24 100644 --- a/migration/options.c +++ b/migration/options.c @@ -206,6 +206,20 @@ bool migrate_zero_copy_send(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } + +/* pseudo capabilities */ + +bool migrate_tls(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.tls_creds && *s->parameters.tls_creds; +} + + + typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, @@ -355,7 +369,7 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps,= Error **errp) new_caps[MIGRATION_CAPABILITY_COMPRESS] || new_caps[MIGRATION_CAPABILITY_XBZRLE] || migrate_multifd_compression() || - migrate_use_tls())) { + migrate_tls())) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; diff --git a/migration/tls.c b/migration/tls.c index 4d2166a209..acd38e0b62 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -22,6 +22,7 @@ #include "channel.h" #include "migration.h" #include "tls.h" +#include "options.h" #include "crypto/tlscreds.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -165,7 +166,7 @@ void migration_tls_channel_connect(MigrationState *s, =20 bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc) { - if (!migrate_use_tls()) { + if (!migrate_tls()) { return false; } =20 --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775076; cv=none; d=zohomail.com; s=zohoarc; b=gty8wCj0SY6AeVEwK2ONTeZp3TzB0RuWOsCAvZrgzdVTbVI8NmZKbXjGIJIIzrbXRC9UueQMZESoP7VcO0YIrPGkYtx6gwRd1asYjptTXLH3btoyPJRThVHZaWlLIAxO4+/gxeorUXSUuyvEbioLaFLg85ykBKoEUB31kSClb8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775076; 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=i2JvIY+VtITpVc80SYym9U4RIIUAjNTVfTFZFKxKw/Y=; b=WqNTvz9kKrP4oKUbg1hgGIU1I2ZAKzjNvUxSF17jzFBPoRZ3CbuD6zVcGNyegCTVqquT2omdZncuxBxd2sOzx12zlJql9bwIHCPrbuMpBl/y17Zv3RVoadmgmUoSOrs+ImZqh28qdSd4WUDyGO7tKYJOYMcvGIyTrtuJYy2Bpfo= 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 1677775076007788.1747375242408; Thu, 2 Mar 2023 08:37:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlv7-0002ju-GV; Thu, 02 Mar 2023 11:36:41 -0500 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 1pXlu9-0000ma-7s for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:49 -0500 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 1pXlu6-0008BB-L5 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:40 -0500 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-359-yEqwYIN_Pa683DgDiknHsA-1; Thu, 02 Mar 2023 11:35:33 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 98C7C81172B; Thu, 2 Mar 2023 16:35:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8A20492C3E; Thu, 2 Mar 2023 16:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774936; 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=i2JvIY+VtITpVc80SYym9U4RIIUAjNTVfTFZFKxKw/Y=; b=VOja/RS2xIcn/z/JChys/OPE89JIyHr+6C5C6+3N/Xi85WFlmxotpdjjZfUzTgPJOwNEpS TDlOIPqYnSh7i4MhXTS3FYnbIJtpzvFS9ZgoHc2NzVhHHc7iZ3KcoAqwgQA6CIrHxelYjO fVVFb5qtQZb1ueb+GFP7snhAPp/mvaI= X-MC-Unique: yEqwYIN_Pa683DgDiknHsA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 29/43] migration: Move migrate_postcopy() to options.c Date: Thu, 2 Mar 2023 17:33:56 +0100 Message-Id: <20230302163410.11399-30-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775078101100011 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.h | 2 -- migration/options.h | 1 + migration/migration.c | 5 ----- migration/options.c | 5 +++++ 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 57efcb7c9f..f241159dd3 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -408,8 +408,6 @@ bool migration_is_blocked(Error **errp); bool migration_in_postcopy(void); MigrationState *migrate_get_current(void); =20 -bool migrate_postcopy(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.h b/migration/options.h index 4fbe4cb411..4214bebcb7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -47,6 +47,7 @@ bool migrate_zero_copy_send(void); * check, but they are not a capability. */ =20 +bool migrate_postcopy(void); bool migrate_tls(void); =20 /* capabilities helpers */ diff --git a/migration/migration.c b/migration/migration.c index 7c4b49deda..e091663af9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2243,11 +2243,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(); -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/options.c b/migration/options.c index 0ea3500b24..d9383afa35 100644 --- a/migration/options.c +++ b/migration/options.c @@ -209,6 +209,11 @@ bool migrate_zero_copy_send(void) =20 /* pseudo capabilities */ =20 +bool migrate_postcopy(void) +{ + return migrate_postcopy_ram() || migrate_dirty_bitmaps(); +} + bool migrate_tls(void) { MigrationState *s; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775098; cv=none; d=zohomail.com; s=zohoarc; b=Z6/eiy06TuKMCtW5kng/rF4SONH+tDLK86gCKE+JJYGuKAjR3hbPAvO02p28QNa/xKED+ETchGyKMeiCV59rj1sywjRRbudXX/e0mtPDrtfi9q84I3MyNi7svmgRrVJn9eE1kSabLpfDOPJCk3R4GAinhJG7nzD/9kqUqKDy8Ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775098; 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=nVxgTElpHLNBsMsEBnufbWFYXUWBieuHuodWUOpHLF8=; b=K2FliCtmL/rG7aBrc4VtiCRWfRaG83FVo6OemZBqHgfZeRg8zRPJEu8fgMCTpX/xIF8f990ytvoBq1vmIRWa8ctFd98B6apiiTnfSGk5PfwOaZnaT7QGL32l+qsNVbHfdTBxwXkFB60gQircdjbAI8cE8n1AQ+qwZAbM0OHe9GA= 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 16777750982661015.6397768516495; Thu, 2 Mar 2023 08:38:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXluv-0002HM-T9; Thu, 02 Mar 2023 11:36:30 -0500 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 1pXlu9-0000mZ-7m for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:49 -0500 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 1pXlu7-0008C1-0l for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:35:40 -0500 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-MhS5kYPaPSqkaSUPPv_i2w-1; Thu, 02 Mar 2023 11:35:35 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB25B85A588; Thu, 2 Mar 2023 16:35:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB38A492C3E; Thu, 2 Mar 2023 16:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774938; 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=nVxgTElpHLNBsMsEBnufbWFYXUWBieuHuodWUOpHLF8=; b=EKDSZNO2W9U8VsgVwkuOaD9QXiPh3FOyHmzxEBJKclbaugpkRuRnT6GVvmP7MJSbbUQ5jF ny2KIuh073gGKrmxdDqGeTSt0cShfQnAagIVZVmks8TCMaldvVjFW5oyQlaQ9MGAzxgu3S 5BJg+yuQXdYz63tmvQ31P0vK6zLnew4= X-MC-Unique: MhS5kYPaPSqkaSUPPv_i2w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 30/43] migration: Create migrate_max_bandwidth() function Date: Thu, 2 Mar 2023 17:33:57 +0100 Message-Id: <20230302163410.11399-31-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775100162100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/migration.c | 2 +- migration/options.c | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.h b/migration/options.h index 4214bebcb7..17ac53429e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -67,6 +67,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); diff --git a/migration/migration.c b/migration/migration.c index e091663af9..40453ba454 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3758,7 +3758,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 d9383afa35..4f6298bdc5 100644 --- a/migration/options.c +++ b/migration/options.c @@ -575,6 +575,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; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775243; cv=none; d=zohomail.com; s=zohoarc; b=kDrSsrrQGmkknsEbixRxm7SSl6xIiMZDXDcE9jruhUH32K6saKss9ujz419+KU6qDtpp+OMTUhZVRd8gHqzCJ/cunDHNO+/NvioyDKEzPPSstmq6xqM4mLqtETUnnG2tx6GryErZOyWcGrceE4lYeSH+EfSUmVTfVquXoIWMw8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775243; 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=wyosR0pCEvadNyCKnVVnrhxwHo+VYLxQ0XeZaIRzsj8=; b=QPz1IAYrVQ/+nkvN3VZBnF8wWz3g9d28mBoQRKJAwmBzCjBDWpm6NO8Ca/t5Y7cONrFid0f9etIYRuXgnpfly1Uly/fXRrv4rFc6Y5WlhmX2F4ej0jhZcZ0xDvzIE+0xrCqkTWeBMiEhjO27Q2+qzG30UDyeKOD0LFl8dUPRR+U= 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 1677775243504283.36943406064574; Thu, 2 Mar 2023 08:40:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvC-0002rx-13; Thu, 02 Mar 2023 11:36:46 -0500 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 1pXluY-0001M8-7i for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:09 -0500 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 1pXluV-0008LI-TG for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:05 -0500 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-86-aFqqWjNpPGGnJ8ao-GbCBw-1; Thu, 02 Mar 2023 11:36:01 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 933DF1C3D381; Thu, 2 Mar 2023 16:36:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B9CF492C3E; Thu, 2 Mar 2023 16:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774963; 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=wyosR0pCEvadNyCKnVVnrhxwHo+VYLxQ0XeZaIRzsj8=; b=i2A9ElqETYhWy7hHyXvRD6gfKnn9p3bQs/X/9F9vtsKpPMuzSbXmCn5O4jyqAfmmaqa0NN xCLgQra7LdC9VXErkXgIby3kFG99+i+KGCNkZ6s184VQNlF4nP/xiuNeXUZmWFxE46tRIG Y0m4t0kkw0DDZ7Qk7JfzTmcFDlJH8eo= X-MC-Unique: aFqqWjNpPGGnJ8ao-GbCBw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 31/43] migration: Move qmp_query_migrate_parameters() to options.c Date: Thu, 2 Mar 2023 17:33:58 +0100 Message-Id: <20230302163410.11399-32-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775245336100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 68 ------------------------------------------- migration/options.c | 68 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 40453ba454..77ff3b97c3 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) diff --git a/migration/options.c b/migration/options.c index 4f6298bdc5..91879967b1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -14,8 +14,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" @@ -664,4 +666,70 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 +MigrationParameters *qmp_query_migrate_parameters(Error **errp) +{ + MigrationParameters *params; + MigrationState *s =3D migrate_get_current(); =20 + /* 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; +} --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775136; cv=none; d=zohomail.com; s=zohoarc; b=W3rJCDoFbyh+sNnM1deIpRyC2YXMjTu8o1r/Z+Iiu6f2mr53T1BHKsNvZh+47XLh6Se3dt6j9eE2lQAszqHQBzAChsps5ykBW8nZRNqAspndGylfwKOSOhGBolcXPn3CkCPuTUOiYofG+98jAUY9urX3SPwZ/knzbcI8F6LArfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775136; 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=VpGaBdMJpbteE54+rvwEe6h48l574bnjZ0usvxVnCz0=; b=OlAJ0nM1MS0ZjlVNVgn+Kqi4OV4EXuHAtwB0U2EcfsFa7Afv/5ovwgQPgUwgyTiNYVFKL8GHL5HhFeuACFBOLCwgE6q2c8h5ymZl8Sg9sscg0nySwBofM+VxpNkmbvbwy+LKj6gxeRa8Pprg0d8+nFhNbe1/+y+GkyoxqRHDmV8= 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 1677775136045680.5146338461981; Thu, 2 Mar 2023 08:38:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXluw-0002IO-73; Thu, 02 Mar 2023 11:36:30 -0500 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 1pXlug-0001Xf-Ao for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:16 -0500 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 1pXluc-00005A-4a for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:13 -0500 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-661-xyC8FdsYOrqyyrcQCM5mFw-1; Thu, 02 Mar 2023 11:36:04 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CEC03804065; Thu, 2 Mar 2023 16:36:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id E38DE492B00; Thu, 2 Mar 2023 16:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774969; 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=VpGaBdMJpbteE54+rvwEe6h48l574bnjZ0usvxVnCz0=; b=hxeWPH2+HB1J03HkWQywHusRTvRgotzKRdYu22MpG7OQ7VF3uyFmSQgDP6PPSED3xbb4XY ItdWe+kV0RFERGo3ZnUxAoyM2e9TZgj317uuTLqw6zGvcdRJqpmWd3k1+pirdN5j2C6f88 22Iobq/HZOL1OmvTPC0Qs6BhV5MXlYM= X-MC-Unique: xyC8FdsYOrqyyrcQCM5mFw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 32/43] migration: Move qmp_migrate_set_parameters() to options.c Date: Thu, 2 Mar 2023 17:33:59 +0100 Message-Id: <20230302163410.11399-33-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775136620100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 11 ++ migration/migration.c | 420 ------------------------------------------ migration/options.c | 418 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 429 insertions(+), 420 deletions(-) diff --git a/migration/options.h b/migration/options.h index 17ac53429e..95338d1efd 100644 --- a/migration/options.h +++ b/migration/options.h @@ -16,6 +16,13 @@ #ifndef QEMU_MIGRATION_OPTIONS_H #define QEMU_MIGRATION_OPTIONS_H =20 +/* constants */ + +/* Amount of time to allocate to each "chunk" of bandwidth-throttled + * data. */ +#define BUFFER_DELAY 100 +#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) + /* capabilities */ =20 bool migrate_auto_converge(void); @@ -76,4 +83,8 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 +/* parameters helpers */ + +bool migrate_params_check(MigrationParameters *params, Error **errp); + #endif diff --git a/migration/migration.c b/migration/migration.c index 77ff3b97c3..5d43e815ed 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -67,19 +67,10 @@ =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 -/* Amount of time to allocate to each "chunk" of bandwidth-throttled - * data. */ -#define BUFFER_DELAY 100 -#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) - /* Time in milliseconds we are allowed to stop the source, * for sending the last part */ #define DEFAULT_MIGRATE_SET_DOWNTIME 300 =20 -/* Maximum migrate downtime set to 2000 seconds */ -#define MAX_MIGRATE_DOWNTIME_SECONDS 2000 -#define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) - /* Default compression thread count */ #define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 /* Default decompression thread count, usually decompression is at @@ -1138,417 +1129,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) return info; } =20 -/* - * Check whether the parameters are valid. Error will be put into errp - * (if provided). Return true if valid, otherwise false. - */ -static bool migrate_params_check(MigrationParameters *params, Error **errp) -{ - if (params->has_compress_level && - (params->compress_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", - "a value between 0 and 9"); - return false; - } - - if (params->has_compress_threads && (params->compress_threads < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "compress_threads", - "a value between 1 and 255"); - return false; - } - - if (params->has_decompress_threads && (params->decompress_threads < 1)= ) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "decompress_threads", - "a value between 1 and 255"); - return false; - } - - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", - "an integer in the range of 1 to 100"); - return false; - } - - if (params->has_cpu_throttle_initial && - (params->cpu_throttle_initial < 1 || - params->cpu_throttle_initial > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", - "an integer in the range of 1 to 99"); - return false; - } - - if (params->has_cpu_throttle_increment && - (params->cpu_throttle_increment < 1 || - params->cpu_throttle_increment > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", - "an integer in the range of 1 to 99"); - return false; - } - - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", - "an integer in the range of 0 to "stringify(SIZE_MAX) - " bytes/second"); - return false; - } - - if (params->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", - "an integer in the range of 0 to " - stringify(MAX_MIGRATE_DOWNTIME)" ms"); - return false; - } - - /* x_checkpoint_delay is now always positive */ - - if (params->has_multifd_channels && (params->multifd_channels < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", - "a value between 1 and 255"); - return false; - } - - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", - "a value between 0 and 9"); - return false; - } - - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", - "a value between 0 and 20"); - return false; - } - - if (params->has_xbzrle_cache_size && - (params->xbzrle_cache_size < qemu_target_page_size() || - !is_power_of_2(params->xbzrle_cache_size))) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", - "a power of two no less than the target page size"); - return false; - } - - if (params->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", - "an integer in the range of cpu_throttle_initial to 99"= ); - return false; - } - - if (params->has_announce_initial && - params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", - "a value between 0 and 100000"); - return false; - } - if (params->has_announce_max && - params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", - "a value between 0 and 100000"); - return false; - } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", - "a value between 0 and 1000"); - return false; - } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", - "a value between 0 and 10000"); - return false; - } - - if (params->has_block_bitmap_mapping && - !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { - error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); - return false; - } - -#ifdef CONFIG_LINUX - if (migrate_zero_copy_send() && - ((params->has_multifd_compression && params->multifd_compression) = || - (params->tls_creds && *params->tls_creds))) { - error_setg(errp, - "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); - return false; - } -#endif - - return true; -} - -static void migrate_params_test_apply(MigrateSetParameters *params, - MigrationParameters *dest) -{ - *dest =3D migrate_get_current()->parameters; - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_compress_level) { - dest->compress_level =3D params->compress_level; - } - - if (params->has_compress_threads) { - dest->compress_threads =3D params->compress_threads; - } - - if (params->has_compress_wait_thread) { - dest->compress_wait_thread =3D params->compress_wait_thread; - } - - if (params->has_decompress_threads) { - dest->decompress_threads =3D params->decompress_threads; - } - - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; - } - - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; - } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D params->tls_creds->u.s; - } - - if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; - } - - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_block_incremental) { - dest->block_incremental =3D params->block_incremental; - } - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - dest->multifd_compression =3D params->multifd_compression; - } - if (params->has_xbzrle_cache_size) { - dest->xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; - } - if (params->has_max_cpu_throttle) { - dest->max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - dest->announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - dest->announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - dest->announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - dest->announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - dest->has_block_bitmap_mapping =3D true; - dest->block_bitmap_mapping =3D params->block_bitmap_mapping; - } -} - -static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) -{ - MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_compress_level) { - s->parameters.compress_level =3D params->compress_level; - } - - if (params->has_compress_threads) { - s->parameters.compress_threads =3D params->compress_threads; - } - - if (params->has_compress_wait_thread) { - s->parameters.compress_wait_thread =3D params->compress_wait_threa= d; - } - - if (params->has_decompress_threads) { - s->parameters.decompress_threads =3D params->decompress_threads; - } - - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; - } - - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } - - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; - } - - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; - } - - if (params->tls_creds) { - g_free(s->parameters.tls_creds); - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); - } - - if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); - } - - if (params->tls_authz) { - g_free(s->parameters.tls_authz); - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); - } - - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file && !migration_in_postcopy()) { - qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); - } - } - - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - if (migration_in_colo_state()) { - colo_checkpoint_notify(s); - } - } - - if (params->has_block_incremental) { - s->parameters.block_incremental =3D params->block_incremental; - } - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; - } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - xbzrle_cache_resize(params->xbzrle_cache_size, errp); - } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - if (s->to_dst_file && migration_in_postcopy()) { - qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); - } - } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); - - s->parameters.has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); - } -} - -void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) -{ - MigrationParameters tmp; - - /* TODO Rewrite "" to null instead */ - if (params->tls_creds - && params->tls_creds->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_creds->u.n); - params->tls_creds->type =3D QTYPE_QSTRING; - params->tls_creds->u.s =3D strdup(""); - } - /* TODO Rewrite "" to null instead */ - if (params->tls_hostname - && params->tls_hostname->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_hostname->u.n); - params->tls_hostname->type =3D QTYPE_QSTRING; - params->tls_hostname->u.s =3D strdup(""); - } - - migrate_params_test_apply(params, &tmp); - - if (!migrate_params_check(&tmp, errp)) { - /* Invalid parameter */ - return; - } - - migrate_params_apply(params, errp); -} - - void qmp_migrate_start_postcopy(Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.c b/migration/options.c index 91879967b1..efa9c6788d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -14,17 +14,25 @@ */ =20 #include "qemu/osdep.h" +#include "exec/target_page.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 "qapi/qmp/qnull.h" #include "sysemu/runstate.h" +#include "migration/colo.h" #include "migration/misc.h" #include "migration.h" +#include "qemu-file.h" #include "ram.h" #include "options.h" =20 +/* Maximum migrate downtime set to 2000 seconds */ +#define MAX_MIGRATE_DOWNTIME_SECONDS 2000 +#define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) + bool migrate_auto_converge(void) { MigrationState *s; @@ -733,3 +741,413 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 return params; } + +/* + * Check whether the parameters are valid. Error will be put into errp + * (if provided). Return true if valid, otherwise false. + */ +bool migrate_params_check(MigrationParameters *params, Error **errp) +{ + if (params->has_compress_level && + (params->compress_level > 9)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", + "a value between 0 and 9"); + return false; + } + + if (params->has_compress_threads && (params->compress_threads < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "compress_threads", + "a value between 1 and 255"); + return false; + } + + if (params->has_decompress_threads && (params->decompress_threads < 1)= ) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "decompress_threads", + "a value between 1 and 255"); + return false; + } + + if (params->has_throttle_trigger_threshold && + (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "throttle_trigger_threshold", + "an integer in the range of 1 to 100"); + return false; + } + + if (params->has_cpu_throttle_initial && + (params->cpu_throttle_initial < 1 || + params->cpu_throttle_initial > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "cpu_throttle_initial", + "an integer in the range of 1 to 99"); + return false; + } + + if (params->has_cpu_throttle_increment && + (params->cpu_throttle_increment < 1 || + params->cpu_throttle_increment > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "cpu_throttle_increment", + "an integer in the range of 1 to 99"); + return false; + } + + if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "max_bandwidth", + "an integer in the range of 0 to "stringify(SIZE_MAX) + " bytes/second"); + return false; + } + + if (params->has_downtime_limit && + (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "downtime_limit", + "an integer in the range of 0 to " + stringify(MAX_MIGRATE_DOWNTIME)" ms"); + return false; + } + + /* x_checkpoint_delay is now always positive */ + + if (params->has_multifd_channels && (params->multifd_channels < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "multifd_channels", + "a value between 1 and 255"); + return false; + } + + if (params->has_multifd_zlib_level && + (params->multifd_zlib_level > 9)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", + "a value between 0 and 9"); + return false; + } + + if (params->has_multifd_zstd_level && + (params->multifd_zstd_level > 20)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", + "a value between 0 and 20"); + return false; + } + + if (params->has_xbzrle_cache_size && + (params->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(params->xbzrle_cache_size))) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "xbzrle_cache_size", + "a power of two no less than the target page size"); + return false; + } + + if (params->has_max_cpu_throttle && + (params->max_cpu_throttle < params->cpu_throttle_initial || + params->max_cpu_throttle > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "max_cpu_throttle", + "an integer in the range of cpu_throttle_initial to 99"= ); + return false; + } + + if (params->has_announce_initial && + params->announce_initial > 100000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_initial", + "a value between 0 and 100000"); + return false; + } + if (params->has_announce_max && + params->announce_max > 100000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_max", + "a value between 0 and 100000"); + return false; + } + if (params->has_announce_rounds && + params->announce_rounds > 1000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_rounds", + "a value between 0 and 1000"); + return false; + } + if (params->has_announce_step && + (params->announce_step < 1 || + params->announce_step > 10000)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_step", + "a value between 0 and 10000"); + return false; + } + + if (params->has_block_bitmap_mapping && + !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { + error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); + return false; + } + +#ifdef CONFIG_LINUX + if (migrate_zero_copy_send() && + ((params->has_multifd_compression && params->multifd_compression) = || + (params->tls_creds && *params->tls_creds))) { + error_setg(errp, + "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); + return false; + } +#endif + + return true; +} + +static void migrate_params_test_apply(MigrateSetParameters *params, + MigrationParameters *dest) +{ + *dest =3D migrate_get_current()->parameters; + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + + if (params->has_compress_level) { + dest->compress_level =3D params->compress_level; + } + + if (params->has_compress_threads) { + dest->compress_threads =3D params->compress_threads; + } + + if (params->has_compress_wait_thread) { + dest->compress_wait_thread =3D params->compress_wait_thread; + } + + if (params->has_decompress_threads) { + dest->decompress_threads =3D params->decompress_threads; + } + + if (params->has_throttle_trigger_threshold) { + dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; + } + + if (params->has_cpu_throttle_initial) { + dest->cpu_throttle_initial =3D params->cpu_throttle_initial; + } + + if (params->has_cpu_throttle_increment) { + dest->cpu_throttle_increment =3D params->cpu_throttle_increment; + } + + if (params->has_cpu_throttle_tailslow) { + dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; + } + + if (params->tls_creds) { + assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); + dest->tls_creds =3D params->tls_creds->u.s; + } + + if (params->tls_hostname) { + assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); + dest->tls_hostname =3D params->tls_hostname->u.s; + } + + if (params->has_max_bandwidth) { + dest->max_bandwidth =3D params->max_bandwidth; + } + + if (params->has_downtime_limit) { + dest->downtime_limit =3D params->downtime_limit; + } + + if (params->has_x_checkpoint_delay) { + dest->x_checkpoint_delay =3D params->x_checkpoint_delay; + } + + if (params->has_block_incremental) { + dest->block_incremental =3D params->block_incremental; + } + if (params->has_multifd_channels) { + dest->multifd_channels =3D params->multifd_channels; + } + if (params->has_multifd_compression) { + dest->multifd_compression =3D params->multifd_compression; + } + if (params->has_xbzrle_cache_size) { + dest->xbzrle_cache_size =3D params->xbzrle_cache_size; + } + if (params->has_max_postcopy_bandwidth) { + dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; + } + if (params->has_max_cpu_throttle) { + dest->max_cpu_throttle =3D params->max_cpu_throttle; + } + if (params->has_announce_initial) { + dest->announce_initial =3D params->announce_initial; + } + if (params->has_announce_max) { + dest->announce_max =3D params->announce_max; + } + if (params->has_announce_rounds) { + dest->announce_rounds =3D params->announce_rounds; + } + if (params->has_announce_step) { + dest->announce_step =3D params->announce_step; + } + + if (params->has_block_bitmap_mapping) { + dest->has_block_bitmap_mapping =3D true; + dest->block_bitmap_mapping =3D params->block_bitmap_mapping; + } +} + +static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) +{ + MigrationState *s =3D migrate_get_current(); + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + + if (params->has_compress_level) { + s->parameters.compress_level =3D params->compress_level; + } + + if (params->has_compress_threads) { + s->parameters.compress_threads =3D params->compress_threads; + } + + if (params->has_compress_wait_thread) { + s->parameters.compress_wait_thread =3D params->compress_wait_threa= d; + } + + if (params->has_decompress_threads) { + s->parameters.decompress_threads =3D params->decompress_threads; + } + + if (params->has_throttle_trigger_threshold) { + s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; + } + + if (params->has_cpu_throttle_initial) { + s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; + } + + if (params->has_cpu_throttle_increment) { + s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; + } + + if (params->has_cpu_throttle_tailslow) { + s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; + } + + if (params->tls_creds) { + g_free(s->parameters.tls_creds); + assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); + } + + if (params->tls_hostname) { + g_free(s->parameters.tls_hostname); + assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); + } + + if (params->tls_authz) { + g_free(s->parameters.tls_authz); + assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + } + + if (params->has_max_bandwidth) { + s->parameters.max_bandwidth =3D params->max_bandwidth; + if (s->to_dst_file && !migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); + } + } + + if (params->has_downtime_limit) { + s->parameters.downtime_limit =3D params->downtime_limit; + } + + if (params->has_x_checkpoint_delay) { + s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; + if (migration_in_colo_state()) { + colo_checkpoint_notify(s); + } + } + + if (params->has_block_incremental) { + s->parameters.block_incremental =3D params->block_incremental; + } + if (params->has_multifd_channels) { + s->parameters.multifd_channels =3D params->multifd_channels; + } + if (params->has_multifd_compression) { + s->parameters.multifd_compression =3D params->multifd_compression; + } + if (params->has_xbzrle_cache_size) { + s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; + xbzrle_cache_resize(params->xbzrle_cache_size, errp); + } + if (params->has_max_postcopy_bandwidth) { + s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; + if (s->to_dst_file && migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); + } + } + if (params->has_max_cpu_throttle) { + s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; + } + if (params->has_announce_initial) { + s->parameters.announce_initial =3D params->announce_initial; + } + if (params->has_announce_max) { + s->parameters.announce_max =3D params->announce_max; + } + if (params->has_announce_rounds) { + s->parameters.announce_rounds =3D params->announce_rounds; + } + if (params->has_announce_step) { + s->parameters.announce_step =3D params->announce_step; + } + + if (params->has_block_bitmap_mapping) { + qapi_free_BitmapMigrationNodeAliasList( + s->parameters.block_bitmap_mapping); + + s->parameters.has_block_bitmap_mapping =3D true; + s->parameters.block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + params->block_bitmap_mapping); + } +} + +void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) +{ + MigrationParameters tmp; + + /* TODO Rewrite "" to null instead */ + if (params->tls_creds + && params->tls_creds->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->tls_creds->u.n); + params->tls_creds->type =3D QTYPE_QSTRING; + params->tls_creds->u.s =3D strdup(""); + } + /* TODO Rewrite "" to null instead */ + if (params->tls_hostname + && params->tls_hostname->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->tls_hostname->u.n); + params->tls_hostname->type =3D QTYPE_QSTRING; + params->tls_hostname->u.s =3D strdup(""); + } + + migrate_params_test_apply(params, &tmp); + + if (!migrate_params_check(&tmp, errp)) { + /* Invalid parameter */ + return; + } + + migrate_params_apply(params, errp); +} --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775197; cv=none; d=zohomail.com; s=zohoarc; b=ajKbRzcW3kiiQMqKY8MhhOJD+pyc18SmmN/sthDdgoj7jszjfZCgVR/g8MSyVEzjM2tZEiIxnn6lw3Z0zWK9uZaJlOoV4wY81Jn1+vWdOt/4NtMAQWCmrw5v0l0v2cdaJlPKxte1hq4gD/FFVSmb1VyAqcoymTeeXb01ebO/0FU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775197; 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=pIqp5G7ertyq/PCIurRIiNVROHJnsldBL1HAvk8RPsM=; b=fT2zUoTxLmV1M7td47aSXFopalSDROt01RZ/5Ogm1cbQfWrIDdMkMxqAXEz0AlZGEgW8TEW1sEqT0pZbhCz3r3wqZa9BW/d6mGIci8YupYBtZoQKx0rePLu/sGlrTG8cyX0pwYPPknArsKbRBvtKVWKH621OklIzWpvo06sIVNE= 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 1677775197895853.1963384579298; Thu, 2 Mar 2023 08:39:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvD-0002xV-VW; Thu, 02 Mar 2023 11:36:48 -0500 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 1pXlud-0001X0-3x for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:14 -0500 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 1pXlua-0008WP-G5 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:10 -0500 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-206-0uOKDKgFM0691cVp56HjQw-1; Thu, 02 Mar 2023 11:36:06 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 143A31C3D38C; Thu, 2 Mar 2023 16:36:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D6AC492C3E; Thu, 2 Mar 2023 16:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774967; 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=pIqp5G7ertyq/PCIurRIiNVROHJnsldBL1HAvk8RPsM=; b=U6vcE/WiH5gTkGOordq+Ydb48SOas1feg4Cd6Mt5/Wgn97QfKknkwZv1Sb2ShXypGR3C5Q fZEpQOmB+edEQc88CKYcqrzKI7ajChEaJw57AcPl1WHJ8o/eF48LjzgSAby2L2McvLe2xC ylI/R/xVgQcPivHZx5m1aWTiWILBfgk= X-MC-Unique: 0uOKDKgFM0691cVp56HjQw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 33/43] migration: Create migrate_params_init() function Date: Thu, 2 Mar 2023 17:34:00 +0100 Message-Id: <20230302163410.11399-34-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775199011100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/migration.c | 29 +---------------------------- migration/options.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/migration/options.h b/migration/options.h index 95338d1efd..c7c9a4002b 100644 --- a/migration/options.h +++ b/migration/options.h @@ -86,5 +86,6 @@ uint64_t migrate_xbzrle_cache_size(void); /* parameters helpers */ =20 bool migrate_params_check(MigrationParameters *params, Error **errp); +void migrate_params_init(MigrationParameters *params); =20 #endif diff --git a/migration/migration.c b/migration/migration.c index 5d43e815ed..62a6f29647 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3455,7 +3455,6 @@ static void migration_instance_finalize(Object *obj) static void migration_instance_init(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); - MigrationParameters *params =3D &ms->parameters; =20 ms->state =3D MIGRATION_STATUS_NONE; ms->mbps =3D -1; @@ -3463,33 +3462,7 @@ static void migration_instance_init(Object *obj) qemu_sem_init(&ms->pause_sem, 0); qemu_mutex_init(&ms->error_mutex); =20 - params->tls_hostname =3D g_strdup(""); - params->tls_creds =3D g_strdup(""); - - /* Set has_* up only for parameter checks */ - params->has_compress_level =3D true; - params->has_compress_threads =3D true; - params->has_compress_wait_thread =3D true; - params->has_decompress_threads =3D true; - params->has_throttle_trigger_threshold =3D true; - params->has_cpu_throttle_initial =3D true; - params->has_cpu_throttle_increment =3D true; - params->has_cpu_throttle_tailslow =3D true; - params->has_max_bandwidth =3D true; - params->has_downtime_limit =3D true; - params->has_x_checkpoint_delay =3D true; - params->has_block_incremental =3D true; - params->has_multifd_channels =3D true; - params->has_multifd_compression =3D true; - params->has_multifd_zlib_level =3D true; - params->has_multifd_zstd_level =3D true; - params->has_xbzrle_cache_size =3D true; - params->has_max_postcopy_bandwidth =3D true; - params->has_max_cpu_throttle =3D true; - params->has_announce_initial =3D true; - params->has_announce_max =3D true; - params->has_announce_rounds =3D true; - params->has_announce_step =3D true; + migrate_params_init(&ms->parameters); =20 qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->postcopy_pause_rp_sem, 0); diff --git a/migration/options.c b/migration/options.c index efa9c6788d..15ee1aa922 100644 --- a/migration/options.c +++ b/migration/options.c @@ -742,6 +742,37 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) return params; } =20 +void migrate_params_init(MigrationParameters *params) +{ + params->tls_hostname =3D g_strdup(""); + params->tls_creds =3D g_strdup(""); + + /* Set has_* up only for parameter checks */ + params->has_compress_level =3D true; + params->has_compress_threads =3D true; + params->has_compress_wait_thread =3D true; + params->has_decompress_threads =3D true; + params->has_throttle_trigger_threshold =3D true; + params->has_cpu_throttle_initial =3D true; + params->has_cpu_throttle_increment =3D true; + params->has_cpu_throttle_tailslow =3D true; + params->has_max_bandwidth =3D true; + params->has_downtime_limit =3D true; + params->has_x_checkpoint_delay =3D true; + params->has_block_incremental =3D true; + params->has_multifd_channels =3D true; + params->has_multifd_compression =3D true; + params->has_multifd_zlib_level =3D true; + params->has_multifd_zstd_level =3D true; + params->has_xbzrle_cache_size =3D true; + params->has_max_postcopy_bandwidth =3D true; + params->has_max_cpu_throttle =3D true; + params->has_announce_initial =3D true; + params->has_announce_max =3D true; + params->has_announce_rounds =3D true; + params->has_announce_step =3D true; +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775062; cv=none; d=zohomail.com; s=zohoarc; b=iiZYM5kh1IrDEQHZAORmtZbcSH5aK9hD7v4h1/GxlPJRMljp7/iLeY7DXTKVQFopbX7p/BTkpVHimMeVyJzuaxTqYX7uEd4K5Yn3nR6TVyRw9quTfXssk8Q/2EDfx0M6J6wFrk172xHPkgOmr0D0yMG45rUBmMDnhPmlXEV+5Nw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775062; 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=2Q2lznzHZ4hgf3BA9vxp6E05x+gcbSqvJyM8M3w5N1M=; b=i8XDnQK4DB8bck5aVoVaQldIRIgzopKwQLs/bgPfmYeSi9oux2ONWj56lG6bicqK4pkpJzHJ/UwYU9xFt7u/ibLadL4q8TvlYHe3O9FWrb0/IDftD8emI4XOESIxDWdvPcYiIbUUj5SqLeUbWJW3ozAx3vMOVvEJSPw5BOt+DJA= 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 1677775062188660.5086362813713; Thu, 2 Mar 2023 08:37:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXluq-00020W-Rc; Thu, 02 Mar 2023 11:36:24 -0500 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 1pXluo-0001sC-NN for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:22 -0500 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 1pXlum-0000Vh-7G for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:22 -0500 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-462-Is5rggRJOOqt3vztdaWhZg-1; Thu, 02 Mar 2023 11:36:08 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64FB885A5B1; Thu, 2 Mar 2023 16:36:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5711F492B01; Thu, 2 Mar 2023 16:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774979; 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=2Q2lznzHZ4hgf3BA9vxp6E05x+gcbSqvJyM8M3w5N1M=; b=EL+KSOQbgrH22pzQVuw1QBap2lg64Fm4C9lGWSvOw9nPQ6UczBsPg0idTLeQowRp0+ufjU IXroyDnFb8P0s7rgMd1HNtSNSuVPWkcemqNEW83n5lnhhMgEDXp1DrTZaADyzIVTFUqOuZ NGa58cCcOMdunouxAsZJl7OWAK5KwoM= X-MC-Unique: Is5rggRJOOqt3vztdaWhZg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 34/43] migration: Make all functions check have the same format Date: Thu, 2 Mar 2023 17:34:01 +0100 Message-Id: <20230302163410.11399-35-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775064003100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.c | 153 +++++++++++--------------------------------- 1 file changed, 39 insertions(+), 114 deletions(-) diff --git a/migration/options.c b/migration/options.c index 15ee1aa922..350cd24e28 100644 --- a/migration/options.c +++ b/migration/options.c @@ -35,27 +35,21 @@ =20 bool migrate_auto_converge(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; } =20 bool migrate_background_snapshot(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 bool migrate_block(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; } @@ -63,95 +57,76 @@ bool migrate_block(void) bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); + return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; } =20 bool migrate_compress(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; } =20 bool migrate_dirty_bitmaps(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 bool migrate_events(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; } =20 bool migrate_ignore_shared(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; } =20 bool migrate_late_block_activate(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } =20 bool migrate_multifd(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 bool migrate_pause_before_switchover(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; } =20 bool migrate_postcopy_blocktime(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; } =20 bool migrate_postcopy_preempt(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; } =20 bool migrate_postcopy_ram(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; } @@ -165,54 +140,42 @@ bool migrate_rdma_pin_all(void) =20 bool migrate_release_ram(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; } =20 bool migrate_return_path(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; } =20 bool migrate_validate_uuid(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; } =20 bool migrate_xbzrle(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; } =20 bool migrate_zero_blocks(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } =20 bool migrate_zero_copy_send(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } @@ -226,9 +189,7 @@ bool migrate_postcopy(void) =20 bool migrate_tls(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.tls_creds && *s->parameters.tls_creds; } @@ -497,126 +458,98 @@ void qmp_migrate_set_capabilities(MigrationCapabilit= yStatusList *params, =20 bool migrate_block_incremental(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.block_incremental; } =20 uint32_t migrate_checkpoint_delay(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.x_checkpoint_delay; } =20 int migrate_compress_level(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.compress_level; } =20 int migrate_compress_threads(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.compress_threads; } =20 int migrate_compress_wait_thread(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.compress_wait_thread; } =20 uint8_t migrate_cpu_throttle_increment(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.cpu_throttle_increment; } =20 uint8_t migrate_cpu_throttle_initial(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.cpu_throttle_initial; } =20 bool migrate_cpu_throttle_tailslow(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.cpu_throttle_tailslow; } =20 int migrate_decompress_threads(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.decompress_threads; } =20 uint8_t migrate_max_cpu_throttle(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.max_cpu_throttle; } =20 uint64_t migrate_max_bandwidth(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.max_bandwidth; } =20 int64_t migrate_max_postcopy_bandwidth(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.max_postcopy_bandwidth; } =20 int migrate_multifd_channels(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.multifd_channels; } =20 MultiFDCompression migrate_multifd_compression(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); return s->parameters.multifd_compression; @@ -624,36 +557,28 @@ MultiFDCompression migrate_multifd_compression(void) =20 int migrate_multifd_zlib_level(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.multifd_zlib_level; } =20 int migrate_multifd_zstd_level(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.multifd_zstd_level; } =20 uint8_t migrate_throttle_trigger_threshold(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.throttle_trigger_threshold; } =20 uint64_t migrate_xbzrle_cache_size(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.xbzrle_cache_size; } --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775088; cv=none; d=zohomail.com; s=zohoarc; b=J2j76Khzy90QrVBseLRrLRoHEKyVpSfJENObpLJMB1gePW6K2weME10Vne5cDDqTS45BRZ43ulTLgOv5MRWHXK9r5nzSCbV/qM8jnY+/jp/tuh2medsEMhKrS6T4n38NYH/bGkQAgaZHYviEYUMf07YN+fdXNzTYPu8pt2D2xks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775088; 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=b5/5JxJi2WRFpSM8VJJ1wkmd0dm7V5w5lyuYlsHhN6Q=; b=K4jo8R3s7Ia6wfHN9tiOAqcIkQNuf3w6e9YNBg+RTzLRExD0FFYOG6EQs5GohPMLAMWNiMJZohjtN5LdaZRRuj/1EawgPI4wLIV+DRWCuiZ3sLOI+1oAlJ/y2tUHeX0I4uEjPRT7zXKLB7nSM6r30LGFBDb6Wb8Ou+rFR4rUbEY= 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 1677775088628930.7158888325602; Thu, 2 Mar 2023 08:38:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvG-00032Z-5Q; Thu, 02 Mar 2023 11:36:50 -0500 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 1pXlul-0001eR-7p for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:19 -0500 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 1pXluj-0000KU-E0 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:18 -0500 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-461-MswMTbaqMuyp9qgRjPclcA-1; Thu, 02 Mar 2023 11:36:11 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4EF785CBE7; Thu, 2 Mar 2023 16:36:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD586492C3E; Thu, 2 Mar 2023 16:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774976; 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=b5/5JxJi2WRFpSM8VJJ1wkmd0dm7V5w5lyuYlsHhN6Q=; b=Vh8+Cn52izpnNo2ipkPOgJB9r4i6zReCP12I04YV84AbhjCUWimeoLCWHaDN6A7fEq8C8I wlpZZFIO7NZxaSL3JkieYB4GObgAnHzPaf6DVEA5dshaTkFJD1y0SkaiHrz3e1zYeeGKx2 wcQiWJWqpPGMnAOxkl8gQbWscbpo72g= X-MC-Unique: MswMTbaqMuyp9qgRjPclcA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 35/43] migration: Create migrate_downtime_limit() function Date: Thu, 2 Mar 2023 17:34:02 +0100 Message-Id: <20230302163410.11399-36-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775090089100008 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/migration.c | 4 ++-- migration/options.c | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/migration/options.h b/migration/options.h index c7c9a4002b..10a59b1172 100644 --- a/migration/options.h +++ b/migration/options.h @@ -73,6 +73,7 @@ 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); +uint64_t migrate_downtime_limit(void); uint8_t migrate_max_cpu_throttle(void); uint64_t migrate_max_bandwidth(void); int64_t migrate_max_postcopy_bandwidth(void); diff --git a/migration/migration.c b/migration/migration.c index 62a6f29647..9db8e09462 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2733,7 +2733,7 @@ static void migration_update_counters(MigrationState = *s, transferred =3D current_bytes - s->iteration_initial_bytes; time_spent =3D current_time - s->iteration_start_time; bandwidth =3D (double)transferred / time_spent; - s->threshold_size =3D bandwidth * s->parameters.downtime_limit; + s->threshold_size =3D bandwidth * migrate_downtime_limit(); =20 s->mbps =3D (((double) transferred * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0; @@ -3240,7 +3240,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) */ migrate_error_free(s); =20 - s->expected_downtime =3D s->parameters.downtime_limit; + s->expected_downtime =3D migrate_downtime_limit(); if (resume) { assert(s->cleanup_bh); } else { diff --git a/migration/options.c b/migration/options.c index 350cd24e28..6034443cee 100644 --- a/migration/options.c +++ b/migration/options.c @@ -519,6 +519,13 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 +uint64_t migrate_downtime_limit(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.downtime_limit; +} + uint8_t migrate_max_cpu_throttle(void) { MigrationState *s =3D migrate_get_current(); --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775315; cv=none; d=zohomail.com; s=zohoarc; b=Yc91zlK7MfWt27sscrrQErnP8jWh8P6YtWH1KAkv8tbLJ4stkjcMCpb3hN2pIs+Kl9hGmKRxRt4kl6G4OnQpoQrWnCO01FQ8mwG3URVMm8wa9BsEr+3NsMyChWq6MBWAfx59X38lTjphqf5F78Y4rKfg6v9p9FFIQPCn1TT2wYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775315; 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=sJdy0araoE+mY5BAtKUKaPwA/GLEotVQRpKWQIQig1A=; b=HsMan0vU+hW30LBUZKwzXTl4w1nGWOHLJrAFYm8pHCMOERn0i03+bw9prn1GiUJrrY02b3DNwRAo1upvDCFozrv5RwzrbPm2CrriKScnC+rWGIR9SGFkhK5znRk9MDMIdSgzhGnC0OlLOAUuERsV6yzi7y1zF04KtrypYQfltnQ= 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 1677775315306735.912875812213; Thu, 2 Mar 2023 08:41:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlxD-0004HX-T5; Thu, 02 Mar 2023 11:38:52 -0500 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 1pXlx1-00049o-Mf for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:38:41 -0500 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 1pXlwx-0000uH-1V for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:38:37 -0500 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-554-ESosONUyPOy0v5MZ3LAMlw-1; Thu, 02 Mar 2023 11:36:33 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C691100F90D; Thu, 2 Mar 2023 16:36:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1509C492C3E; Thu, 2 Mar 2023 16:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677775113; 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=sJdy0araoE+mY5BAtKUKaPwA/GLEotVQRpKWQIQig1A=; b=L3U5XwQE2tE3HBlAbeW2E8dTCgxRPXf4wt2bjkSz0N+Pr40eMIk1i9ioUq+4LxcZ5Abbxz qHBuOjKzFzex/CviCzTivCsBCCQVio8FyTqloFSKmmzkb836uT4iG/X5spAaOjAI3nNNiv Qfxb0LEXOxxbpQST/GbJh2NwfuiLd+k= X-MC-Unique: ESosONUyPOy0v5MZ3LAMlw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 36/43] migration: Move migrate_set_block_incremental() to options.c Date: Thu, 2 Mar 2023 17:34:03 +0100 Message-Id: <20230302163410.11399-37-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775316073100001 Content-Type: text/plain; charset="utf-8" Once there, make it more regular and remove th eneed for MigrationState parameter. Signed-off-by: Juan Quintela --- migration/options.h | 4 ++++ migration/migration.c | 9 ++------- migration/options.c | 9 +++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/migration/options.h b/migration/options.h index 10a59b1172..0fbe294a65 100644 --- a/migration/options.h +++ b/migration/options.h @@ -84,6 +84,10 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 +/* parameters setters */ + +void migrate_set_block_incremental(bool value); + /* parameters helpers */ =20 bool migrate_params_check(MigrationParameters *params, Error **errp); diff --git a/migration/migration.c b/migration/migration.c index 9db8e09462..f293fb1fd6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1162,17 +1162,12 @@ void migrate_set_state(int *state, int old_state, i= nt new_state) } } =20 -static void migrate_set_block_incremental(MigrationState *s, bool value) -{ - s->parameters.block_incremental =3D value; -} - static void block_cleanup_parameters(MigrationState *s) { if (s->must_remove_block_options) { /* setting to false can never fail */ migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); - migrate_set_block_incremental(s, false); + migrate_set_block_incremental(false); s->must_remove_block_options =3D false; } } @@ -1666,7 +1661,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, } =20 if (blk_inc) { - migrate_set_block_incremental(s, true); + migrate_set_block_incremental(true); } =20 migrate_init(s); diff --git a/migration/options.c b/migration/options.c index 6034443cee..7838515991 100644 --- a/migration/options.c +++ b/migration/options.c @@ -590,6 +590,15 @@ uint64_t migrate_xbzrle_cache_size(void) return s->parameters.xbzrle_cache_size; } =20 +/* parameter setters */ + +void migrate_set_block_incremental(bool value) +{ + MigrationState *s =3D migrate_get_current(); + + s->parameters.block_incremental =3D value; +} + /* parameters helpers */ =20 AnnounceParameters *migrate_announce_params(void) --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775090; cv=none; d=zohomail.com; s=zohoarc; b=DP2TQ1rRYPffn/BjRRY68sISIpT1sp555nvHwuwANCMnvVNfohds5sRbTbR5zkkUPFWfBp/H3A0CiJTaS8RaAIq6ybcBbAZ48wXB0HeWUuNQzfT+O2XcrpUhYMtf1KGK4DJkURmT1TnzWN7ctOgo+aTbEZ/b76bIyebjKl8o2/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775090; 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=A0cSUBoBQTEjRwoN1vnfIAl7EwFxbTCNsdqbFuAprqs=; b=NuzFuo3VMrWVk5we6ZR5CdXh9t3BdEZpdnME6YlTCcpt/Y2fUr7DwrvPpEhOdmnJrv+1DlCbXrWGmQzdpWX9410qMjdeEEnXShcaLuHftBnzz8dpSGlwZFf0KMIbUK4l8hCe5II4W2S6KZH+48KfqzKxVfLs714+sAf1daWEtT0= 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 1677775090165368.9815017152182; Thu, 2 Mar 2023 08:38:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvJ-0003AC-Cw; Thu, 02 Mar 2023 11:36:53 -0500 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 1pXluo-0001qi-6q for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:22 -0500 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 1pXlum-0000Vc-5n for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:21 -0500 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-259-y5Bp0AsqNUmQZLH_NGVu7A-1; Thu, 02 Mar 2023 11:36:15 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 615A5800B23; Thu, 2 Mar 2023 16:36:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E84D492C3E; Thu, 2 Mar 2023 16:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774979; 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=A0cSUBoBQTEjRwoN1vnfIAl7EwFxbTCNsdqbFuAprqs=; b=LoQPg3Nb+zIslRhPrlLlIDbmOY7uY71bmBBI8+5rt3iALo4rwnOpaD6ggiHPNyMb+c95q0 29Z0wI1Qwf6NmlSDQ/FLb2H9mlsQ2ADSzZ2DPekRKJaynusEvSoFn8h3J/QBUpiefDRsL2 micgdFKG3x4BYDc5d+5R7jP0E1Frl4o= X-MC-Unique: y5Bp0AsqNUmQZLH_NGVu7A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 37/43] migration: Move block_cleanup_parameters() to options.c Date: Thu, 2 Mar 2023 17:34:04 +0100 Message-Id: <20230302163410.11399-38-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775092147100015 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/migration.c | 10 ---------- migration/options.c | 10 ++++++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/migration/options.h b/migration/options.h index 0fbe294a65..bd1945d3d1 100644 --- a/migration/options.h +++ b/migration/options.h @@ -92,5 +92,6 @@ void migrate_set_block_incremental(bool value); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); +void block_cleanup_parameters(MigrationState *s); =20 #endif diff --git a/migration/migration.c b/migration/migration.c index f293fb1fd6..5dc0bc86f1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1162,16 +1162,6 @@ void migrate_set_state(int *state, int old_state, in= t new_state) } } =20 -static void block_cleanup_parameters(MigrationState *s) -{ - if (s->must_remove_block_options) { - /* setting to false can never fail */ - migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); - migrate_set_block_incremental(false); - s->must_remove_block_options =3D false; - } -} - static void migrate_fd_cleanup(MigrationState *s) { qemu_bh_delete(s->cleanup_bh); diff --git a/migration/options.c b/migration/options.c index 7838515991..f7d46ccfc9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -601,6 +601,16 @@ void migrate_set_block_incremental(bool value) =20 /* parameters helpers */ =20 +void block_cleanup_parameters(MigrationState *s) +{ + if (s->must_remove_block_options) { + /* setting to false can never fail */ + migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); + migrate_set_block_incremental(false); + s->must_remove_block_options =3D false; + } +} + AnnounceParameters *migrate_announce_params(void) { static AnnounceParameters ap; --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775343; cv=none; d=zohomail.com; s=zohoarc; b=K9BkuyK4YfiTwPzFNFumb1uPjYTJxtB8jKNXgBT9WNkWksnPjamDlVQMMyQ39nH119n/008JYPzabYl0rjNiElsiUBcq8svB3eqJ5Dh0DYZ1idCBYev2Qk06CASdXS8dt6Y4Kmi72bKzcIlJDuOxDFR1PxJdzj40D/lYpyQmHOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775343; 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=4LXmdsMsgNnjvzFaoGDGP0u/tQxuno6CQ8JNr/iNBLo=; b=YJt4ipSmApmCcZnnDxF7wnUyjzfzq4lKIvtrXMRISFiP01M5edl25OgdO3P7SRGNVJgeikPwZk5F9I58UAFR8RxVItUiWqMG9nGlNCAdGDUH/uv/Wr/4oYSmljyuESzZQZeMOngJeLZVFUbus2UvJLflej1oDVoO0/FoiWorD4k= 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 1677775343134888.9987054304447; Thu, 2 Mar 2023 08:42:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvT-0003Zv-IU; Thu, 02 Mar 2023 11:37:03 -0500 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 1pXlux-0002OJ-2j for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:31 -0500 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 1pXluv-0000Y3-BT for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:30 -0500 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-634-rWuiFKKBPkGGvY_VuBKxQw-1; Thu, 02 Mar 2023 11:36:18 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EE18100F908; Thu, 2 Mar 2023 16:36:17 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9023492C3E; Thu, 2 Mar 2023 16:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774988; 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=4LXmdsMsgNnjvzFaoGDGP0u/tQxuno6CQ8JNr/iNBLo=; b=VvBpkFoWSHoSKteR3MymQQVrI3N6IZeHajL86wJR/Au4TUqqxs9oG9SE2pBTCKFQWiVAs2 yAOghK47mbd6Sig50aHePRWdtjohtQWkuKOMFQA7w+9dDnsYcwwOD1dpW+hm9A13mXQAky 0aKJohg9P4bEthxTiPn5Vj6JEU3+3ww= X-MC-Unique: rWuiFKKBPkGGvY_VuBKxQw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 38/43] migration: Remove MigrationState from block_cleanup_parameters() Date: Thu, 2 Mar 2023 17:34:05 +0100 Message-Id: <20230302163410.11399-39-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775344780100001 Content-Type: text/plain; charset="utf-8" This makes the function more regular with everything else. Signed-off-by: Juan Quintela --- migration/options.h | 2 +- migration/migration.c | 4 ++-- migration/options.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/migration/options.h b/migration/options.h index bd1945d3d1..1d63c4069c 100644 --- a/migration/options.h +++ b/migration/options.h @@ -92,6 +92,6 @@ void migrate_set_block_incremental(bool value); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); -void block_cleanup_parameters(MigrationState *s); +void block_cleanup_parameters(void); =20 #endif diff --git a/migration/migration.c b/migration/migration.c index 5dc0bc86f1..71fc360240 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1216,7 +1216,7 @@ static void migrate_fd_cleanup(MigrationState *s) error_report_err(error_copy(s->error)); } notifier_list_notify(&migration_state_notifiers, s); - block_cleanup_parameters(s); + block_cleanup_parameters(); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 @@ -1710,7 +1710,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); - block_cleanup_parameters(s); + block_cleanup_parameters(); return; } =20 diff --git a/migration/options.c b/migration/options.c index f7d46ccfc9..79187c3be0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -601,8 +601,10 @@ void migrate_set_block_incremental(bool value) =20 /* parameters helpers */ =20 -void block_cleanup_parameters(MigrationState *s) +void block_cleanup_parameters(void) { + MigrationState *s =3D migrate_get_current(); + if (s->must_remove_block_options) { /* setting to false can never fail */ migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775275; cv=none; d=zohomail.com; s=zohoarc; b=lKiyktEQBJym3rGNiQ26Kv0K4i6LHpljys2d46O0ZfLVegCznK3JU2u9NuRJGZvZhOnXDHjKFTYrH2Jox+3j1ODEXx9mUwLOa8MlB2z9eowlm2QhR2qYxTfMcJFiPE3sxq/G5GypNmssWt5yl5T7dhJFdMTbV7sKXi9eC9n8Vno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775275; 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=iohvYxnlsFkTs80QzBwxrL4Ns4Cl14mSBPw0iwzLhU0=; b=OhIWNOZ0cslWhaC/jSe0G4UH4oRwOy+i3lPam3htCXevSxnJrjaTSyVb7b5d6/dSNwEzWgu0XbmzkBuxQyR3j+X6LbUloDiQzNDXRWlof7Fu9SuXWkiW6oCDihaXPNiFOLA/W35YzSz4B2YtQVOaK/L2zQasOGffB0jCY9iaoo4= 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 1677775275611340.4926620342809; Thu, 2 Mar 2023 08:41:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvM-0003HM-8n; Thu, 02 Mar 2023 11:36:56 -0500 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 1pXlus-00027I-Fq for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:26 -0500 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 1pXluq-0000Wr-Pt for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:26 -0500 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-635-xYoUimqzPUCyTT7gngvmvw-1; Thu, 02 Mar 2023 11:36:20 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0393100F908; Thu, 2 Mar 2023 16:36:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id E207E492C3E; Thu, 2 Mar 2023 16:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774984; 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=iohvYxnlsFkTs80QzBwxrL4Ns4Cl14mSBPw0iwzLhU0=; b=ODH0pRfNRKdw4/VBM7tfsEDrSD3KERIOpTy/1SopS40kLNxEetTSixIAONcGQ4GXKi+hcg bOUYAEZr8AAIzfY1WAlUhGnz4HLHhf1ktbgettlbmlYCk3c/D+iO0u/JKrvbfYOcKlwiAh t9fJnUdXuEUC3+sf9L0ywuv32H+wJZg= X-MC-Unique: xYoUimqzPUCyTT7gngvmvw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 39/43] migration: Create migrate_tls_creds() function Date: Thu, 2 Mar 2023 17:34:06 +0100 Message-Id: <20230302163410.11399-40-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775277633100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 7 +++++++ migration/tls.c | 9 ++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/migration/options.h b/migration/options.h index 1d63c4069c..78cb936aba 100644 --- a/migration/options.h +++ b/migration/options.h @@ -82,6 +82,7 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); +char *migrate_tls_creds(void); uint64_t migrate_xbzrle_cache_size(void); =20 /* parameters setters */ diff --git a/migration/options.c b/migration/options.c index 79187c3be0..41bb2d2959 100644 --- a/migration/options.c +++ b/migration/options.c @@ -583,6 +583,13 @@ uint8_t migrate_throttle_trigger_threshold(void) return s->parameters.throttle_trigger_threshold; } =20 +char *migrate_tls_creds(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_creds; +} + uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/tls.c b/migration/tls.c index acd38e0b62..0d318516de 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -34,20 +34,19 @@ migration_tls_get_creds(MigrationState *s, Error **errp) { Object *creds; + char *tls_creds =3D migrate_tls_creds(); QCryptoTLSCreds *ret; =20 - creds =3D object_resolve_path_component( - object_get_objects_root(), s->parameters.tls_creds); + creds =3D object_resolve_path_component(object_get_objects_root(), tls= _creds); if (!creds) { - error_setg(errp, "No TLS credentials with id '%s'", - s->parameters.tls_creds); + error_setg(errp, "No TLS credentials with id '%s'", tls_creds); return NULL; } ret =3D (QCryptoTLSCreds *)object_dynamic_cast( creds, TYPE_QCRYPTO_TLS_CREDS); if (!ret) { error_setg(errp, "Object with id '%s' is not TLS credentials", - s->parameters.tls_creds); + tls_creds); return NULL; } if (!qcrypto_tls_creds_check_endpoint(ret, endpoint, errp)) { --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775086; cv=none; d=zohomail.com; s=zohoarc; b=eLS61CtqziYG/NDInv2+foatO51LpriHu3F/o1x9KQvjBqhsJsMeiW0ttBt5/SKNq7U1ddsUy6Ggc92OQfjKoy8UuaA797joix+U7H0OTM9HOkMWvKiRQ44M9CWcYo0NeWjRD5Z9FQEWVIFQKyvnU+DU1IPMoHW+aN3kuvzukus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775086; 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=nUKeOppjHnGYeP3mtV/jZYBE+OTAYVT+0VlhR+CYztw=; b=NuOkCOcR6LPE3XsyU0lfUM8+kx6M4X7/LYPfiapsDl6KwaIdSCIi4H7JUCGKoxeAIvZoqZoYlEfHqZ0+BiyKTM6+PJIJILwGBXstDKZkSaMb91O0YgGzTDRZaCyj/o0++XPeo15C0ImyXcTbffZYkgm+qDHIfdQ9GWDaLHWFXXM= 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 1677775086945360.29614261510744; Thu, 2 Mar 2023 08:38:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvS-0003WN-77; Thu, 02 Mar 2023 11:37:02 -0500 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 1pXluv-0002Hr-TN for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:30 -0500 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 1pXlut-0000XY-Bc for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:29 -0500 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-37-_BT12HPwNEGzTmWChDcdDw-1; Thu, 02 Mar 2023 11:36:23 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 257EA29ABA01; Thu, 2 Mar 2023 16:36:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E3F4492C3E; Thu, 2 Mar 2023 16:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774986; 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=nUKeOppjHnGYeP3mtV/jZYBE+OTAYVT+0VlhR+CYztw=; b=Y0Nn6UC8pHeid0ViDV9JWuZ+EVHxqqZqx59Cs5mP88nx6EcvrkqiiQcBrApexQXEAuWZs2 bILh6k1OVkUkKeVccfyiZwhy2YC7Pcrx+F4HE4AgWSl7TA6UakVCKfYO6FkaDSpgrbQbOy 5TIIvcZqsTASuQFMhRwef4CNCr61VGU= X-MC-Unique: _BT12HPwNEGzTmWChDcdDw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 40/43] migration: Create migrate_tls_authz() function Date: Thu, 2 Mar 2023 17:34:07 +0100 Message-Id: <20230302163410.11399-41-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775088097100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 7 +++++++ migration/tls.c | 5 +---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/migration/options.h b/migration/options.h index 78cb936aba..31d50cadd0 100644 --- a/migration/options.h +++ b/migration/options.h @@ -82,6 +82,7 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); +char *migrate_tls_authz(void); char *migrate_tls_creds(void); uint64_t migrate_xbzrle_cache_size(void); =20 diff --git a/migration/options.c b/migration/options.c index 41bb2d2959..42ad3e941d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -583,6 +583,13 @@ uint8_t migrate_throttle_trigger_threshold(void) return s->parameters.throttle_trigger_threshold; } =20 +char *migrate_tls_authz(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_authz; +} + char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/tls.c b/migration/tls.c index 0d318516de..4c229326fd 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -86,10 +86,7 @@ void migration_tls_channel_process_incoming(MigrationSta= te *s, return; } =20 - tioc =3D qio_channel_tls_new_server( - ioc, creds, - s->parameters.tls_authz, - errp); + tioc =3D qio_channel_tls_new_server(ioc, creds, migrate_tls_authz(), e= rrp); if (!tioc) { return; } --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775039; cv=none; d=zohomail.com; s=zohoarc; b=OWqVS0nyOFxUeH/FJ2dG7cILEgkkKvw4/ZtTyiELkCTUk9zR2i/8oWCHorkE4px/NlrVxgOTry587vO1KsEOPGqu71dZazlP71zvJpNd8e2ajMtUF20J8t28rA9m33SzquwH5/VM1CyUX4EgA/tFvwDP6PbRdmbpgNWcKa3CvG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775039; 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=YXHKUHyofGHiR1ZbIeZ+Qd2LybELa5PftO1SuB0xYGY=; b=Hi+z5UOrrH6r9ZonSp9/5t2O3sdVnx/IYIcf+m1RizlXCTE+PSY4GDkiCf/ngBlGvnjHA5Q1hOAFVDC+XXExlyEv+/JLTEBOmo0itKB0JITZeKeXjvD7iX2iR23ggb5DzouzCs73alRIuD1/IzCkByNxPDudpKiuOjJFiFAIfvU= 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 1677775039257443.1456875824215; Thu, 2 Mar 2023 08:37:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvP-0003NX-AK; Thu, 02 Mar 2023 11:36:59 -0500 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 1pXluu-0002BR-CZ for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:28 -0500 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 1pXlus-0000XG-Gn for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:27 -0500 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-392-gHuOfxo4PRCj8yv1iXW2ig-1; Thu, 02 Mar 2023 11:36:24 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5114629ABA01; Thu, 2 Mar 2023 16:36:24 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67386492C3E; Thu, 2 Mar 2023 16:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774985; 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=YXHKUHyofGHiR1ZbIeZ+Qd2LybELa5PftO1SuB0xYGY=; b=Kfth1rDjxwkmLYiTPOZeFsbVm0s61+ASaQ/GkDoZMNjy2s5MEwqnLzFufEwzxALBI3Kzwp W+CQ7d1guPuqFR9HvsPe+hX+aWzBvoi7dQpQbAYTiA3EKAqOnVImacnpr+o2LxugBVXsLP xWFI7zIKG3tHCOj3ToTtopUeT8XFFp4= X-MC-Unique: gHuOfxo4PRCj8yv1iXW2ig-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 41/43] migration: Create migrate_tls_hostname() function Date: Thu, 2 Mar 2023 17:34:08 +0100 Message-Id: <20230302163410.11399-42-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775039833100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/options.c | 7 +++++++ migration/tls.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/migration/options.h b/migration/options.h index 31d50cadd0..3284f95312 100644 --- a/migration/options.h +++ b/migration/options.h @@ -84,6 +84,7 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); char *migrate_tls_authz(void); char *migrate_tls_creds(void); +char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); =20 /* parameters setters */ diff --git a/migration/options.c b/migration/options.c index 42ad3e941d..96d20a9cfc 100644 --- a/migration/options.c +++ b/migration/options.c @@ -597,6 +597,13 @@ char *migrate_tls_creds(void) return s->parameters.tls_creds; } =20 +char *migrate_tls_hostname(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_hostname; +} + uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/tls.c b/migration/tls.c index 4c229326fd..3cae1a06e7 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -123,6 +123,7 @@ QIOChannelTLS *migration_tls_client_create(MigrationSta= te *s, Error **errp) { QCryptoTLSCreds *creds; + char *tls_hostname; =20 creds =3D migration_tls_get_creds( s, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, errp); @@ -130,8 +131,9 @@ QIOChannelTLS *migration_tls_client_create(MigrationSta= te *s, return NULL; } =20 - if (s->parameters.tls_hostname && *s->parameters.tls_hostname) { - hostname =3D s->parameters.tls_hostname; + tls_hostname =3D migrate_tls_hostname(); + if (tls_hostname && *tls_hostname) { + hostname =3D tls_hostname; } =20 return qio_channel_tls_new_client(ioc, creds, hostname, errp); --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775378; cv=none; d=zohomail.com; s=zohoarc; b=iUpRpZN6driQadXr1f56Pp8gqx4zPGKEDmomXb2Cc4pv9NQIjzE7s51WZ7Tlr6EoZPVeaXdMd9/uGEPNmegjcP+kfC68fQWzpcWOTNb/v68SZ/KXFYSd6kri2EShst7E68OUNSMxcwSr5UnBu9GIoSQeZGG53dxkuS13yRddipY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775378; 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=LP4nQDpNy/evUFzrJ1tFCb0pkVZZ+TvRlr6tCVxCdl8=; b=ReEDNmdmXGcdCV68Ed6YIIpsIZLVyseJrgBgEbGJGKiShyPD+0m94HUIEzRW+1nKEJ9h5hq0mk3r1zoKFdbXd/bMUkxbzse5n6Bm2Zn508g86wkQBpMw3kplHAG6lmZvymieWi0J4oRZdHo2bD5cjbNAZdoHNu9Bh3hxcFXN2GM= 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 1677775378067233.9772474942837; Thu, 2 Mar 2023 08:42:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvV-0003jD-Lu; Thu, 02 Mar 2023 11:37:05 -0500 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 1pXlv0-0002QK-7D for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:36 -0500 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 1pXluy-0000Yz-Ra for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:33 -0500 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-354-NtG2m1BZPsOp_cFQ5-iWig-1; Thu, 02 Mar 2023 11:36:27 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E414100F908; Thu, 2 Mar 2023 16:36:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95A72492B02; Thu, 2 Mar 2023 16:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774991; 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=LP4nQDpNy/evUFzrJ1tFCb0pkVZZ+TvRlr6tCVxCdl8=; b=T9satt5mSS80EZUXt1pekXv268qwpZHJrXJ+udARmZN0DXmZ47Kywmj5N6rqoWQeXgIzGj +ed51YpyhS7eiis4AdPIQUXGw5QFFbzo4i7i+EcHJ+fPNyG6d9/cpOP2jBrcmxX5BXg2Tf G+Srh2cKjxP/ihHKl2+TYG6cjmsRnMk= X-MC-Unique: NtG2m1BZPsOp_cFQ5-iWig-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 42/43] migration: Create migrate_block_bitmap_mapping() function Date: Thu, 2 Mar 2023 17:34:09 +0100 Message-Id: <20230302163410.11399-43-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775379136100001 Content-Type: text/plain; charset="utf-8" Notice that we changed the test of ->has_block_bitmap_mapping for the test that block_bitmap_mapping is not NULL. Signed-off-by: Juan Quintela --- migration/options.h | 1 + migration/block-dirty-bitmap.c | 14 ++++++++------ migration/options.c | 7 +++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/migration/options.h b/migration/options.h index 3284f95312..698514cf76 100644 --- a/migration/options.h +++ b/migration/options.h @@ -64,6 +64,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp); =20 /* parameters */ =20 +BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void); bool migrate_block_incremental(void); uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index a6ffae0002..62b2352bbb 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -605,11 +605,12 @@ static int init_dirty_bitmap_migration(DBMSaveState *= s) SaveBitmapState *dbms; GHashTable *handled_by_blk =3D g_hash_table_new(NULL, NULL); BlockBackend *blk; - const MigrationParameters *mig_params =3D &migrate_get_current()->para= meters; GHashTable *alias_map =3D NULL; + BitmapMigrationNodeAliasList *block_bitmap_mapping =3D + migrate_block_bitmap_mapping(); =20 - if (mig_params->has_block_bitmap_mapping) { - alias_map =3D construct_alias_map(mig_params->block_bitmap_mapping= , true, + if (block_bitmap_mapping) { + alias_map =3D construct_alias_map(block_bitmap_mapping, true, &error_abort); } =20 @@ -1158,7 +1159,8 @@ static int dirty_bitmap_load_header(QEMUFile *f, DBML= oadState *s, static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) { GHashTable *alias_map =3D NULL; - const MigrationParameters *mig_params =3D &migrate_get_current()->para= meters; + BitmapMigrationNodeAliasList *block_bitmap_mapping =3D + migrate_block_bitmap_mapping(); DBMLoadState *s =3D &((DBMState *)opaque)->load; int ret =3D 0; =20 @@ -1170,8 +1172,8 @@ static int dirty_bitmap_load(QEMUFile *f, void *opaqu= e, int version_id) return -EINVAL; } =20 - if (mig_params->has_block_bitmap_mapping) { - alias_map =3D construct_alias_map(mig_params->block_bitmap_mapping, + if (block_bitmap_mapping) { + alias_map =3D construct_alias_map(block_bitmap_mapping, false, &error_abort); } =20 diff --git a/migration/options.c b/migration/options.c index 96d20a9cfc..e7f66cfc26 100644 --- a/migration/options.c +++ b/migration/options.c @@ -456,6 +456,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, =20 /* parameters */ =20 +BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.block_bitmap_mapping; +} + bool migrate_block_incremental(void) { MigrationState *s =3D migrate_get_current(); --=20 2.39.2 From nobody Sun Apr 28 22:54:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677775090; cv=none; d=zohomail.com; s=zohoarc; b=UWR2Ta2SM6U8MEFWN+Uby8Dv8aG06jqILUuu75hhrpzxFwN471Ete5Y5qKzfbVaxZLJ0AESqPp9xdPMW4kE1qvkeRM5Mbr9kxPgmSz0hqlYpVZhOcGmOb0BX0NML9+e2onBZBs4buG38HZb2DTXL/FktGh2l/kmcu8AZSaoJdZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677775090; 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=qGDJDGvYoAS5sYzA4QVueh5Hf/hO6bmc6hVYTJA//Jg=; b=DHb6AFXlLZDkwMpWkzL+JmUR0BMJbKAhgwPX1OkR8CVOhf3TH4LHniJ2C4edbfquG81lxvkPG4jAOsQquWRPC4cMmpgKm48LI9pdNb8jyhlUqSkRUk5fnf8zu6SZKAnF35p3HPhKiftHY9vyGOoJnE4nxOjoZVnjQA5R1qs1AcA= 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 1677775090639324.4372619126566; Thu, 2 Mar 2023 08:38:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXlvG-00034s-SD; Thu, 02 Mar 2023 11:36:51 -0500 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 1pXlv4-0002Wo-Ag for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:38 -0500 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 1pXlv1-0000ZZ-N6 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 11:36:37 -0500 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-113-L6Hoz2g_MEa3tHuRVsa0bw-1; Thu, 02 Mar 2023 11:36:29 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06FE8381078E; Thu, 2 Mar 2023 16:36:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id D13E4492C3E; Thu, 2 Mar 2023 16:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677774994; 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=qGDJDGvYoAS5sYzA4QVueh5Hf/hO6bmc6hVYTJA//Jg=; b=ZMvynbj766EzxarSM2tVWaoL7XnVHgrBV2aPMQKS8cSwzRSulhDUNdEAmHchAXbtpjnoq6 sR+ipHQ1KUf3HSoyx2W2l9GUVwCSJA7FNgFGgKLAaY+knu3oAmlaAGrm52PBs45tEe/qP3 icFGUfd/LCIBKaNHUtQ9DgG/u+WZSr4= X-MC-Unique: L6Hoz2g_MEa3tHuRVsa0bw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: David Hildenbrand , Vladimir Sementsov-Ogievskiy , John Snow , Stefan Hajnoczi , Juan Quintela , qemu-block@nongnu.org, Hailiang Zhang , Fam Zheng , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Eric Blake Subject: [PATCH 43/43] migration: Move migration_properties to options.c Date: Thu, 2 Mar 2023 17:34:10 +0100 Message-Id: <20230302163410.11399-44-quintela@redhat.com> In-Reply-To: <20230302163410.11399-1-quintela@redhat.com> References: <20230302163410.11399-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1677775092189100017 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.h | 7 ++ migration/migration.c | 155 ------------------------------------------ migration/options.c | 153 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 155 deletions(-) diff --git a/migration/options.h b/migration/options.h index 698514cf76..f5ce35c018 100644 --- a/migration/options.h +++ b/migration/options.h @@ -16,6 +16,9 @@ #ifndef QEMU_MIGRATION_OPTIONS_H #define QEMU_MIGRATION_OPTIONS_H =20 +#include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" + /* constants */ =20 /* Amount of time to allocate to each "chunk" of bandwidth-throttled @@ -23,6 +26,10 @@ #define BUFFER_DELAY 100 #define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) =20 +/* migration properties */ + +extern Property migration_properties[]; + /* capabilities */ =20 bool migrate_auto_converge(void); diff --git a/migration/migration.c b/migration/migration.c index 71fc360240..d94811a152 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -52,8 +52,6 @@ #include "io/channel-tls.h" #include "migration/colo.h" #include "hw/boards.h" -#include "hw/qdev-properties.h" -#include "hw/qdev-properties-system.h" #include "monitor/monitor.h" #include "net/announce.h" #include "qemu/queue.h" @@ -65,51 +63,6 @@ #include "sysemu/qtest.h" #include "options.h" =20 -#define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ - -/* Time in milliseconds we are allowed to stop the source, - * for sending the last part */ -#define DEFAULT_MIGRATE_SET_DOWNTIME 300 - -/* Default compression thread count */ -#define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 -/* Default decompression thread count, usually decompression is at - * least 4 times as fast as compression.*/ -#define DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT 2 -/*0: means nocompress, 1: best speed, ... 9: best compress ratio */ -#define DEFAULT_MIGRATE_COMPRESS_LEVEL 1 -/* Define default autoconverge cpu throttle migration parameters */ -#define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50 -#define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20 -#define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10 -#define DEFAULT_MIGRATE_MAX_CPU_THROTTLE 99 - -/* Migration XBZRLE default cache size */ -#define DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE (64 * 1024 * 1024) - -/* The delay time (in ms) between two COLO checkpoints */ -#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) -#define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2 -#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE -/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */ -#define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1 -/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */ -#define DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL 1 - -/* Background transfer rate for postcopy, 0 means unlimited, note - * that page requests can still exceed this limit. - */ -#define DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH 0 - -/* - * Parameters for self_announce_delay giving a stream of RARP/ARP - * packets after migration. - */ -#define DEFAULT_MIGRATE_ANNOUNCE_INITIAL 50 -#define DEFAULT_MIGRATE_ANNOUNCE_MAX 550 -#define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5 -#define DEFAULT_MIGRATE_ANNOUNCE_STEP 100 - static NotifierList migration_state_notifiers =3D NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); =20 @@ -3304,114 +3257,6 @@ void migrate_fd_connect(MigrationState *s, Error *e= rror_in) s->migration_thread_running =3D true; } =20 -#define DEFINE_PROP_MIG_CAP(name, x) \ - DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) - -static Property migration_properties[] =3D { - DEFINE_PROP_BOOL("store-global-state", MigrationState, - store_global_state, true), - DEFINE_PROP_BOOL("send-configuration", MigrationState, - send_configuration, true), - DEFINE_PROP_BOOL("send-section-footer", MigrationState, - send_section_footer, true), - DEFINE_PROP_BOOL("decompress-error-check", MigrationState, - decompress_error_check, true), - DEFINE_PROP_UINT8("x-clear-bitmap-shift", MigrationState, - clear_bitmap_shift, CLEAR_BITMAP_SHIFT_DEFAULT), - - /* Migration parameters */ - DEFINE_PROP_UINT8("x-compress-level", MigrationState, - parameters.compress_level, - DEFAULT_MIGRATE_COMPRESS_LEVEL), - DEFINE_PROP_UINT8("x-compress-threads", MigrationState, - parameters.compress_threads, - DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT), - DEFINE_PROP_BOOL("x-compress-wait-thread", MigrationState, - parameters.compress_wait_thread, true), - DEFINE_PROP_UINT8("x-decompress-threads", MigrationState, - parameters.decompress_threads, - DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT), - DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState, - parameters.throttle_trigger_threshold, - DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD), - DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState, - parameters.cpu_throttle_initial, - DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), - DEFINE_PROP_UINT8("x-cpu-throttle-increment", MigrationState, - parameters.cpu_throttle_increment, - DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT), - DEFINE_PROP_BOOL("x-cpu-throttle-tailslow", MigrationState, - parameters.cpu_throttle_tailslow, false), - DEFINE_PROP_SIZE("x-max-bandwidth", MigrationState, - parameters.max_bandwidth, MAX_THROTTLE), - DEFINE_PROP_UINT64("x-downtime-limit", MigrationState, - parameters.downtime_limit, - DEFAULT_MIGRATE_SET_DOWNTIME), - DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState, - parameters.x_checkpoint_delay, - DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), - DEFINE_PROP_UINT8("multifd-channels", MigrationState, - parameters.multifd_channels, - DEFAULT_MIGRATE_MULTIFD_CHANNELS), - DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression", MigrationState, - parameters.multifd_compression, - DEFAULT_MIGRATE_MULTIFD_COMPRESSION), - DEFINE_PROP_UINT8("multifd-zlib-level", MigrationState, - parameters.multifd_zlib_level, - DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL), - DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState, - parameters.multifd_zstd_level, - DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL), - DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, - parameters.xbzrle_cache_size, - DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), - DEFINE_PROP_SIZE("max-postcopy-bandwidth", MigrationState, - parameters.max_postcopy_bandwidth, - DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH), - DEFINE_PROP_UINT8("max-cpu-throttle", MigrationState, - parameters.max_cpu_throttle, - DEFAULT_MIGRATE_MAX_CPU_THROTTLE), - DEFINE_PROP_SIZE("announce-initial", MigrationState, - parameters.announce_initial, - DEFAULT_MIGRATE_ANNOUNCE_INITIAL), - DEFINE_PROP_SIZE("announce-max", MigrationState, - parameters.announce_max, - DEFAULT_MIGRATE_ANNOUNCE_MAX), - DEFINE_PROP_SIZE("announce-rounds", MigrationState, - parameters.announce_rounds, - DEFAULT_MIGRATE_ANNOUNCE_ROUNDS), - DEFINE_PROP_SIZE("announce-step", MigrationState, - parameters.announce_step, - DEFAULT_MIGRATE_ANNOUNCE_STEP), - DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), - DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), - DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), - - /* Migration capabilities */ - DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), - DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), - DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), - DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), - DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS), - DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), - DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), - DEFINE_PROP_MIG_CAP("x-postcopy-preempt", - MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), - DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), - DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), - DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK), - DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), - DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), - DEFINE_PROP_MIG_CAP("x-background-snapshot", - MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT), -#ifdef CONFIG_LINUX - DEFINE_PROP_MIG_CAP("x-zero-copy-send", - MIGRATION_CAPABILITY_ZERO_COPY_SEND), -#endif - - DEFINE_PROP_END_OF_LIST(), -}; - static void migration_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); diff --git a/migration/options.c b/migration/options.c index e7f66cfc26..ca4771cf1d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -33,6 +33,159 @@ #define MAX_MIGRATE_DOWNTIME_SECONDS 2000 #define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) =20 +#define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ + +/* Time in milliseconds we are allowed to stop the source, + * for sending the last part */ +#define DEFAULT_MIGRATE_SET_DOWNTIME 300 + +/* Default compression thread count */ +#define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 +/* Default decompression thread count, usually decompression is at + * least 4 times as fast as compression.*/ +#define DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT 2 +/*0: means nocompress, 1: best speed, ... 9: best compress ratio */ +#define DEFAULT_MIGRATE_COMPRESS_LEVEL 1 +/* Define default autoconverge cpu throttle migration parameters */ +#define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50 +#define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20 +#define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10 +#define DEFAULT_MIGRATE_MAX_CPU_THROTTLE 99 + +/* Migration XBZRLE default cache size */ +#define DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE (64 * 1024 * 1024) + +/* The delay time (in ms) between two COLO checkpoints */ +#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) +#define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2 +#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE +/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */ +#define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1 +/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */ +#define DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL 1 + +/* Background transfer rate for postcopy, 0 means unlimited, note + * that page requests can still exceed this limit. + */ +#define DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH 0 + +/* + * Parameters for self_announce_delay giving a stream of RARP/ARP + * packets after migration. + */ +#define DEFAULT_MIGRATE_ANNOUNCE_INITIAL 50 +#define DEFAULT_MIGRATE_ANNOUNCE_MAX 550 +#define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5 +#define DEFAULT_MIGRATE_ANNOUNCE_STEP 100 + +#define DEFINE_PROP_MIG_CAP(name, x) \ + DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) + +Property migration_properties[] =3D { + DEFINE_PROP_BOOL("store-global-state", MigrationState, + store_global_state, true), + DEFINE_PROP_BOOL("send-configuration", MigrationState, + send_configuration, true), + DEFINE_PROP_BOOL("send-section-footer", MigrationState, + send_section_footer, true), + DEFINE_PROP_BOOL("decompress-error-check", MigrationState, + decompress_error_check, true), + DEFINE_PROP_UINT8("x-clear-bitmap-shift", MigrationState, + clear_bitmap_shift, CLEAR_BITMAP_SHIFT_DEFAULT), + + /* Migration parameters */ + DEFINE_PROP_UINT8("x-compress-level", MigrationState, + parameters.compress_level, + DEFAULT_MIGRATE_COMPRESS_LEVEL), + DEFINE_PROP_UINT8("x-compress-threads", MigrationState, + parameters.compress_threads, + DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT), + DEFINE_PROP_BOOL("x-compress-wait-thread", MigrationState, + parameters.compress_wait_thread, true), + DEFINE_PROP_UINT8("x-decompress-threads", MigrationState, + parameters.decompress_threads, + DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT), + DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState, + parameters.throttle_trigger_threshold, + DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD), + DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState, + parameters.cpu_throttle_initial, + DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), + DEFINE_PROP_UINT8("x-cpu-throttle-increment", MigrationState, + parameters.cpu_throttle_increment, + DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT), + DEFINE_PROP_BOOL("x-cpu-throttle-tailslow", MigrationState, + parameters.cpu_throttle_tailslow, false), + DEFINE_PROP_SIZE("x-max-bandwidth", MigrationState, + parameters.max_bandwidth, MAX_THROTTLE), + DEFINE_PROP_UINT64("x-downtime-limit", MigrationState, + parameters.downtime_limit, + DEFAULT_MIGRATE_SET_DOWNTIME), + DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState, + parameters.x_checkpoint_delay, + DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), + DEFINE_PROP_UINT8("multifd-channels", MigrationState, + parameters.multifd_channels, + DEFAULT_MIGRATE_MULTIFD_CHANNELS), + DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression", MigrationState, + parameters.multifd_compression, + DEFAULT_MIGRATE_MULTIFD_COMPRESSION), + DEFINE_PROP_UINT8("multifd-zlib-level", MigrationState, + parameters.multifd_zlib_level, + DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL), + DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState, + parameters.multifd_zstd_level, + DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL), + DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, + parameters.xbzrle_cache_size, + DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), + DEFINE_PROP_SIZE("max-postcopy-bandwidth", MigrationState, + parameters.max_postcopy_bandwidth, + DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH), + DEFINE_PROP_UINT8("max-cpu-throttle", MigrationState, + parameters.max_cpu_throttle, + DEFAULT_MIGRATE_MAX_CPU_THROTTLE), + DEFINE_PROP_SIZE("announce-initial", MigrationState, + parameters.announce_initial, + DEFAULT_MIGRATE_ANNOUNCE_INITIAL), + DEFINE_PROP_SIZE("announce-max", MigrationState, + parameters.announce_max, + DEFAULT_MIGRATE_ANNOUNCE_MAX), + DEFINE_PROP_SIZE("announce-rounds", MigrationState, + parameters.announce_rounds, + DEFAULT_MIGRATE_ANNOUNCE_ROUNDS), + DEFINE_PROP_SIZE("announce-step", MigrationState, + parameters.announce_step, + DEFAULT_MIGRATE_ANNOUNCE_STEP), + DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), + DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), + DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + + /* Migration capabilities */ + DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), + DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), + DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), + DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), + DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS), + DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), + DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), + DEFINE_PROP_MIG_CAP("x-postcopy-preempt", + MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), + DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), + DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), + DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK), + DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), + DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), + DEFINE_PROP_MIG_CAP("x-background-snapshot", + MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT), +#ifdef CONFIG_LINUX + DEFINE_PROP_MIG_CAP("x-zero-copy-send", + MIGRATION_CAPABILITY_ZERO_COPY_SEND), +#endif + + DEFINE_PROP_END_OF_LIST(), +}; + bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); --=20 2.39.2