From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C496FC433EF for ; Wed, 15 Sep 2021 11:01:18 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71E1361250 for ; Wed, 15 Sep 2021 11:01:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 71E1361250 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.187488.336362 (Exim 4.92) (envelope-from ) id 1mQSek-0001fl-3h; Wed, 15 Sep 2021 11:00:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 187488.336362; Wed, 15 Sep 2021 11:00:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mQSej-0001fe-VY; Wed, 15 Sep 2021 11:00:45 +0000 Received: by outflank-mailman (input) for mailman id 187488; Wed, 15 Sep 2021 11:00:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mQSeY-0001fY-KQ for xen-devel@lists.xenproject.org; Wed, 15 Sep 2021 11:00:44 +0000 Received: from mail.skyhub.de (unknown [2a01:4f8:190:11c2::b:1457]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c6a073c2-51c7-4451-8008-8a06cc411f2f; Wed, 15 Sep 2021 11:00:32 +0000 (UTC) Received: from zn.tnic (p200300ec2f0d07000c3d48728178681f.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:700:c3d:4872:8178:681f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 9F7E51EC0493; Wed, 15 Sep 2021 13:00:26 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c6a073c2-51c7-4451-8008-8a06cc411f2f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1631703626; h=from:from: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=VhruTfx6a1vn9bJbkqwEzxTY41J4MJGsLlefXt9yGLg=; b=AoZxQDh0ovGCZp36TVoMqssSPPir4S4CLUTje3ga2Sl4kb+jKndFyxzIQAdJXNZ2UdIJ6s kfLUqWGA4EkHlLtO7vdZeGBKfn+T4gB2KoAzSvk/LcfcYioMbDg/OWsjZTxwkOGmMUGJ43 XiSdKkF3s8/MlzVxKAN0eN5YeTY07vg= Date: Wed, 15 Sep 2021 13:00:20 +0200 From: Borislav Petkov To: Juergen Gross Cc: Jan Beulich , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= , xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: Re: [PATCH] x86/setup: call early_reserve_memory() earlier Message-ID: References: <20210914094108.22482-1-jgross@suse.com> <6cdc71dc-c26d-5c59-b7dd-0eb47ab9c861@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6cdc71dc-c26d-5c59-b7dd-0eb47ab9c861@suse.com> You forgot to Cc Mike, lemme add him. And drop stable@ too. On Tue, Sep 14, 2021 at 01:06:22PM +0200, Juergen Gross wrote: > On 14.09.21 12:03, Jan Beulich wrote: > > On 14.09.2021 11:41, Juergen Gross wrote: > > > Commit a799c2bd29d19c565 ("x86/setup: Consolidate early memory > > > reservations") 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() to the beginning of > > > setup_arch() in order to avoid such problems. > > > > > > Cc: stable@vger.kernel.org > > > Fixes: a799c2bd29d19c565 ("x86/setup: Consolidate early memory reservations") > > > Reported-by: Marek Marczykowski-Górecki > > > Signed-off-by: Juergen Gross > > > --- > > > arch/x86/kernel/setup.c | 24 ++++++++++++------------ > > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > > index 79f164141116..f369c51ec580 100644 > > > --- a/arch/x86/kernel/setup.c > > > +++ b/arch/x86/kernel/setup.c > > > @@ -757,6 +757,18 @@ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) > > > void __init setup_arch(char **cmdline_p) > > > { > > > + /* > > > + * 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. > > > > Hmm, this part of the comment is not only stale now, but gets actively > > undermined. No idea how likely such a panic() would be, and hence how > > relevant it is to retain this particular property. > > Ah, right. > > The alternative would be to split it up again. Let's let the x86 > maintainers decide which way is the better one. > > > Juergen > > > > > Jan > > > > > + * 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_X86_32 > > > memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); > > > @@ -876,18 +888,6 @@ void __init setup_arch(char **cmdline_p) > > > parse_early_param(); > > > - /* > > > - * 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 > > > > > > -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette