From patchwork Thu Feb 15 06:19:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 772871 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp681580wre; Wed, 14 Feb 2024 22:26:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVfZVbYqIRVLTr8m+svg01FT276gYOfujxsGR78s7lU/i8/Che3itKX8dMuPIqSD6+vdkiPfe9ohjKFO56Gzkuj X-Google-Smtp-Source: AGHT+IFONMa42ZsgqGzFUDspE5c/iSLODFFTlR6+f2VqnA0miHimq2Lm7dybT47qaJ4n9IbopRMi X-Received: by 2002:a0c:f2c1:0:b0:68c:6824:3413 with SMTP id c1-20020a0cf2c1000000b0068c68243413mr969927qvm.49.1707978367751; Wed, 14 Feb 2024 22:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707978367; cv=none; d=google.com; s=arc-20160816; b=igROZPZGgZGkkvM2IadUIqZSZWmjgn7OlwjNUl2zu4FpuKbwQy8xze77gA+0YwG3w8 cobtGa/FxI11B+0SO3xNkrrmcvcwswCjkDXOQ+1/REgQm5owarUwUOAY259wbhZQcwED gAox506LZ5m1xVNzHdNJt+r5WsmAb+YG0HEA0BvWsYSeafZoko7cYqWK9osohjCq5o9V +CTIuM/JfPiJ2gmNv8zslNd65cnxCbpxLSNHIahTmBlOi6Xl4OvPcJncNWiiKP92FTrE Iy74x2NL3Sk6pub12tiAjcXl5gLPTakF14EfS4kT7ScNiaq+VnnbMveQolayLPmFA/BX UX4A== 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:cc:to :from:dkim-signature; bh=z/9ie+RjhRAxWQRFAoaHPcdtrZYsCMJBCi3SaKV1dlk=; fh=v7v6q89OJlq+NxHejbJ/ziw7VE+fSww09twjGPM2dQM=; b=QE7rbg/S84+GmtFYXSxriwFWfs9JwrqeM/JPihEa9PXYcfC1yaNCSuuhCb0cZOlNQG HuRj5Y5djzI3CXW5BmzK6A5haDzoHPfIEbAvzN9oiSmU+IQc7QKsKGPu/WBMdGH8NjU4 Uzs0NfSU+98CiFiC+ywkMLzLC1qIq7MnX1Bd7sPiZtr0kJ1xaw08xy8wHEadmVmmHGru RsymvC0/0famRJUAhFBm9ra8kQazeu+0rC5jDGNb72iVPPDLrzdAYE+eyM1mnXDnFe+n Mp0RZbZU+O/yGZ5B+84b2HORy/JnPw/7dv+d1tXjv0JsyhJloxOAczs3QNvuzo2+aJHz Lwjg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kyE+u9nV; 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 q14-20020ad4574e000000b0068cc3b10b84si771291qvx.275.2024.02.14.22.26.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2024 22:26:07 -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=kyE+u9nV; 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 1raV74-0002Ml-FB; Thu, 15 Feb 2024 01:20:50 -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 1raV6t-0002Jb-UZ for qemu-devel@nongnu.org; Thu, 15 Feb 2024 01:20:40 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raV6s-0005TB-8t for qemu-devel@nongnu.org; Thu, 15 Feb 2024 01:20:39 -0500 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5ce6b5e3c4eso398238a12.2 for ; Wed, 14 Feb 2024 22:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707978037; x=1708582837; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z/9ie+RjhRAxWQRFAoaHPcdtrZYsCMJBCi3SaKV1dlk=; b=kyE+u9nVvw+xMyRJ9BwM+rq86mWks7j+fwgHWUFj3SD1sFd6VTJPxTFkstVkmRNkgr Zz6Mn75ODKSZoBp+0mqRH+PKrLc3KZaHeoZ5z7gn89UIk4DSk/CrzoHKwsqJain9aIkD vF9oo/EgDlcDktVDzmJiFFaSjDAIaF6a1NVkec7qmXDyQB2R4O3VRN/ENQ561WAkFvuc +a+DaTfQD9mFiwmNDoGaJCmDIPXzCixUVceTx+7k0YMrEpiJKRQw8Puz99iiiSagYy9W 0CLwC3ibMykqJap4HIbDTnWc6ppXDd1e74Umc4MRU7x8Sy9mFe2+g54ylarsURluR1ei 9d5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707978037; x=1708582837; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z/9ie+RjhRAxWQRFAoaHPcdtrZYsCMJBCi3SaKV1dlk=; b=PnYJD4AWTRJVkkYhN4nR8DWVGsfMJAVfg8Y7ZyRLMyORxcudU7vzrKEc4Y0At9epjz copYxIxXydgWLt5BBIhI5glIsQigQ/45tVtPJ15vLqgXBDIG+6ofHhqfn+D/A7yAXRXZ UAcdfBTEktpQDb6XLmiW8HkLoaS72V4/Kr5zIRQxk7EU97rB+yZDTCgqrxyEZrsgd1Jz iWwFZq/3gjRiO2esHA80HaFo7/pa1NgMgZdDFr8+pnkwiVCGCvnlDiN3qXSGMzAMAk7K i5JPN3xkkRB6+cA9SDCK0Ig2nz9dIlRvc7+VpBtFSY80cZJjuHJjALab2U4bBowuL4jH 8cfg== X-Gm-Message-State: AOJu0YzhkeC0H+9jboERXC0GETQFSmGr0Axxny+WWuIC1XYkOUJZTVWq hlOYO0Ja3/Qaozp0MJGFl11cvRVZzrQ3RpIadgPHnY5xocsPH4i/uF6OCavg5xaCg9oOpxVCpPC s X-Received: by 2002:a05:6a21:1519:b0:19e:9aec:ba1d with SMTP id nq25-20020a056a21151900b0019e9aecba1dmr1442595pzb.47.1707978036792; Wed, 14 Feb 2024 22:20:36 -0800 (PST) Received: from stoup.. (173-197-098-125.biz.spectrum.com. [173.197.98.125]) by smtp.gmail.com with ESMTPSA id d5-20020a170902b70500b001d6f29c12f7sm464418pls.135.2024.02.14.22.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 22:20:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Pierrick Bouvier , Helge Deller Subject: [PATCH v4 11/36] migration: Remove qemu_host_page_size Date: Wed, 14 Feb 2024 20:19:53 -1000 Message-Id: <20240215062018.795056-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215062018.795056-1-richard.henderson@linaro.org> References: <20240215062018.795056-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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: Ilya Leoshkevich Reviewed-by: Pierrick Bouvier Acked-by: Helge Deller Message-Id: <20240102015808.132373-12-richard.henderson@linaro.org> --- migration/ram.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 4649a81204..61c1488352 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2935,7 +2935,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; @@ -2950,6 +2950,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); @@ -2958,8 +2964,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()) { @@ -3792,6 +3798,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); @@ -3809,9 +3816,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 "