From nobody Tue Feb 10 09:10:50 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=openvz.org ARC-Seal: i=1; a=rsa-sha256; t=1655376494; cv=none; d=zohomail.com; s=zohoarc; b=kBwFONaP9m1EEMKGMP6n/nDN57BjOT1XenbwCnejUKrfBhDFKbhFLM6HawjQ7tgCvX1m+i6uuLO245SX7cXxP9Vgy2JhHohPtt6e3yH6V61JK9zI+Y7QKPrbLmUiObsZSdXEGPN0baXizvOakJY4J2rCTbI6HIwcQ7dE8iccyrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655376494; 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=7IlllWalbol55jcjJ2c0idnBkF17iN1AJ6PBWM49+f8=; b=HliYlesYiyTGPFq7C43riPl8x1L1gYDsr1H6Wx1WzkoPNKGLWXT2Rg9kwr3sVv0G6T0PHp3Uv57dUqA9LQadNUzoqahx38aCI1KlJT2BpbrLm//KLgDpctheF5M/6eOrNA8uq3K09InTq48YQRR6Ewfir6rvApvvlNCOj8HOseI= 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=fail 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 1655376494933943.4434167168612; Thu, 16 Jun 2022 03:48:14 -0700 (PDT) Received: from localhost ([::1]:55586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1n2r-0007Bq-RQ for importer@patchew.org; Thu, 16 Jun 2022 06:48:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1mjd-0001b6-OU for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:28:22 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:42589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1mjb-0001ss-Ld for qemu-devel@nongnu.org; Thu, 16 Jun 2022 06:28:21 -0400 Received: by mail-lf1-x12e.google.com with SMTP id h36so1515248lfv.9 for ; Thu, 16 Jun 2022 03:28:19 -0700 (PDT) Received: from localhost.localdomain ([93.175.28.49]) by smtp.gmail.com with ESMTPSA id y24-20020a199158000000b0047255d21128sm182581lfj.87.2022.06.16.03.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 03:28:16 -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=yyVhZy8bklF/2igjopLiG2+6KGpqYpafIqoFN6DUnPylZZT2MkvpVjhza1qzvytPjU 8bSaI/jUJzuhgKho35egdnRTPTC09zdjwszZTYSEDg0MEC7LTZptWiZ7oOvaggtpySZr 76RR1YompvtD0wtVG2nKiBw4hDoc0lsIOS/sLZnsWPA1bpgKuiYVzszJkkLxK4ewfAc1 aXTHTv7QEtOcxtTvTTLvRfhWhJHJfzIKox17ApHK2jIwDVaWEFfrF+OOkx/tEETaAvuT vrPZ8AjvOTJBjRs9foM2X9RO9a+Dt+ViOHPtwFzgR8+A980BbdrmNOLo1gW/HNxid3xW vD2Q== 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=Yix8aWIQ91WUmZD5oKMh5KXJIPjwhTTqtfvJsdoPU9iL+ZxuVavm0+12zVjlmeNfd2 KGKSvyznbf7LoULvtV+PM9XOOaslIdq5FriLab5G9zFnA3WQJi0n2JtHd4SAmOWscE1q G1jHJqbGhPaVMn3fJA/Er3f+03h5CvU4mH06F8XgNSbLT4sYaiHIALOXxo5viStgfymc P6UMmcT7tyuz8QwZdSZY5Z0CiNhJTXFU/6PKqFen0/y+rYWDrqYQbQEyhVCSj/WC8Fc6 9E7fUhHlo6o2P7bg4iMCV9AulrTUwHrgIVxfdQBaw7Harlj2/M/oi4MkXPnRt06nVzOh Jo/w== X-Gm-Message-State: AJIora9p6nBLwRsZRxnBmwDPqZ9QKodwB/BzQgIkCfKJJ+qHvrjszNJ1 zZuZ7OfcVUn043oq2m3XC0QbJbtw8G6BL15N X-Google-Smtp-Source: AGRyM1ueFA/ATV8qMHUgFyV5Iv0lVDeGpSt1XIJkxYWCAsPLVSaQG8hnMwXmyZ94d75ND/7mXrgtTA== X-Received: by 2002:a05:6512:3e24:b0:479:40e9:292a with SMTP id i36-20020a0565123e2400b0047940e9292amr2283186lfv.190.1655375297735; Thu, 16 Jun 2022 03:28:17 -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 v3 02/17] migration: should_skip() implemented Date: Thu, 16 Jun 2022 13:27:56 +0300 Message-Id: <20220616102811.219007-3-nikita.lapshin@openvz.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220616102811.219007-1-nikita.lapshin@openvz.org> References: <20220616102811.219007-1-nikita.lapshin@openvz.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @openvz-org.20210112.gappssmtp.com) X-ZM-MESSAGEID: 1655376496765100001 Content-Type: text/plain; charset="utf-8" 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 *s= e, return vmstate_save_state(f, se->vmsd, se->opaque, vmdesc); } =20 +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/FUL= L) */ @@ -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); =20 @@ -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 =3D se->ops->resume_prepare(s, se->opaque); if (ret < 0) { @@ -1268,8 +1273,7 @@ int qemu_savevm_state_iterate(QEMUFile *f, bool postc= opy) 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(QEMU= File *f, bool in_postcopy) continue; } =20 - 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); =20 @@ -1417,6 +1417,9 @@ int qemu_savevm_state_complete_precopy_non_iterable(Q= EMUFile *f, trace_savevm_section_skip(se->idstr, se->section_id); continue; } + if (should_skip(se)) { + continue; + } =20 trace_savevm_section_start(se->idstr, se->section_id); =20 @@ -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; + } =20 save_section_header(f, se, QEMU_VM_SECTION_FULL); =20 @@ -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; } =20 ret =3D se->ops->load_setup(f, se->opaque); --=20 2.31.1