From patchwork Fri Mar 1 23:05:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 777095 Delivered-To: patch@linaro.org Received: by 2002:adf:e94d:0:b0:33d:f458:43ce with SMTP id m13csp1602814wrn; Fri, 1 Mar 2024 15:13:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWN/PIBWIS4Uy84C+3AcFmMfzeFbWzBKw11XFkZb0uT+P6gJkSEQOBkttz+pzjJ+qJiOqBnQ//oXKe7+7xfTTtK X-Google-Smtp-Source: AGHT+IHaWEAan8ny2yvYjkfyj4dFh8dvqBPt161GF7lnC8BeBEMnd8wypra0+DRcrKyv3GOso1Lo X-Received: by 2002:a05:620a:811:b0:787:c664:a929 with SMTP id s17-20020a05620a081100b00787c664a929mr3035434qks.67.1709334812489; Fri, 01 Mar 2024 15:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709334812; cv=none; d=google.com; s=arc-20160816; b=Z6++HHopH9wv13a+uPtjq0rL/PClgnJFDwSM4tWnLr3ApWMioYTVFPMxovcTfRglxM C0OyKAW+xpLGga7VPYDCYekHqcRXMA/1HNysTJ7HW9xqkMxxbbSkGDhaAMPvidPZaEht 60ifkLQPhGavUpvNoXmIlgnIExOR8TjpWEz+l80AoylgZLgQkyCcgheSBwxeRGKocTRC kYzZ70JQAXipUhrj17VgbwGkA7CqoA9Nryc1UumUnFIi3pXod1PXrWsgE9W5t42Mpzn6 1FUJcxpHFGsa8QahWdbXW95Mt2DA+dz1eei5M0r8vsdk+dvi4alD3qA4Pgi/BOVU8p40 bpBA== 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=lZemmFhkZWzz9AvC4hLSQ8D3Jh4HUes/r/6Q/zZwIww=; fh=v7v6q89OJlq+NxHejbJ/ziw7VE+fSww09twjGPM2dQM=; b=lL8KMqKD2hBz49TqgQOSNsyAqjXS2U181JPQPb2eR5rrEI4gvhXGp/dGHD4g3J3TzN v7GRCkFf1fYJuA0veQNTvGRpysiItbdBzPfMf8N7G9VJT6rp3B9M9/n3Zr6O8UoVyY+M YXuQEeqUAJuN/TNAJWcdDZEdtjfqWmjQIqXXnjoK6v5JusVfRNVINChD48PGv9S8R/PT 3FCwbBAkmC5v7T2w1fkpJkMkgBfZQQtvSAe1ObVcMIf6UcdtJp8celkigGo6tTD07zWA f4GwNtTi4hqnyQAma+L9USVHnl5+1oGaAIcKYF1JWvvGSLkkajoWlN+ugfDx3ddaPJUd d+Aw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="p88Hc/70"; 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 u26-20020a05620a023a00b00787f5ac62a3si4394377qkm.249.2024.03.01.15.13.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2024 15:13:32 -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="p88Hc/70"; 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 1rgByS-00060R-Ll; Fri, 01 Mar 2024 18:07:28 -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 1rgBy6-0005GU-CL for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:07:06 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rgBy4-0004Jl-OY for qemu-devel@nongnu.org; Fri, 01 Mar 2024 18:07:06 -0500 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1d911c2103aso10235095ad.0 for ; Fri, 01 Mar 2024 15:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709334423; x=1709939223; 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=lZemmFhkZWzz9AvC4hLSQ8D3Jh4HUes/r/6Q/zZwIww=; b=p88Hc/70b6Xdgd//kfMffeuFe9PLReul6ROGQQe5282pkSnhb34RowJ1/8F+axa3or TmmQ5L/EFv+Kw2loXe+MtVjQjY6XLX1yz5qCo/DT8BsCKCLJpvulzn6T8JeVfDxYi0ly f3PaBNE4eFfevza9HElHHZWBoNWTwWdNTh8uUBylSOtQhATXOap1bcbL1upEvlYYBHuc 3A+6J4YYvcv9tOqQm+tvdUP0vR75DlykDI0n/XHcKM1d6YF4J10zLkOF36Qi5vIJZ7KI t/SD4O4diGSom8jXWZV2Vvq4jYqtcJ4z0fMm1ptjoUpbDLYwGLRqWtP/ZuV7Sb5dZ74B jpTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709334423; x=1709939223; 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=lZemmFhkZWzz9AvC4hLSQ8D3Jh4HUes/r/6Q/zZwIww=; b=uDCCKzvJSy7WeGR15ABY6rbaNpS/aSZsuLyzIxYm9PfAye+OtJL68wbuN8Kd087oo0 l7ZKgUvbExWVR6m6HHHAr/T5+qjTTp/hv/uRBDC/fBkL130UpAw7EbPHwJAr+Ry3yzFp OywdtiyAdvace46ud6mK7supvdUCGuuM0zqYsBkq6WVYOhr//qqr1zo+g438tJpD7Lo6 CCSAey4xOsVFbcIWNmNO46I1ltXAS5Sf69i+Hf0IuQ2AURLCRoA1M8hmgI9apjphMs8I dTYV4MSw9hlHKZ3J2ljeg9jUH7TdEn+gz+nB86W63C6Qb896kcgY35bK9ipg145uLlz7 HBLQ== X-Gm-Message-State: AOJu0YyhDHO3XoAiH2RxToZ3fJaYsQ0Zj45RMJL1RZcEvRmClw7uUQVT W6a9qvTrzjuqRb0WOKO5xHsHk8DC1dxZkLtT8hX3d77zt83vBCFhHVD+tNgqZAMRmC4CTFb0ReG m X-Received: by 2002:a17:902:ce91:b0:1dc:15f5:fddf with SMTP id f17-20020a170902ce9100b001dc15f5fddfmr3905967plg.7.1709334423361; Fri, 01 Mar 2024 15:07:03 -0800 (PST) Received: from stoup.. (098-147-055-211.res.spectrum.com. [98.147.55.211]) by smtp.gmail.com with ESMTPSA id lc11-20020a170902fa8b00b001dc668e145asm3988580plb.200.2024.03.01.15.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 15:07:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Pierrick Bouvier , Helge Deller Subject: [PATCH 29/60] migration: Remove qemu_host_page_size Date: Fri, 1 Mar 2024 13:05:48 -1000 Message-Id: <20240301230619.661008-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301230619.661008-1-richard.henderson@linaro.org> References: <20240301230619.661008-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 45a00b45ed..83fd780fc2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2934,7 +2934,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; @@ -2949,6 +2949,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); @@ -2957,8 +2963,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()) { @@ -3791,6 +3797,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); @@ -3808,9 +3815,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 "