From patchwork Thu Jun 16 10:19:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=EDG4zxN9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNz2C46HFz9sGC for ; Thu, 16 Jun 2022 20:29:54 +1000 (AEST) Received: from localhost ([::1]:52744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1ml4-00020B-FJ for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:29:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mcB-0006td-Pv for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:42 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:43840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mc6-0000Uw-UT for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:39 -0400 Received: by mail-lf1-x135.google.com with SMTP id be31so1485938lfb.10 for ; Thu, 16 Jun 2022 03:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7tNdbLBzRKOlUlgc8g7K1sMB89Nl+L+jwQpxvFRcsBc=; b=EDG4zxN9qhfGpAK//9RwU3Vl3VKXKvll0CMeVWfu0ojKceDM1dVi0V+lmijD8vXKO+ J2Sxgco9hspv4wwJ6JU1IEQdlwD8CtW2FsDCiHhBwn6HlKCYPH6a+7T2MZwtgDO4gBu6 vEaym+IG2L/x7sWqiBKrRKB+HuBvpkkV7gMD7foQbfi7sY5UP11mowJf8wwyYBG3fksp 6Cu5FS2R0bkfnsL45R/gF+r7vuut+fLoDCAuKrQvAWQ7L6+LycSA2KhyBIGPIN0gwHQC Z/m8C0hKj1uueeCQ6o/gSvgJ5PoaypjJbM+qDHFYbD7mS+ofSFhMmQNLYx4wEkqhA7sC SwfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7tNdbLBzRKOlUlgc8g7K1sMB89Nl+L+jwQpxvFRcsBc=; b=eSm7GlJeFb2vjOKWPEPiiW13StNJoYLB56OwsPXYL3hAejwBVNjFhyDDl5Td68XEeS y5Lmh8lVycYp4J5+E4XcGBg2vDu4YxSSHR40obqGeRytjV/VygMx/I2NXqiBAf1Rvoq6 xPGZMFB4aRHLBTHn0leOs6F6m832aof45E5OKEwgvUM1oLimUlrGm5oMXHCvnVY3Itt9 l7SBhJHx3DKGiP9x+gYmci0ahFODtjmz5xwiC3FEHyKSkGnp/tOo+GJrb8tmYgusmPjr COzt36jDJbM7b5e2nVaPeei99Ysk0b4RDXX7SC+gyuGbeCVATz/MMVGJL1mKzx2iu5LH Vfag== X-Gm-Message-State: AJIora8zx69w9E7F0trQ//+xH7kVPlJbEoPoRDzK7mFroPMCxBWUXzQC EcM6KUTxwLVsVQNykp6yNMY45EKC2jmufGIX X-Google-Smtp-Source: AGRyM1vGy234g8B7xZENdG21m9lq6kwoiEyO/Cz126iXRH8Q1H0G4hlmuQ1COTi4GyQ0uFFdrSHX2Q== X-Received: by 2002:a05:6512:3d8c:b0:479:51be:727f with SMTP id k12-20020a0565123d8c00b0047951be727fmr2279669lfv.289.1655374829657; Thu, 16 Jun 2022 03:20:29 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:29 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 1/8] migration: Implemented new parameter stream_content Date: Thu, 16 Jun 2022 13:19:57 +0300 Message-Id: <20220616102006.218693-2-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=nikita.lapshin@openvz.org; helo=mail-lf1-x135.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin This new optional parameter contains inormation about migration stream parts to be sent (such as RAM, block, bitmap). This looks better than using capabilities to solve problem of dividing migration stream. Signed-off-by: Nikita Lapshin --- migration/migration.c | 47 ++++++++++++++++++++++++++++++++++++++++++- migration/migration.h | 2 ++ qapi/migration.json | 21 ++++++++++++++++--- 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 695f0f2900..4adcc87d1d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1334,6 +1334,12 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, } } +static bool check_stream_parts(strList *stream_content_list) +{ + /* To be implemented in ext commits */ + return true; +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. @@ -1482,7 +1488,12 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp) return false; } - return true; + if (params->has_stream_content_list && + !check_stream_parts(params->stream_content_list)) { + error_setg(errp, "Invalid parts of stream given for stream-content"); + } + + return true; } static void migrate_params_test_apply(MigrateSetParameters *params, @@ -1581,6 +1592,11 @@ static void migrate_params_test_apply(MigrateSetParameters *params, dest->has_block_bitmap_mapping = true; dest->block_bitmap_mapping = params->block_bitmap_mapping; } + + if (params->has_stream_content_list) { + dest->has_stream_content_list = true; + dest->stream_content_list = params->stream_content_list; + } } static void migrate_params_apply(MigrateSetParameters *params, Error **errp) @@ -1703,6 +1719,13 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp) QAPI_CLONE(BitmapMigrationNodeAliasList, params->block_bitmap_mapping); } + + if (params->has_stream_content_list) { + qapi_free_strList(s->parameters.stream_content_list); + s->parameters.has_stream_content_list = true; + s->parameters.stream_content_list = + QAPI_CLONE(strList, params->stream_content_list); + } } void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) @@ -2620,6 +2643,28 @@ bool migrate_background_snapshot(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } +/* Checks if stream-content parameter has section_name in list */ +bool migrate_find_stream_content(const char *section_name) +{ + MigrationState *s; + + s = migrate_get_current(); + + if (!s->parameters.has_stream_content_list) { + return false; + } + + strList *list = s->parameters.stream_content_list; + + for (; list; list = list->next) { + if (!strcmp(list->value, section_name)) { + return true; + } + } + + return false; +} + /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 2de861df01..411c58e919 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -396,6 +396,8 @@ bool migrate_use_events(void); bool migrate_postcopy_blocktime(void); bool migrate_background_snapshot(void); +bool migrate_find_stream_content(const char *section_name); + /* 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/qapi/migration.json b/qapi/migration.json index 18e2610e88..80acf6dbc3 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -760,6 +760,12 @@ # block device name if there is one, and to their node name # otherwise. (Since 5.2) # +# @stream-content-list: Parameter control content of migration stream such as RAM, +# vmstate, block and dirty-bitmaps. This is optional parameter +# so migration will work correctly without it. +# This parameter takes string list as description of content +# and include that part of migration stream. (Since 7.0) +# # Features: # @unstable: Member @x-checkpoint-delay is experimental. # @@ -780,7 +786,8 @@ 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle', 'multifd-compression', 'multifd-zlib-level' ,'multifd-zstd-level', - 'block-bitmap-mapping' ] } + 'block-bitmap-mapping', + 'stream-content-list' ] } ## # @MigrateSetParameters: @@ -925,6 +932,12 @@ # block device name if there is one, and to their node name # otherwise. (Since 5.2) # +# @stream-content-list: Parameter control content of migration stream such as RAM, +# vmstate, block and dirty-bitmaps. This is optional parameter +# so migration will work correctly without it. +# This parameter takes string list as description of content +# and include that part of migration stream. (Since 7.0) +# # Features: # @unstable: Member @x-checkpoint-delay is experimental. # @@ -960,7 +973,8 @@ '*multifd-compression': 'MultiFDCompression', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } } + '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], + '*stream-content-list': [ 'str' ] } } ## # @migrate-set-parameters: @@ -1158,7 +1172,8 @@ '*multifd-compression': 'MultiFDCompression', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } } + '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], + '*stream-content-list': [ 'str' ] } } ## # @query-migrate-parameters: From patchwork Thu Jun 16 10:19:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644244 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=d1ueLu4v; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNyyS3Hdvz9sGC for ; Thu, 16 Jun 2022 20:26:40 +1000 (AEST) Received: from localhost ([::1]:44156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1mhy-0004N0-59 for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:26:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mc8-0006tJ-V0 for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:40 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]:40499) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mc6-0000V0-T4 for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:36 -0400 Received: by mail-lj1-x234.google.com with SMTP id y29so982421ljd.7 for ; Thu, 16 Jun 2022 03:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7IlllWalbol55jcjJ2c0idnBkF17iN1AJ6PBWM49+f8=; b=d1ueLu4vHjKhqc96du8l0lwkyW5A0nb7/Zx9VqTjux2/CzeDEKZRgCXvVP4TaLGUP9 qXkF90Ugq4+l/YG1Gt6Sj7bXJW+NsiUnTT3sJX/HIKnIfSJFFTE5dMWTCXA8DAdLXKOt LAMNAUGbgY0iQINYD966Vkgvu8w3emm8dcORi1PGLQ60J94RvbE9fxHtdqYYwnkiy1pE aq0P1iyqAURjieobaA2NFmTEhW0E7n0kkZrGsjYONLJwMHcCRTU4V3oOShxMI3+JLduh ceoZj8aZ9A1mI5JC5O1hawyWTM/v6Q5mNA97uE+dqH3ePKmLevaoajFjt1ppEZbNr/8i 4oAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7IlllWalbol55jcjJ2c0idnBkF17iN1AJ6PBWM49+f8=; b=Be4+XHvtcbtwZaHfHGOcdrN+n7PnfjgQVmpXO9qexerDIsYBWLDTsFPLQgFtQ01GiO 5j29YEIwv3MFmdoK+dZWgLcF1wmjc3XGXkngdabbgJtOOzBBKZclmHd7mANZ8i/tbiiV wH8wQ5dWBUXDnZzn8ssIpUCrLRyfFyPty6dwD9HdsK9NvMU/Icjx/89f5CO+aL24C8/O Fm7xhFVc5cZG85KWssQv3CWUwT73ZvxiD+Psl1ZTjmORxbsTHcYec+GtRixbvs11TMzO oOfoMTYUCXCI3Pl1PwqjTIn2e7BuXUs/lKcqbQzk0HXfLjwsUvh0OalO6dBGIFa9Od0C qikQ== X-Gm-Message-State: AJIora8hstHzaE/QMngZ849IOftnySMwXv28JGNFFLIE2YCYbqjVHCP+ +OGHuolxpLCJcvKEeKGx8nB61PnQ3zSOAmQm X-Google-Smtp-Source: AGRyM1vYWtExQ4i0WLxTDMIUrvqt6SfpDwnWW1E1Mw0d7qH01djkpzCdAbgKU4D/Godm2saL2LeJqA== X-Received: by 2002:a2e:9e04:0:b0:255:a211:f440 with SMTP id e4-20020a2e9e04000000b00255a211f440mr2107701ljk.159.1655374830588; Thu, 16 Jun 2022 03:20:30 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:30 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 2/8] migration: should_skip() implemented Date: Thu, 16 Jun 2022 13:19:58 +0300 Message-Id: <20220616102006.218693-3-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=nikita.lapshin@openvz.org; helo=mail-lj1-x234.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin For next changes it is convenient to make all decisions about sections skipping in one function. Signed-off-by: Nikita Lapshin --- migration/savevm.c | 54 ++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 02ed94c180..c68f187ef7 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -943,6 +943,15 @@ static int vmstate_save(QEMUFile *f, SaveStateEntry *se, return vmstate_save_state(f, se->vmsd, se->opaque, vmdesc); } +static bool should_skip(SaveStateEntry *se) +{ + if (se->ops && se->ops->is_active && !se->ops->is_active(se->opaque)) { + return true; + } + + return false; +} + /* * Write the header for device section (QEMU_VM_SECTION START/END/PART/FULL) */ @@ -1207,10 +1216,8 @@ void qemu_savevm_state_setup(QEMUFile *f) if (!se->ops || !se->ops->save_setup) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (should_skip(se)) { + continue; } save_section_header(f, se, QEMU_VM_SECTION_START); @@ -1238,10 +1245,8 @@ int qemu_savevm_state_resume_prepare(MigrationState *s) if (!se->ops || !se->ops->resume_prepare) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (should_skip(se)) { + continue; } ret = se->ops->resume_prepare(s, se->opaque); if (ret < 0) { @@ -1268,8 +1273,7 @@ int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy) if (!se->ops || !se->ops->save_live_iterate) { continue; } - if (se->ops->is_active && - !se->ops->is_active(se->opaque)) { + if (should_skip(se)) { continue; } if (se->ops->is_active_iterate && @@ -1337,10 +1341,8 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f) if (!se->ops || !se->ops->save_live_complete_postcopy) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (should_skip(se)) { + continue; } trace_savevm_section_start(se->idstr, se->section_id); /* Section type */ @@ -1374,10 +1376,8 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy) continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (should_skip(se)) { + continue; } trace_savevm_section_start(se->idstr, se->section_id); @@ -1417,6 +1417,9 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, trace_savevm_section_skip(se->idstr, se->section_id); continue; } + if (should_skip(se)) { + continue; + } trace_savevm_section_start(se->idstr, se->section_id); @@ -1522,10 +1525,8 @@ void qemu_savevm_state_pending(QEMUFile *f, uint64_t threshold_size, if (!se->ops || !se->ops->save_live_pending) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (should_skip(se)) { + continue; } se->ops->save_live_pending(f, se->opaque, threshold_size, res_precopy_only, res_compatible, @@ -1635,6 +1636,9 @@ int qemu_save_device_state(QEMUFile *f) if (se->vmsd && !vmstate_save_needed(se->vmsd, se->opaque)) { continue; } + if (should_skip(se)) { + continue; + } save_section_header(f, se, QEMU_VM_SECTION_FULL); @@ -2542,10 +2546,8 @@ static int qemu_loadvm_state_setup(QEMUFile *f) if (!se->ops || !se->ops->load_setup) { continue; } - if (se->ops->is_active) { - if (!se->ops->is_active(se->opaque)) { - continue; - } + if (should_skip(se)) { + continue; } ret = se->ops->load_setup(f, se->opaque); From patchwork Thu Jun 16 10:19:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=U0NWxVVK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNysg2Lgdz9sGC for ; Thu, 16 Jun 2022 20:22:29 +1000 (AEST) Received: from localhost ([::1]:35588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1mdu-0006zF-9x for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:22:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mcA-0006tP-US for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:40 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]:43835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mc6-0000VK-UQ for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:38 -0400 Received: by mail-lf1-x12f.google.com with SMTP id be31so1486052lfb.10 for ; Thu, 16 Jun 2022 03:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tr3zUpzB0GffCzKr/MY5AoUXPXUzW4B6SXMURDobjpE=; b=U0NWxVVKjQBoPz+U1nhbBAWAlbVcmUNMRrBQWLIx8M9RXS3oZYWWuo5kftYCFymu3H Jy5bnJRjAXipQmCNhvWquLbxY/Vynbwlf6xBIDWzs0evOeimPRZEATDHvxfqrzi9Tlbi a16LwCO9eKoHQPF6B2drsv297aj1zoL3EuXoMo3YvPd9SuW1VfdWPZNcUups+2fgh+UL IfQe83hDiH/fI3FL6wvsGzyL5MVa0zUoEZKOuMAfJQB1NcmUo+D0mOGiFwCvDOC3+0sm y5k7pDt1ZMyz9G50f/vFZybdTjZO+AljtwGQMF9H56P+GpOuWIQURJx3jussltI6Jj6E i6BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tr3zUpzB0GffCzKr/MY5AoUXPXUzW4B6SXMURDobjpE=; b=El4yiIuNRQfqSY6Frmup7/7Dn7JuiDzxn6SlSvpKovQnVjiRNNbeFfNfsnDWSxBHqT OKMuERZMToT/52vfq9mok2fIa3pkkiAP8E6NCXKpOKKnKdy6/0FH4DkdOc/4f/4eGjOx ePT8gti3dD/D9j5GY31VByLaHpK5F/KuJRosYXCH7KG7r9M24KM6wTNvMoXuI/bxXoLC olPbWYk+8PObLPeTM6k2BaQeg/u0hjlxEQTiBmKDcArRRnuJcO3SUPBYVFRwAPPGwD5A UPiKNSbMI0fJJZy6uRQIpjIKMDSknDSES2C1pSIqguGfpLMVBdiWUxsGgCE70n47Xzgq nThQ== X-Gm-Message-State: AJIora+B3oVT/TAca6Nu1frr2+nGyh3Edzs9M8RtGzrkj4PMPvdMlkPt Qxz5z/iatldHHpnh2ccYl7O4Y4IN8A5WEUW2 X-Google-Smtp-Source: AGRyM1tu88visg4C6vHFU1mFFkzmNTbetIJpJGUGjTzul/o2I/22JdjmICAkl8i0CqrR63JnrsJflw== X-Received: by 2002:a05:6512:3132:b0:478:f2f1:3a75 with SMTP id p18-20020a056512313200b00478f2f13a75mr2358432lfd.100.1655374831623; Thu, 16 Jun 2022 03:20:31 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:31 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 3/8] migration: Add vmstate part of migration stream Date: Thu, 16 Jun 2022 13:19:59 +0300 Message-Id: <20220616102006.218693-4-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=nikita.lapshin@openvz.org; helo=mail-lf1-x12f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin Now we can disable and enable vmstate part by stream_content parameter. Signed-off-by: Nikita Lapshin --- migration/migration.c | 10 ++++++++-- migration/savevm.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4adcc87d1d..bbf9b6aad1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1334,9 +1334,15 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, } } -static bool check_stream_parts(strList *stream_content_list) +static bool check_stream_parts(strList *stream_list) { - /* To be implemented in ext commits */ + for (; stream_list; stream_list = stream_list->next) { + if (!strcmp(stream_list->value, "vmstate")) { + continue; + } + + return false; + } return true; } diff --git a/migration/savevm.c b/migration/savevm.c index c68f187ef7..48603517ba 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -949,6 +949,21 @@ static bool should_skip(SaveStateEntry *se) return true; } + /* + * Assume that any SaveStateEntry with non-null vmsd is + * part of vmstate. + * + * + * Vmstate is included by default so firstly check if + * stream-content-list is enabled. + */ + + if (se->vmsd && + migrate_get_current()->parameters.has_stream_content_list && + !migrate_find_stream_content("vmstate")) { + return true; + } + return false; } From patchwork Thu Jun 16 10:20:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644242 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=gpM64A8e; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNytX6hpTz9sGC for ; Thu, 16 Jun 2022 20:23:16 +1000 (AEST) Received: from localhost ([::1]:37380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1meg-0008Gv-MA for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:23:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mcA-0006tQ-Uv for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:40 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:36464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mc7-0000Vd-B4 for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:38 -0400 Received: by mail-lj1-x232.google.com with SMTP id h23so990848ljl.3 for ; Thu, 16 Jun 2022 03:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lUdRuVSrMtGHmkbRHa9MrI5I5UiON+MjCIoGMZGrKdw=; b=gpM64A8e5Csd2v8jCnvKoGx/43qY3q0OrImguqL0gqa6SqrUwJuVdo+QIKnRpYIYX9 wpKCOeRzBMb4omyvoU5BPUbGqfjXJ4dyQeejuOQQu29taZyQ0AuMyNhNUc2/WRli3zNL TWQTUG8ORjdDh3cXbcjSZdp0VByyhGv1129/0DdG1dhnR0JLKui5uTeufN2t5GnkYopb wTHl1thJwx225SQPUZq9npUuH2Zh7w65Ousv90gQ/V8iI+fV+3SRcMY2fXXEMAC8LDB/ 9g9etqcWRC2z0ceUJ3v2GmiCYYJsLWh32wNBkKwdKSYsn/Ttzw1KTMgpRR6di6PS26NM CQtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lUdRuVSrMtGHmkbRHa9MrI5I5UiON+MjCIoGMZGrKdw=; b=LjZ1Myexr8he4vN1fegiHy8gHKzryNToT9aQSt/MHFhe3GYWpmbjDhvCLcAnBf2OI7 aP9c5SWRGOB3GZUp3BeQDllVo+5AKMKXCKm1ka7agGXL5Np4TYgc0u4pI2CacLOS8ZZJ qs9+nYi/E3VqSx3spPpXFrHDB/G9ztsHoih0l4n7UigW8dY3jkJ+JPtD7UJO9mgIYWaJ 6BDKc0wpcKHOC3h/RJyFQoteg8ByeNRQK7ShDfNQe75lBxGVaACasK2DxL7kSzt8gW0d PcDaiSf2yN/iqSYObMixtYcQidhReCuWNS1XA6dt/jHTYMN5MbakRej2qonIlkMDEquE M1pw== X-Gm-Message-State: AJIora9LgxkAggUy7gXi+7DnPLAAzTqx4+XJzQhlPMCMljR5an204Cv+ Esk787H3iZ4IIDAJaugTib9t21ilhdobh7pn X-Google-Smtp-Source: AGRyM1u1G+xK70+beRmkuHo0LKIMS9fdIDCpTBAWGqltKtMTl/CJ5nX8mcSMXVKWulRoaxRhZ6mh4g== X-Received: by 2002:a2e:bf12:0:b0:25a:45d7:4b95 with SMTP id c18-20020a2ebf12000000b0025a45d74b95mr2138493ljr.394.1655374833556; Thu, 16 Jun 2022 03:20:33 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:33 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 4/8] migration: Add dirty-bitmaps part of migration stream Date: Thu, 16 Jun 2022 13:20:01 +0300 Message-Id: <20220616102006.218693-6-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=nikita.lapshin@openvz.org; helo=mail-lj1-x232.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin This patch enables and disable dirty-bitmaps in migration stream. Signed-off-by: Nikita Lapshin --- migration/migration.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index bbf9b6aad1..ad789915ce 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1337,7 +1337,8 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, static bool check_stream_parts(strList *stream_list) { for (; stream_list; stream_list = stream_list->next) { - if (!strcmp(stream_list->value, "vmstate")) { + if (!strcmp(stream_list->value, "vmstate") || + !strcmp(stream_list->value, "dirty-bitmaps")) { continue; } @@ -2501,7 +2502,8 @@ bool migrate_dirty_bitmaps(void) s = migrate_get_current(); - return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; + return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS] || + migrate_find_stream_content("dirty-bitmaps"); } bool migrate_ignore_shared(void) From patchwork Thu Jun 16 10:20:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=04KQLJzf; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNz4p1fwkz9sGC for ; Thu, 16 Jun 2022 20:32:10 +1000 (AEST) Received: from localhost ([::1]:54350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1mnG-00036u-HG for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:32:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mcB-0006tc-PN for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:42 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:35579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mc8-0000Vh-JN for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:39 -0400 Received: by mail-lf1-x12e.google.com with SMTP id a29so1524045lfk.2 for ; Thu, 16 Jun 2022 03:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DSeTt1QB5HDWqFVTnSya2l9lA2ROxRGP0qePz5aGaP4=; b=04KQLJzfvPdl1NFUTxrhTPGCKAl+hCl8PEbKit9sDGYkZDwzwOGrveMnqfKb5by2iR IUD/0Dx4lUNzrF/lKX0SAhYi1rhDLmywwA4CPZ7BtbEEl3nQ2/DbHbcFRoIMx0Bp/Vnw VtaE2NtkF4ingopjDcnC33/6B21xcBLJz5BPso8iQVl0YdqGYh2uFkn0uxklIieFboKv 3911eNVF8DTr3IFJQhxaM2JXFZBiz4mTZXQrACh1PwujLTYREP9vSMbHXJ7OPu+41BFv NzWtwePJuFVjE4ZthKSwP536Ab/neGUuO4cdSlFnRLSZ3eCNiro2C8SWJ3e6jeds6eUf Jabg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DSeTt1QB5HDWqFVTnSya2l9lA2ROxRGP0qePz5aGaP4=; b=Bn2CiSxJnYCXKHY9c78WOYVCn6pdQZXQ07cqal3tKdHHadOWZpptNTgl1H92mk4LtX OE8gp3xCehZDXi2UJ3tyFu2bnuXX/kQqOuM2SsDMJe3Fs71V74XXHr03wSAol2qm0+rE PbR9PHsw+ULZPiNDUtGN3U4nInBRxwRgBUNhbIlNhxznQRAnLXnX7AgO5hX8V1hac/s9 rpdRZhggD1uHpf+fMG2XScZQkpQPLQOvx84tcrnL0hljoWZ5SqSyrEy8HnSL7tR9ceHz CJCdpzZWwnFy1mqlk22bg2/dr8EGO9Lr9BpCx/vZw1i28jNaJWhDS/hsaQ+rRY7r29gM qlFQ== X-Gm-Message-State: AJIora/rTxpEpJLTSM6gMKbGNDOMYlws7+61DiRrljtUqumnC5IZfQPt plSWXP3LNvb6KUYHPMIUU1ZYzYERID27oJCN X-Google-Smtp-Source: AGRyM1tX5xpyOFwovXDqMFVJx7uo9WPnTbzSFNCXv3dgKvUPkq4G99kr/CNQTjnszWdNdotwfn5dDw== X-Received: by 2002:a05:6512:2088:b0:47d:a3ac:3512 with SMTP id t8-20020a056512208800b0047da3ac3512mr2212261lfr.108.1655374834437; Thu, 16 Jun 2022 03:20:34 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:34 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 5/8] Add block part of migration stream Date: Thu, 16 Jun 2022 13:20:02 +0300 Message-Id: <20220616102006.218693-7-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=nikita.lapshin@openvz.org; helo=mail-lf1-x12e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin This patch enables and disable block in migration stream. Signed-off-by: Nikita Lapshin --- migration/migration.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ad789915ce..d81f3c6891 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1338,7 +1338,8 @@ static bool check_stream_parts(strList *stream_list) { for (; stream_list; stream_list = stream_list->next) { if (!strcmp(stream_list->value, "vmstate") || - !strcmp(stream_list->value, "dirty-bitmaps")) { + !strcmp(stream_list->value, "dirty-bitmaps") || + !strcmp(stream_list->value, "block")) { continue; } @@ -2621,7 +2622,8 @@ bool migrate_use_block(void) s = migrate_get_current(); - return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK]; + return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK] || + migrate_find_stream_content("block"); } bool migrate_use_return_path(void) From patchwork Thu Jun 16 10:20:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=rCfEZ327; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNyyW0Fh5z9sGC for ; Thu, 16 Jun 2022 20:26:43 +1000 (AEST) Received: from localhost ([::1]:44218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1mi0-0004Pf-Q2 for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:26:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mcD-0006vP-0b for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:42 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]:41823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mcB-0000WA-CS for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:40 -0400 Received: by mail-lj1-x233.google.com with SMTP id v8so976442ljj.8 for ; Thu, 16 Jun 2022 03:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oK8v0UyddkjpSuECXSazJBzWB9ix/qZIBfYgHUOu/4I=; b=rCfEZ327dMhx8oWkONbU4XJoJgsLbPnFeNhV/yutpsj2gEinqpAlisMzDZ4c1wWb94 CD/Gaaj1+GEgDTA+gxr8lhSXhiaTupVAVUozIA/w68ADIfPmLJ+YRxCoy57xlLF0Dy6w N2EyxGHph00L050ol1HnGtd4YnX205omJHXlAYsS4gkTKXqaa2hGmWQnIK5hxjjBgIMm 9X/oO4gW5gigRwO29fCBqy5FHlKxvZ69BasBPeLZRlPPo6P4L3SY6bdI4UaAJwUTtyqM Kf4gOivevbReQJbbY2jTChtovSTFuIbkXDsedS86EaU7VCYrlATijQrmm8jlE95+lzVD 6bTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oK8v0UyddkjpSuECXSazJBzWB9ix/qZIBfYgHUOu/4I=; b=sDi1MUBnleO157Ytr/imjH5i90IoLFrxznUSoeAg76+4pDylld/tNX/7wgvDxCu1M0 opJ3GXEqF5ADS6mZqtjEJp2rlLs0xTdXWUd1kSkoDn2al4XDsX1msGG0ncjtAEfzmvUg 5iZz9ZZwi4NYJsE3IKPxKJin+gQ4Ps9SCfimUMqZEzfPjy9la6Dc85xW3jg4T2g8b+Jt cjn8Q4fJMJTEoMQqsG83y1442nBK8n4pJmRrwUg6tg66ArjuXiLtSqVadS15cHTPM9Gc sguXGlPJCJ5nColo6o6E/CmHMugoXCIU1bIzzYxtq80IfsedBRTjcxuv+wxUJh673dab Az8w== X-Gm-Message-State: AJIora9Kv4O6NERi4kXCDuagn6u6LcVr3/d90iaIgXRC4K8mP3V9F9BT lTtaZST7G1ibGfy6W90aZHL2DrXI+nMg9c9s X-Google-Smtp-Source: AGRyM1vN+kN5Ulal7y4L1Hlshu1CbR2GJoTpIQAtYaX2wzj02btI/Ub8PTQ34CfTzY0hVmQiW7d1kw== X-Received: by 2002:a2e:908b:0:b0:255:68b4:4085 with SMTP id l11-20020a2e908b000000b0025568b44085mr2067707ljg.369.1655374836856; Thu, 16 Jun 2022 03:20:36 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:36 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 6/8] migration: Add RAM part of migration stream Date: Thu, 16 Jun 2022 13:20:04 +0300 Message-Id: <20220616102006.218693-9-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=nikita.lapshin@openvz.org; helo=mail-lj1-x233.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin 'ram' parameter enable RAM sections in migration stream. If it isn't specified it will be skipped. Signed-off-by: Nikita Lapshin --- migration/migration.c | 17 ++++++++++++++++- migration/migration.h | 1 + migration/ram.c | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index d81f3c6891..6528b3ad41 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1339,7 +1339,8 @@ static bool check_stream_parts(strList *stream_list) for (; stream_list; stream_list = stream_list->next) { if (!strcmp(stream_list->value, "vmstate") || !strcmp(stream_list->value, "dirty-bitmaps") || - !strcmp(stream_list->value, "block")) { + !strcmp(stream_list->value, "block") || + !strcmp(stream_list->value, "ram")) { continue; } @@ -2653,6 +2654,20 @@ bool migrate_background_snapshot(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } +bool migrate_ram(void) +{ + MigrationState *s; + + s = migrate_get_current(); + + /* + * By default RAM is enabled so if stream-content-list disabled + * RAM will be passed. + */ + return !s->parameters.has_stream_content_list || + migrate_find_stream_content("ram"); +} + /* Checks if stream-content parameter has section_name in list */ bool migrate_find_stream_content(const char *section_name) { diff --git a/migration/migration.h b/migration/migration.h index 411c58e919..5c43788a2b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -395,6 +395,7 @@ int migrate_decompress_threads(void); bool migrate_use_events(void); bool migrate_postcopy_blocktime(void); bool migrate_background_snapshot(void); +bool migrate_ram(void); bool migrate_find_stream_content(const char *section_name); diff --git a/migration/ram.c b/migration/ram.c index 170e522a1f..ddc7abd08a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4263,6 +4263,11 @@ static int ram_resume_prepare(MigrationState *s, void *opaque) return 0; } +static bool is_ram_active(void *opaque) +{ + return migrate_ram(); +} + static SaveVMHandlers savevm_ram_handlers = { .save_setup = ram_save_setup, .save_live_iterate = ram_save_iterate, @@ -4275,6 +4280,7 @@ static SaveVMHandlers savevm_ram_handlers = { .load_setup = ram_load_setup, .load_cleanup = ram_load_cleanup, .resume_prepare = ram_resume_prepare, + .is_active = is_ram_active, }; static void ram_mig_ram_block_resized(RAMBlockNotifier *n, void *host, From patchwork Thu Jun 16 10:20:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita X-Patchwork-Id: 1644251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=openvz-org.20210112.gappssmtp.com header.i=@openvz-org.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=i4h78/bO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNz8z6m5Bz9sGC for ; Thu, 16 Jun 2022 20:35:46 +1000 (AEST) Received: from localhost ([::1]:33154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1mql-00089R-0C for incoming@patchwork.ozlabs.org; Thu, 16 Jun 2022 06:35:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mcD-0006vS-LU for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:42 -0400 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:36464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mcB-0000Vd-RJ for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:20:41 -0400 Received: by mail-lj1-x232.google.com with SMTP id h23so990848ljl.3 for ; Thu, 16 Jun 2022 03:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7QiRPB+DwgPdQ5tbpC7RSf9cTa8Nua9jBz5J8RJizgs=; b=i4h78/bO4m+3cRgWpeMpcAk3PJk30omzF5vhIuhmogS03MKng4TBOcDx9cSRwtxslI CKV0zVvSv1WRijYI2qcTby3OZW2vN6tAXzuPKmk4YLCl6Kko2nVfc0DyK2PwZT6BDpyz hzimkwv8kGcga4hg16OTOWxiTQyJOLTJ8pvo76RxdaFi/T8+p9dIk516Pm+26mrG02Ai GuKdV0PS5noIx86dftB7uk5dsNBqVi7ZMeho29bcxKlcZ7xV1J0/JlWdB6zKAay5wIKZ 2EA7CDmh+CCeZ5N9hP59DGbQsrdgaxTtmDyTHvFHM16RXZWdE4GSHeD4BhYru6dWLbij 7ydg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7QiRPB+DwgPdQ5tbpC7RSf9cTa8Nua9jBz5J8RJizgs=; b=nTcNyRRXvS/1YyRT/TDnlEOBVZCEDXNyw8Cd+6joNp5lo2wropB1lDoq5Fl2pezMg7 EyZh/VGVaQPvQjlHWIEVf/oWwKFsexBGBEu7+Qv+ZB/z0nzvLTNLUSIte9XsaU89L55+ aD+zicEAee2Pa8KGJHUw5s6aZFMCoJYRif6Bjm5AxXs8HJDsQF7k+b4VlEpOCaeqa2Y/ 545BNnkRnRobwcaDfn+pHf9ZCRSRcgeFjNSJuk9Apz5Qg6H8xQ4UBU2222ALUvVlCRAk yG2izK73SVmWESXub0XBY6joiMRm2HioClYSrWs6AASZHZ5M2xCMrBNFSnbWuw/3XyYI V6NA== X-Gm-Message-State: AJIora/WBXeVVNSpGWdhVnVvv7IAY0+ZsWV/U2EIBX+RiGZCKkscK9NR 0atDTQ/n3dmrQXXPPKFL56PbVp2Rjxs7hJwV X-Google-Smtp-Source: AGRyM1s4f45CqSWA3tNwbhgLaW3S6A7OjNFO8wKcZQ9kGoKqnM9pVaGzt5GPHE80XOkMW27x55JWJQ== X-Received: by 2002:a2e:818e:0:b0:25a:4363:78b2 with SMTP id e14-20020a2e818e000000b0025a436378b2mr2093647ljg.31.1655374838629; Thu, 16 Jun 2022 03:20:38 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id q17-20020a05651232b100b0047255d21166sm179014lfe.149.2022.06.16.03.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:20:38 -0700 (PDT) From: nikita.lapshin@openvz.org To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, andrey.drobyshev@virtuozzo.com, quintela@redhat.com, dgilbert@redhat.com, nikita.lapshin@openvz.org Subject: [PATCH 8/8] migration: Test for RAM and vmstate parts Date: Thu, 16 Jun 2022 13:20:06 +0300 Message-Id: <20220616102006.218693-11-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102006.218693-1-nikita.lapshin@openvz.org> References: <20220616102006.218693-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::232; envelope-from=nikita.lapshin@openvz.org; helo=mail-lj1-x232.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Nikita Lapshin All other parts works just like existed capabilities. Thus there is no need to make new tests. Though RAM and vmstate are new so here is new test for that parts. Signed-off-by: Nikita Lapshin --- .../tests/migrate-ram-stream-content-test | 96 +++++++++++++++++++ .../tests/migrate-ram-stream-content-test.out | 5 + 2 files changed, 101 insertions(+) create mode 100755 tests/qemu-iotests/tests/migrate-ram-stream-content-test create mode 100644 tests/qemu-iotests/tests/migrate-ram-stream-content-test.out diff --git a/tests/qemu-iotests/tests/migrate-ram-stream-content-test b/tests/qemu-iotests/tests/migrate-ram-stream-content-test new file mode 100755 index 0000000000..2855ca4a64 --- /dev/null +++ b/tests/qemu-iotests/tests/migrate-ram-stream-content-test @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +# group: rw migration +# +# Tests for 'no-ram' and 'ram-only' capabilities +# +# Copyright (c) 2021 Virtuozzo International GmbH. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import os +import json +import subprocess +import iotests + +img = os.path.join(iotests.test_dir, 'disk.img') + +class TestRamCapabilities(iotests.QMPTestCase): + def setUp(self): + iotests.qemu_img('create', '-f', iotests.imgfmt, img, '10M') + self.vm = iotests.VM() + self.vm.launch() + self.vm.qmp('migrate-set-capabilities', capabilities=[ + { + 'capability': 'events', + 'state': True + } + ]) + + def tearDown(self): + self.vm.shutdown() + os.remove(img) + + def check_ram_only(self, output): + str_json = output.decode() + json_obj = json.loads(str_json) + + success = False + for key in json_obj: + self.assertTrue("ram" in key) + success = True + self.assertTrue(success) + + def run_migration(self, no_ram, tmp_stream): + if no_ram: + output = self.vm.qmp('migrate-set-parameters', + stream_content_list = ['vmstate']) + else: + self.vm.qmp('migrate-set-parameters', + stream_content_list = ['ram']) + + self.vm.qmp('migrate', uri='exec:cat>' + tmp_stream) + + while True: + event = self.vm.event_wait('MIGRATION') + + if event['data']['status'] == 'completed': + break + + + def test_no_ram(self): + with iotests.FilePath('tmp_stream') as tmp_stream: + self.run_migration(True, tmp_stream) + output = subprocess.run( + ['../../../scripts/analyze-migration.py', '-f', tmp_stream], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False).stdout + + self.assertFalse('ram' in output.decode()) + + def test_ram_only(self): + with iotests.FilePath('tmp_stream') as tmp_stream: + self.run_migration(False, tmp_stream) + output = subprocess.run( + ['../../../scripts/analyze-migration.py', '-f', tmp_stream, + '--ram-only'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + check=False).stdout + + self.check_ram_only(output) + +if __name__ == '__main__': + iotests.main(supported_protocols=['file']) diff --git a/tests/qemu-iotests/tests/migrate-ram-stream-content-test.out b/tests/qemu-iotests/tests/migrate-ram-stream-content-test.out new file mode 100644 index 0000000000..fbc63e62f8 --- /dev/null +++ b/tests/qemu-iotests/tests/migrate-ram-stream-content-test.out @@ -0,0 +1,5 @@ +.. +---------------------------------------------------------------------- +Ran 2 tests + +OK