From nobody Tue Feb 10 12:58:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1688630270; cv=none; d=zohomail.com; s=zohoarc; b=jCtPp5Qx0/BpmqG8Jl7AzEh8O4Pv7jzk7TbkZX5CSBlVg2sOaP1Pyt/LvZr1hm5ymNnWDpFYEvxO46F7/ivhX07CtcyF+dSMPJfhnmSapooVIlG74ohQUukPDPMul4vmwKxHwfnX6vVFIVZ0dlA37s169PzWs6AGgWT/Ss1F/Lk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688630270; 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=6S4fG1HfYZ8d2GMLFeaQRWbJnKmRMzY6VpgFTszcce8=; b=UtfPgYuaIarl9GPhCR9VKEImUwsC1nUWe/eocA3H+9yQJtB3gHeiMbiBYjwIn16+FH7ZsBG/FWA+/gyTeahp+egRIlCahY0zb3GGuEQY5ZLTesBSSq322Q/hak2/P6FfisWPG9JVrtFCpeedW/AmRpgz/H8FyZbv25eqSfgJkVw= 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 1688630270423717.571609653969; Thu, 6 Jul 2023 00:57:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHJrE-0002In-CC; Thu, 06 Jul 2023 03:56:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHJr5-0002GV-By for qemu-devel@nongnu.org; Thu, 06 Jul 2023 03:56:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHJr3-0007Mb-NZ for qemu-devel@nongnu.org; Thu, 06 Jul 2023 03:56:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-pL5vzOKyMsiEeaSDwq6CGg-1; Thu, 06 Jul 2023 03:56:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61075800B35; Thu, 6 Jul 2023 07:56:40 +0000 (UTC) Received: from t14s.cit.tum.de (unknown [10.39.193.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0330AF640E; Thu, 6 Jul 2023 07:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688630204; 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=6S4fG1HfYZ8d2GMLFeaQRWbJnKmRMzY6VpgFTszcce8=; b=i5E0jA0sQZUShCKGsRkzVog86IC/WIWUb9FlgzM0xMtTakSsezjLd8U4hspEqOb9nrABuM QaX7KJRRiLEUHx6APoOGDnAlfzmIi1dW3i8BbMUKO4nglo0H0uTyyRZfM1tiG29bFkLLAF rsYoqHJAj7Tt1+xwLfKtrj05XGoASnM= X-MC-Unique: pL5vzOKyMsiEeaSDwq6CGg-1 From: David Hildenbrand To: qemu-devel@nongnu.org Cc: David Hildenbrand , "Michael S. Tsirkin" , Juan Quintela , Peter Xu , Leonardo Bras , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peng Tao , Mario Casquero Subject: [PATCH v2 3/4] migration/ram: Expose ramblock_is_ignored() as migrate_ram_is_ignored() Date: Thu, 6 Jul 2023 09:56:08 +0200 Message-ID: <20230706075612.67404-4-david@redhat.com> In-Reply-To: <20230706075612.67404-1-david@redhat.com> References: <20230706075612.67404-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=david@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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1688630270803100003 Content-Type: text/plain; charset="utf-8" virtio-mem wants to know whether it should not mess with the RAMBlock content (e.g., discard RAM, preallocate memory) on incoming migration. So let's expose that function as migrate_ram_is_ignored() in migration/misc.h Acked-by: Peter Xu Tested-by: Mario Casquero Signed-off-by: David Hildenbrand Reviewed-by: Juan Quintela --- include/migration/misc.h | 1 + migration/postcopy-ram.c | 2 +- migration/ram.c | 14 +++++++------- migration/ram.h | 3 +-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 5ebe13b4b9..7dcc0b5c2c 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -40,6 +40,7 @@ int precopy_notify(PrecopyNotifyReason reason, Error **er= rp); =20 void ram_mig_init(void); void qemu_guest_free_page_hint(void *addr, size_t len); +bool migrate_ram_is_ignored(RAMBlock *block); =20 /* migration/block.c */ =20 diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 5615ec29eb..29aea9456d 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -408,7 +408,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis, Error **errp) /* * We don't support postcopy with some type of ramblocks. * - * NOTE: we explicitly ignored ramblock_is_ignored() instead we checked + * NOTE: we explicitly ignored migrate_ram_is_ignored() instead we che= cked * all possible ramblocks. This is because this function can be called * when creating the migration object, during the phase RAM_MIGRATABLE * is not even properly set for all the ramblocks. diff --git a/migration/ram.c b/migration/ram.c index 5283a75f02..0ada6477e8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -194,7 +194,7 @@ static bool postcopy_preempt_active(void) return migrate_postcopy_preempt() && migration_in_postcopy(); } =20 -bool ramblock_is_ignored(RAMBlock *block) +bool migrate_ram_is_ignored(RAMBlock *block) { return !qemu_ram_is_migratable(block) || (migrate_ignore_shared() && qemu_ram_is_shared(block) @@ -696,7 +696,7 @@ static void pss_find_next_dirty(PageSearchStatus *pss) unsigned long size =3D rb->used_length >> TARGET_PAGE_BITS; unsigned long *bitmap =3D rb->bmap; =20 - if (ramblock_is_ignored(rb)) { + if (migrate_ram_is_ignored(rb)) { /* Points directly to the end, so we know no dirty page */ pss->page =3D size; return; @@ -780,7 +780,7 @@ unsigned long colo_bitmap_find_dirty(RAMState *rs, RAMB= lock *rb, =20 *num =3D 0; =20 - if (ramblock_is_ignored(rb)) { + if (migrate_ram_is_ignored(rb)) { return size; } =20 @@ -2260,7 +2260,7 @@ static int ram_save_host_page(RAMState *rs, PageSearc= hStatus *pss) unsigned long start_page =3D pss->page; int res; =20 - if (ramblock_is_ignored(pss->block)) { + if (migrate_ram_is_ignored(pss->block)) { error_report("block %s should not be migrated !", pss->block->idst= r); return 0; } @@ -3347,7 +3347,7 @@ static inline RAMBlock *ram_block_from_stream(Migrati= onIncomingState *mis, return NULL; } =20 - if (ramblock_is_ignored(block)) { + if (migrate_ram_is_ignored(block)) { error_report("block %s should not be migrated !", id); return NULL; } @@ -3958,7 +3958,7 @@ static int ram_load_precopy(QEMUFile *f) } if (migrate_ignore_shared()) { hwaddr addr =3D qemu_get_be64(f); - if (ramblock_is_ignored(block) && + if (migrate_ram_is_ignored(block) && block->mr->addr !=3D addr) { error_report("Mismatched GPAs for block %s " "%" PRId64 "!=3D %" PRId64, @@ -4254,7 +4254,7 @@ static void ram_mig_ram_block_resized(RAMBlockNotifie= r *n, void *host, RAMBlock *rb =3D qemu_ram_block_from_host(host, false, &offset); Error *err =3D NULL; =20 - if (ramblock_is_ignored(rb)) { + if (migrate_ram_is_ignored(rb)) { return; } =20 diff --git a/migration/ram.h b/migration/ram.h index ea1f3c25b5..145c915ca7 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -36,11 +36,10 @@ extern XBZRLECacheStats xbzrle_counters; extern CompressionStats compression_counters; =20 -bool ramblock_is_ignored(RAMBlock *block); /* Should be holding either ram_list.mutex, or the RCU lock. */ #define RAMBLOCK_FOREACH_NOT_IGNORED(block) \ INTERNAL_RAMBLOCK_FOREACH(block) \ - if (ramblock_is_ignored(block)) {} else + if (migrate_ram_is_ignored(block)) {} else =20 #define RAMBLOCK_FOREACH_MIGRATABLE(block) \ INTERNAL_RAMBLOCK_FOREACH(block) \ --=20 2.41.0