From nobody Mon Feb 9 12:29:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613735948; cv=none; d=zohomail.com; s=zohoarc; b=Mh2w4A7vn+IlgfeVWy1BUosgoIcbrkYHt+T5o1r9aF69sQnJ8FSg6bPX8Es6UQK0r77KgZl2l+Y/EES8wCceyYljx+CaHDVlYjdiBFyagheNbO6vpWbWj3LFvkY5YDPR/M/Aovqmo7xeutxYsdaLVjiWeaGzIY1rgsMdAzbAFt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613735948; h=Content-Type:Content-Transfer-Encoding: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=tiQdLLw5APzyhz42Js5lMHUktJOwEY2ldbJ/an5sQKs=; b=mcGOhr+QawDZhQwQycQX6/7mcNfLChVisTVCPZHnatWwcBLiT1R0tc5Ada4IYsnCvjliUkL8LCRP/ibSy7sNUqqtxK7yJ1rhRjMBs3Gwovdp/cRXxWrgW+6pRlKTJ+Gp3eEGz/x6pRuloUSNcy3FKvIzenNJ9pjn143KISb6riA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613735947643897.5229152553105; Fri, 19 Feb 2021 03:59:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-0YSJKeQ5NF21rI8bm41Ikg-1; Fri, 19 Feb 2021 06:59:04 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DA1B1083EA4; Fri, 19 Feb 2021 11:58:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B7F55C1BB; Fri, 19 Feb 2021 11:58:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1233D57DFF; Fri, 19 Feb 2021 11:58:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11JBwrOQ008384 for ; Fri, 19 Feb 2021 06:58:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id EB3FF6087C; Fri, 19 Feb 2021 11:58:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47D876085D for ; Fri, 19 Feb 2021 11:58:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613735946; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tiQdLLw5APzyhz42Js5lMHUktJOwEY2ldbJ/an5sQKs=; b=DqtCPCq9KT9t5bVHq+26OTLOTPXqQDE9XfGMDubxsJrHZjp83kd3U1s/PnXRsQeTqsVRK5 u3pzArjDI1hf03IGgGNJbMoW/0mBb6LXyPi0AwwpZ62RqPYdOC1AnfHhR0xRUyHnO4MZbk S3uvzWpC2EPxbqHzCDW2BfNPsy8rqBw= X-MC-Unique: 0YSJKeQ5NF21rI8bm41Ikg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 07/15] qemu: migration_params: Add infrastructure for 'dirty-bitmaps' migration feature Date: Fri, 19 Feb 2021 12:58:19 +0100 Message-Id: <59d990b504bb3611d833660866bf546c9e58acc0.1613735605.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add the migration capability flag and the propagation of the corresponding mapping configuration. The mapping will be produced from the bitmaps on disk depending on both sides of the migration and the necessity to perform merges. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration_params.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_migration_params.h | 5 +++++ 2 files changed, 34 insertions(+) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 510dad783a..e9b4601510 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -63,6 +63,7 @@ struct _qemuMigrationParams { unsigned long long compMethods; /* bit-wise OR of qemuMigrationCompres= sMethod */ virBitmapPtr caps; qemuMigrationParamValue params[QEMU_MIGRATION_PARAM_LAST]; + virJSONValuePtr blockDirtyBitmapMapping; }; typedef enum { @@ -89,6 +90,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability, "pause-before-switchover", "late-block-activate", "multifd", + "dirty-bitmaps", ); @@ -265,6 +267,7 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParam= s) } virBitmapFree(migParams->caps); + virJSONValueFree(migParams->blockDirtyBitmapMapping); g_free(migParams); } @@ -524,6 +527,20 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr= params, } +void +qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParamsPtr migPa= rams, + virJSONValuePtr *params) +{ + virJSONValueFree(migParams->blockDirtyBitmapMapping); + migParams->blockDirtyBitmapMapping =3D g_steal_pointer(params); + + if (migParams->blockDirtyBitmapMapping) + ignore_value(virBitmapSetBit(migParams->caps, QEMU_MIGRATION_CAP_B= LOCK_DIRTY_BITMAPS)); + else + ignore_value(virBitmapClearBit(migParams->caps, QEMU_MIGRATION_CAP= _BLOCK_DIRTY_BITMAPS)); +} + + qemuMigrationParamsPtr qemuMigrationParamsFromFlags(virTypedParameterPtr params, int nparams, @@ -747,6 +764,17 @@ qemuMigrationParamsToJSON(qemuMigrationParamsPtr migPa= rams) return NULL; } + if (migParams->blockDirtyBitmapMapping) { + g_autoptr(virJSONValue) mapping =3D virJSONValueCopy(migParams->bl= ockDirtyBitmapMapping); + + if (!mapping) + return NULL; + + if (virJSONValueObjectAppend(params, "block-bitmap-mapping", mappi= ng) < 0) + return NULL; + mapping =3D NULL; + } + return g_steal_pointer(¶ms); } @@ -1202,6 +1230,7 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver, goto cleanup; qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags= ); + /* We don't reset 'block-bitmap-mapping' as it can't be unset */ cleanup: virErrorRestore(&err); diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index 9876101bfc..f1db42ce94 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -39,6 +39,7 @@ typedef enum { QEMU_MIGRATION_CAP_PAUSE_BEFORE_SWITCHOVER, QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE, QEMU_MIGRATION_CAP_MULTIFD, + QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS, QEMU_MIGRATION_CAP_LAST } qemuMigrationCapability; @@ -132,6 +133,10 @@ qemuMigrationParamsGetULL(qemuMigrationParamsPtr migPa= rams, qemuMigrationParam param, unsigned long long *value); +void +qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParamsPtr migPa= rams, + virJSONValuePtr *params); + int qemuMigrationParamsCheck(virQEMUDriverPtr driver, virDomainObjPtr vm, --=20 2.29.2