From patchwork Fri Sep 1 02:23:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 719486 Delivered-To: patch@linaro.org Received: by 2002:ab3:1981:0:b0:23f:8cfb:5ad7 with SMTP id 1csp17635lti; Thu, 31 Aug 2023 19:27:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMgrbcs203p8+L1a9+wVR5B0KSIsvpEA5APBLTwA9TD7TE03TGdmoGeCVxLlpzDR2KMJsG X-Received: by 2002:ac8:5804:0:b0:410:31c4:f460 with SMTP id g4-20020ac85804000000b0041031c4f460mr1466945qtg.1.1693535232247; Thu, 31 Aug 2023 19:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693535232; cv=none; d=google.com; s=arc-20160816; b=YnAr/j0VlPcDjOIxGcbZRzc+xYSzdrNkd2t99vqa8Lrt7VtMiokWeFAk6xgbq7BoHz S+r4pV109/yLw1BVVgF9kd6SJ2FLNEz+uT36qCbppcEgC5iwS1rte6s2CRfVsKcneViv WC9KVPvYEp6EWkrwKxh3JOu/ewySAn9HbZeJ+2lhPVyLDtuA3maM49mr4n8QMCFSgoDz h0JvEryq8dhZIb+DYFiO3xfLZ+muecbq5LnBcD5OWzN7ub+LFbg51Lz9j3yeMJWh8xwc dBCgxdvP+YYERMCLgGtSxV7Wepx4dCNEwfq5pNWEuqg0R2SZoz3yB08Ho49JMjrOpJQR lh+w== 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=aNsGM1lrXvwjZfK8fzxAwlxZ3vZk+R9BD/kfTxJ1kzo=; fh=r1cPj2GlTGSV4V8jQu3jfCKsZwpJ5ktYEUy+P7GD/+s=; b=I8HLxnbC8xKKjfo25x1cDqg7JuZepjIEWvnh5DKsRyBb7cwxB/wMEi+tsn+vZS9A/j pXnIcUO+hM8gAgWjlIh9vbNIKeTUi6xf/0tNIIgZ053dFvgc6uI7RLa8l0+4+xMNMtKD d9myPqEyzsN89bI6Zfc/SMIepE+cY7de7yxG/aVTMDrHjuaaVL2jo69RoBPN/9k0q1cR XQrOAnWaFriy1xwsVB9qnrgWE0d9sRbY6c/n7fhLpiKIIMYiwvLLzb7o0aWHW0lcDiB7 QSRoL3yKX13QyNAfaZ2FVlIX14i18TtqRsB/Nw5lxlwS3iOgWF718aTHS25rwgu8wzlt LP4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jhxuPfKL; 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 b12-20020ac85bcc000000b0040fcd2978cesi1731534qtb.450.2023.08.31.19.27.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Aug 2023 19:27:12 -0700 (PDT) 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=jhxuPfKL; 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 1qbtp4-0006Ve-5d; Thu, 31 Aug 2023 22:23:46 -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 1qbtp3-0006VA-I3 for qemu-devel@nongnu.org; Thu, 31 Aug 2023 22:23:45 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbtp0-0001PR-Sa for qemu-devel@nongnu.org; Thu, 31 Aug 2023 22:23:45 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-68a440a8a20so1226061b3a.3 for ; Thu, 31 Aug 2023 19:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693535021; x=1694139821; 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=aNsGM1lrXvwjZfK8fzxAwlxZ3vZk+R9BD/kfTxJ1kzo=; b=jhxuPfKLM0bctrTZI0TS5Ky/ZcR+M0egaf74m1Lp/YmxfSDkHXlBFyV9MWk9PQAU5x ojEJuBYPDrojzsV7yHCp4fpj2C3698ZHmzd2QFUaYYYtc8FFYBOzRQKBDtO8Qze4jJrv u23sVjemRKXorXMiF/dqFFT0zA/CuxzZhIGqNj+qw2vtXaHkCdq42he8fAsHQAysUncV 6ns2DDSfth4QrCe2LdYM3JEnBTpszKRl5f2sLM2+cwTGF+A/7gSJkVohQUp2+m7qf0Uc 0hQH1sH88cFS0ZKOee8C+jeUOmAZmBQx+Z9/MxMozvNL4kzA38a7Y1qtFNFlXFQw2Zqn LhCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693535021; x=1694139821; 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=aNsGM1lrXvwjZfK8fzxAwlxZ3vZk+R9BD/kfTxJ1kzo=; b=N7J2mfaCn2oiwrkSZANCwou6xJMU/kaSy1XV0bRFuBQMNwSUJaVdGtnlpH7MsktpcH 6NQjjF9oysPPVkx3w3bspNEyDDSvh7brjHztIBg2TC8ug07IXgNHTflqQ7daRzz7U/Du bqbD2PDaGfPWyjR/UFTqHCxX6Fl4GzUyRasVBFxP6s8D6X5qyJCcAzmSYeb7Z3Pj9vlo kNVqZNVMRsRUvVIDag/6hnqvkk4qpsuiinUcKnJe41Y1YMGl0Xbz+Qs94oItco7bVZ8A 0StLniJytEZ7PU8q21on9boHSQcQAsqahrz8ffSrLOEQZ2RQ9/CdlKpoCWWHE+tJXis0 +fuA== X-Gm-Message-State: AOJu0YxzuEQleXGUDF3zXuycPN8MhPKQ1gX+hrfxb9UDpQF2I6guPw4d +N4NaPFi/9MPMsskAsJwi1/G7tLYFdLl/V/evGY= X-Received: by 2002:a05:6a20:1444:b0:140:61f8:53f3 with SMTP id a4-20020a056a20144400b0014061f853f3mr1942189pzi.21.1693535021632; Thu, 31 Aug 2023 19:23:41 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id c25-20020aa781d9000000b0068a54866ca8sm1906977pfn.134.2023.08.31.19.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 19:23:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, alex.bennee@linaro.org Subject: [PATCH v2 11/33] migration: Remove qemu_host_page_size Date: Thu, 31 Aug 2023 19:23:09 -0700 Message-Id: <20230901022331.115247-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901022331.115247-1-richard.henderson@linaro.org> References: <20230901022331.115247-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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 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 --- migration/ram.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 9040d66e61..1cabf935f2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3033,7 +3033,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; @@ -3048,6 +3048,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } (*rsp)->pss[RAM_CHANNEL_PRECOPY].pss_channel = f; + /* + * ??? Mirrors the previous use of qemu_host_page_size below, + * 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); @@ -3056,8 +3062,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()) { @@ -3881,12 +3887,20 @@ static int ram_load_precopy(QEMUFile *f) { MigrationIncomingState *mis = migration_incoming_get_current(); int flags = 0, ret = 0, invalid_flags = 0, len = 0, i = 0; + int max_hg_page_size; + /* ADVISE is earlier, it shows the source has the postcopy capability on */ bool postcopy_advised = migration_incoming_postcopy_advised(); if (!migrate_compress()) { invalid_flags |= RAM_SAVE_FLAG_COMPRESS_PAGE; } + /* + * ??? Mirrors the previous use of qemu_host_page_size below, + * but is this really what was intended for the migration? + */ + max_hg_page_size = MAX(qemu_real_host_page_size(), TARGET_PAGE_SIZE); + while (!ret && !(flags & RAM_SAVE_FLAG_EOS)) { ram_addr_t addr, total_ram_bytes; void *host = NULL, *host_bak = NULL; @@ -3987,7 +4001,7 @@ static int ram_load_precopy(QEMUFile *f) } /* 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 "