From patchwork Tue Jan 2 01:57:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 759332 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp5855973wrw; Mon, 1 Jan 2024 17:58:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFN45CeIEUzmqs1f9wNQiN/lHBNxS8kG755UcNZeT3RpgrDjAQfsqMq/WswzQioIMC7DuqP X-Received: by 2002:ac8:5945:0:b0:427:9efa:b81d with SMTP id 5-20020ac85945000000b004279efab81dmr24582515qtz.126.1704160735342; Mon, 01 Jan 2024 17:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704160735; cv=none; d=google.com; s=arc-20160816; b=eBVL6LOU1RMEklN6SvoDA75zu/+uYotL9lUsyRfWPEY+nYMySyzVtQypIvMzzCiHTi MM6t1bbRLZIH9kJSomw245d4xZzBHBZASgFT5mVSR+qovj67g3SOLZ14bR1kw6pZL9ta 7xICttb/o2QggmBMzEfAqZghcAhARJYHJUM+jjePFqhG/ByWqBRtKVk1sCyVFKOZLhyB hPLOTyR1WARgexL7u/Lw7gb7Aqs0kgk9aPpsW02emLqAEdyBo/h6XvUsk5ZmdSOoPsYC ZeOHniu1sQevUH0TS+2nYbfvdBUQU3WwLfp+GYftFQxG6huOCRwTIrVRPz7mAWSX6LZ1 mOTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=IenBg9AYpQ9l8BWTXQNXUpU41uv7QpRC4SvYweV2rAA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=OKaFThLMgBi5rPlLjMi0qwPl/h80swCxHASozOkfJ7ZEN7a7xu2/X3XF6zVnC9N7g2 3hV+qRrLR0J9KsuvIb9baUOrD2oGcfreIvGJ271GVdg9Js22BoNP6IjTL03SEZBF+Wz8 P2CUvL6pG8UOkRkFB78N8FopR85aT+W6n7hv8ktTfCVcMYpLwOPo5vNji/GYYUGU1B7x +aScSg1xZgpmwxgzo1ub8nmvUgy84DAh2ZEYP3wSkG7YBaN8o91DFxI+/i3d577+RYXF 5QcXgu6PPyFc9oLVMX8IIgjoCWBHrN/cEaAlggo+BRP+WhJC8GmFIVvqtkAwK8mrr5Z0 tiRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHzGquAa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t18-20020ac85892000000b0042827000d50si2055973qta.418.2024.01.01.17.58.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jan 2024 17:58:55 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aHzGquAa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKU3E-0003JV-TT; Mon, 01 Jan 2024 20:58: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 1rKU3C-0003IQ-Uu for qemu-devel@nongnu.org; Mon, 01 Jan 2024 20:58:38 -0500 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKU3B-00070z-Cg for qemu-devel@nongnu.org; Mon, 01 Jan 2024 20:58:38 -0500 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-6dc36e501e1so2061727a34.1 for ; Mon, 01 Jan 2024 17:58:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704160716; x=1704765516; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IenBg9AYpQ9l8BWTXQNXUpU41uv7QpRC4SvYweV2rAA=; b=aHzGquAaP6EDXNCYSTqyeVL+f302JMwrg8MA6cvZGw2VP1HBpIQaUmWnOO5JHzaqfP VELLgej4Pa1QR88LyjvsCkrGovmtKJVCH1TglKVXTxgKiH71e5rB4FyqXw03I7/RqjsD MkkpTezNZ/Lvl/QAeIeTiehnM8fsX0UyR3UJJwlR2IiUu4YI8JL+tEG73r8V8A2SnL8w rbvv0V6CYR21yArDUVd/g3NjvwFSabD0WSI2OcaMnOnETc4y2BE0CBrgoTG5usqH1xeA LqAcByKLGlErVFMv4ykchM2oUJSdB526h9KzMOielUES32JbkiQ2t61pmcAXDxUosR/+ UcXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704160716; x=1704765516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IenBg9AYpQ9l8BWTXQNXUpU41uv7QpRC4SvYweV2rAA=; b=CBziCHg9ag/wBbw+ei5rGEsXKntA6wy7HjE2WtVh3dLfwR0BhStWlYnTnr3oqYotkr HVSWSjj/EZFAGT/0gNSFxCC4QjZzznbh0X7oYJ04iRGaqvWXJ2EKHiXEHKOAzd/JNlf9 aB5ZDZ0ptwMCmWZnTQpoDEFvK39cpDguHvKOxWDuGGfKnc/G9R6QOSlAtmbpENCZvzwQ YiQvZl9ZPnT0LwsYRgANLZsiyNXGoWYL/0wZpkjLRQF8EcCGskhl8KmffACgdUQnMt8A xhEEe8oyjGxFqLPlYQzwqWQTDXujB3S9aAncJgvYHO/NfgIWNx8tJ8vc6tDFK33TlnOF rDeg== X-Gm-Message-State: AOJu0YyIzWS/o04zT6MQhHv6/B0dphhdHEk4flBobfQyqeqosGzj3bbq 6nq5xGV4oaRGW+mJwcZPGDLhEJu8P7VV21pDHLe2a3vAJMY= X-Received: by 2002:a9d:4b16:0:b0:6dc:54:f52a with SMTP id q22-20020a9d4b16000000b006dc0054f52amr8654884otf.4.1704160716169; Mon, 01 Jan 2024 17:58:36 -0800 (PST) Received: from stoup.. (124-149-254-207.tpgi.com.au. [124.149.254.207]) by smtp.gmail.com with ESMTPSA id g33-20020a635221000000b0058ee60f8e4dsm19561891pgb.34.2024.01.01.17.58.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 17:58:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/33] migration: Remove qemu_host_page_size Date: Tue, 2 Jan 2024 12:57:46 +1100 Message-Id: <20240102015808.132373-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240102015808.132373-1-richard.henderson@linaro.org> References: <20240102015808.132373-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace with the maximum of the real host page size and the target page size. This is an exact replacement. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Ilya Leoshkevich --- migration/ram.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 8c7886ab79..aa3109fca3 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2936,7 +2936,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) { RAMState **rsp = opaque; RAMBlock *block; - int ret; + int ret, max_hg_page_size; if (compress_threads_save_setup()) { return -1; @@ -2951,6 +2951,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } (*rsp)->pss[RAM_CHANNEL_PRECOPY].pss_channel = f; + /* + * ??? Mirrors the previous value of qemu_host_page_size, + * but is this really what was intended for the migration? + */ + max_hg_page_size = MAX(qemu_real_host_page_size(), TARGET_PAGE_SIZE); + WITH_RCU_READ_LOCK_GUARD() { qemu_put_be64(f, ram_bytes_total_with_ignored() | RAM_SAVE_FLAG_MEM_SIZE); @@ -2959,8 +2965,8 @@ static int ram_save_setup(QEMUFile *f, void *opaque) qemu_put_byte(f, strlen(block->idstr)); qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr)); qemu_put_be64(f, block->used_length); - if (migrate_postcopy_ram() && block->page_size != - qemu_host_page_size) { + if (migrate_postcopy_ram() && + block->page_size != max_hg_page_size) { qemu_put_be64(f, block->page_size); } if (migrate_ignore_shared()) { @@ -3794,6 +3800,7 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *block, ram_addr_t length) int ret = 0; /* ADVISE is earlier, it shows the source has the postcopy capability on */ bool postcopy_advised = migration_incoming_postcopy_advised(); + int max_hg_page_size; assert(block); @@ -3811,9 +3818,16 @@ static int parse_ramblock(QEMUFile *f, RAMBlock *block, ram_addr_t length) return ret; } } + + /* + * ??? Mirrors the previous value of qemu_host_page_size, + * but is this really what was intended for the migration? + */ + max_hg_page_size = MAX(qemu_real_host_page_size(), TARGET_PAGE_SIZE); + /* For postcopy we need to check hugepage sizes match */ if (postcopy_advised && migrate_postcopy_ram() && - block->page_size != qemu_host_page_size) { + block->page_size != max_hg_page_size) { uint64_t remote_page_size = qemu_get_be64(f); if (remote_page_size != block->page_size) { error_report("Mismatched RAM page size %s "