Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp678861pxb; Wed, 22 Sep 2021 10:21:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCub3rBTPww/oSdGK4cpGja78D8p3gKcwJ/cYiQAsN1ADoK1dvD/cST4m7UpftNhJqd9g8 X-Received: by 2002:a05:6602:2151:: with SMTP id y17mr85384ioy.197.1632331293457; Wed, 22 Sep 2021 10:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632331293; cv=none; d=google.com; s=arc-20160816; b=BwcuQNbG83DNHbuEcENm3nTSjMROG4JtyxBk4askZkLJ9zFdW4d/0+J7B+V51ONuvT s3U8gEBfg83XbXh83GbS175zjNjqfoHn+QteBIb9zqd1VjgSi2G5Km5StIWlLbH00jZx 7fU7Biu/BfF98VqmJ6RDednFBVbw2yPtb+Xgd2pYND1TCTlgltxoMxA7a9O9YnBcc3bl bMfGihZVdw4jLTM7x2u23C9lZpmY2d5wrXWc7wTnAu+zrJQeNrChPDkgRRdhKFhnuHCC nJMAMLe2AAKREmgpafOgxoAjgKVqOvd6hHafWaEh3OcECI+xozR048O4aM/ccqFYXOJb jZBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=zqj7IcfjJOmv/J61U6IgvJMO0Ih8YuG/LFZTvW7FxmY=; b=pZ9xUvAzfzOfFpVVnqu3WJ5JujiUQ+Ye6q/8JpFZwzxZm79aftPB5xQbMSKnB27S3X vF8tlK0PVSe+03js8IWIiY10NodJakKIe1CmA5TdejmEwf0ZuUQwrG5hTO+MinpLs15z lnj4DLdbJsj9FjH4A9VgJlk2gHvlQyRg4XAIrjF9zQ54JkRbRC/i7rcIEPrGniwlaN25 GomJMQtKb+67BtjoZ2rojvoWDq0Mb83v0uj4FpBsKTmGZNUw/CBJI1e2rIfh1Z1kaytu 3bgVBwxxudCTxeV2K7s0vaw5zC6udTdfKBACAyz/9rn8XH+8AZd6CnYKyRghtbcJtnRn FmrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vVdz8med; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si2932844ila.178.2021.09.22.10.21.21; Wed, 22 Sep 2021 10:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vVdz8med; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236752AbhIVRUa (ORCPT + 99 others); Wed, 22 Sep 2021 13:20:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236701AbhIVRU3 (ORCPT ); Wed, 22 Sep 2021 13:20:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1D47C061574; Wed, 22 Sep 2021 10:18:59 -0700 (PDT) Date: Wed, 22 Sep 2021 17:18:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632331137; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqj7IcfjJOmv/J61U6IgvJMO0Ih8YuG/LFZTvW7FxmY=; b=vVdz8med9+wY4IZRf4lqE6Vqb8jkcygNfBzhp+VDUn5dszX1EJzbHAJodGDogCEUjmj/n9 S24WgFZ080Xp9K7SV9pTkUytNfKjs/h6Ztu0AK8QEBBr3oqW9hE9eTSk3/HW0jmFFO1v4y GdaSjlUzoNsJoPIFC5xQdFeHkgvXvz0rqQM6nXnZVRqP456A0WWAE4saQ78PiucJ2v9B+/ rZSLWdUTCX7zx05MkSRwRQdRDNFJyYHRn+hwCaBSnsOXM2EjPenmtEMb7Yf6G+efCx6Xqq GKnE7nMmhY9jyxiFEwFVX5Gazbbboj91fWyx/QRfECk1IvH6VcYp8CKNhV6uXg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632331137; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqj7IcfjJOmv/J61U6IgvJMO0Ih8YuG/LFZTvW7FxmY=; b=LK/61yZrDt+zJ9CFP0v6C2I4/LDNPoAOO/oLZb73mr6W4UZKAVGYG4/hFZexeWeP1lNnoA upBecXMB18RTu/BQ== From: "tip-bot2 for Juergen Gross" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/setup: Call early_reserve_memory() earlier Cc: marmarek@invisiblethingslab.com, Juergen Gross , Borislav Petkov , Nathan Chancellor , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210920120421.29276-1-jgross@suse.com> References: <20210920120421.29276-1-jgross@suse.com> MIME-Version: 1.0 Message-ID: <163233113662.25758.10031107028271701591.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 8aa83e6395ce047a506f0b16edca45f36c1ae7f8 Gitweb: https://git.kernel.org/tip/8aa83e6395ce047a506f0b16edca45f36c1= ae7f8 Author: Juergen Gross AuthorDate: Mon, 20 Sep 2021 14:04:21 +02:00 Committer: Borislav Petkov CommitterDate: Tue, 21 Sep 2021 09:52:08 +02:00 x86/setup: Call early_reserve_memory() earlier Commit in Fixes introduced early_reserve_memory() to do all needed initial memblock_reserve() calls in one function. Unfortunately, the call of early_reserve_memory() is done too late for Xen dom0, as in some cases a Xen hook called by e820__memory_setup() will need those memory reservations to have happened already. Move the call of early_reserve_memory() before the call of e820__memory_setup() in order to avoid such problems. Fixes: a799c2bd29d1 ("x86/setup: Consolidate early memory reservations") Reported-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Tested-by: Marek Marczykowski-G=C3=B3recki Tested-by: Nathan Chancellor Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20210920120421.29276-1-jgross@suse.com --- arch/x86/kernel/setup.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 79f1641..40ed44e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -830,6 +830,20 @@ void __init setup_arch(char **cmdline_p) =20 x86_init.oem.arch_setup(); =20 + /* + * Do some memory reservations *before* memory is added to memblock, so + * memblock allocations won't overwrite it. + * + * After this point, everything still needed from the boot loader or + * firmware or kernel text should be early reserved or marked not RAM in + * e820. All other memory is free game. + * + * This call needs to happen before e820__memory_setup() which calls the + * xen_memory_setup() on Xen dom0 which relies on the fact that those + * early reservations have happened already. + */ + early_reserve_memory(); + iomem_resource.end =3D (1ULL << boot_cpu_data.x86_phys_bits) - 1; e820__memory_setup(); parse_setup_data(); @@ -876,18 +890,6 @@ void __init setup_arch(char **cmdline_p) =20 parse_early_param(); =20 - /* - * Do some memory reservations *before* memory is added to - * memblock, so memblock allocations won't overwrite it. - * Do it after early param, so we could get (unlikely) panic from - * serial. - * - * After this point everything still needed from the boot loader or - * firmware or kernel text should be early reserved or marked not - * RAM in e820. All other memory is free game. - */ - early_reserve_memory(); - #ifdef CONFIG_MEMORY_HOTPLUG /* * Memory used by the kernel cannot be hot-removed because Linux