Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3461309pxb; Mon, 25 Jan 2021 17:32:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1QRzeYGKcEsBkcbilWUzEw6Oir2GHZ/pzbF3YZgvZOsrWnpn265MkbWgJH+qCSqGc4aBj X-Received: by 2002:a17:906:5846:: with SMTP id h6mr1959793ejs.521.1611624772420; Mon, 25 Jan 2021 17:32:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611624772; cv=none; d=google.com; s=arc-20160816; b=zZKmGRUSN7y7D9X7xcA36VPHAk590Sal5jT0VPpO77Z7L4QVn3nhUfTCf2QmGSr5Km j9wFFDpprfkOO2Xg+OnJqnOwlVaRn2GyaMjmd5x2COSWSCe8zf5RlWekg1CbZLxK+Xyr YH3HzI6E1PC5jGM/HRMBVhTymo6IhUYIu32q1Wji8hHbAWB1UooUX3BgdAAb0JwL59VL f8xH+SgOLgcLHZ4bd6BpveJc52ZHglI2AUvbM/jhtoDIeKjaGXYEM+Hq1RMl/OldajG+ iFMTmXH+ElYd7aDnOxRbv0H0p/M5zVopQkg0Kn7M+QkZ/jabazPrv5qPKAFApCxUy94A 8rSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+TCaFbdg4KelXLn9SPKHyv4vN7y4Nq66S6xqaowPGy8=; b=XLtWPCNMVoD+HgWAvm3pZQxtJq3XJd233RCkK/K25DM7tAENw8StLo3mOtpQ1BDUEh H6dzm/S+cunec48jR2TC0Kp2+2nDeO4zTbEevDb0mTGY8Whs0XzYANxHpqqse1SIFl4v 5Ul9D0ttDZG3/YBhI11hIuGocYjstxC5bVMe2Pd3tbdxRPG9XAK42+tEHLkSo+PT+zWs D9xpIYRalkJq5Q1nRyvP0Sq92CDh1Iwd4fD2ronN29ZLCol0/f5+YFPye8f54sUYAIYf PGJz1tD7MgT9PSzLYuymg/4FK0t3k+TkhshsFM7dmHm0CIWaUz5spdWO7oHylg0/+fHz ittw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ps+f1Wg2; 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=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p92si8440510edd.367.2021.01.25.17.32.28; Mon, 25 Jan 2021 17:32:52 -0800 (PST) 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=@alien8.de header.s=dkim header.b=ps+f1Wg2; 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=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730025AbhAYPSd (ORCPT + 99 others); Mon, 25 Jan 2021 10:18:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729747AbhAYOv2 (ORCPT ); Mon, 25 Jan 2021 09:51:28 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E36C061574 for ; Mon, 25 Jan 2021 06:50:47 -0800 (PST) Received: from zn.tnic (p200300ec2f09db0095810f165069682a.dip0.t-ipconnect.de [IPv6:2003:ec:2f09:db00:9581:f16:5069:682a]) (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 4D2A31EC0572; Mon, 25 Jan 2021 15:50:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1611586246; 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:in-reply-to:in-reply-to: references:references; bh=+TCaFbdg4KelXLn9SPKHyv4vN7y4Nq66S6xqaowPGy8=; b=ps+f1Wg2SvNQilg3jVkxCSoTCcvpurycqzelh9QttRfqxWuJvvPaD8eZlj+9rQucikvV5u p7xFwjuO+HAHgbmfAvcTqBsA+fd2tyS0eGSI9G9Zo3fNin8TJwXTQG8Us7mQig5hNKfi3u amJy0ribj2w6PnIixh7Q1qOO2slcUIk= Date: Mon, 25 Jan 2021 15:50:41 +0100 From: Borislav Petkov To: Mike Rapoport Cc: Andrew Morton , Andrea Arcangeli , Baoquan He , David Hildenbrand , "H. Peter Anvin" , Ingo Molnar , Mel Gorman , Michal Hocko , Mike Rapoport , Qian Cai , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: Re: [PATCH 1/2] x86/setup: consolidate early memory reservations Message-ID: <20210125145041.GD23070@zn.tnic> References: <20210115083255.12744-1-rppt@kernel.org> <20210115083255.12744-2-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210115083255.12744-2-rppt@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 15, 2021 at 10:32:54AM +0200, Mike Rapoport wrote: > From: Mike Rapoport > > The early reservations of memory areas used by the firmware, bootloader, > kernel text and data are spread over setup_arch(). Moreover, some of them > happen *after* memblock allocations, e.g trim_platform_memory_ranges() and > trim_low_memory_range() are called after reserve_real_mode() that allocates > memory. > > We did not observe corruption of these memory regions because memblock Make that "We" impersonal, passive voice pls. > always allocates memory either from the end of memory (in top-down mode) or > above the kernel image (in bottom-up mode). However, the bottom up mode is > going to be updated to span the entire memory [1] to avoid limitations > caused by KASLR. > > Consolidate early memory reservations in a dedicated function to improve > robustness against future changes. Having the early reservations in one > place also makes it clearer what memory must be reserved before we allow > memblock allocations. Would it make sense to have a check with a WARN or so to catch early reservations which get added after memblock allocations have been allowed? To catch people who don't pay attention... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette