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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 AA694C433DB for ; Fri, 15 Jan 2021 11:56:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 20EF723884 for ; Fri, 15 Jan 2021 11:56:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20EF723884 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5FA8E8D015C; Fri, 15 Jan 2021 06:56:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A9E78D015B; Fri, 15 Jan 2021 06:56:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 497E58D015C; Fri, 15 Jan 2021 06:56:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 355E78D015B for ; Fri, 15 Jan 2021 06:56:28 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F0F89180AD817 for ; Fri, 15 Jan 2021 11:56:27 +0000 (UTC) X-FDA: 77707856814.19.stove42_3a173182752f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id CA4111ACC34 for ; Fri, 15 Jan 2021 11:56:27 +0000 (UTC) X-HE-Tag: stove42_3a173182752f X-Filterd-Recvd-Size: 4766 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Jan 2021 11:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610711786; 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: in-reply-to:in-reply-to:references:references; bh=zObvHdQHSyazzq0p6+Mc2WEcTxeRlNDLNsGnr9VLYLw=; b=GQKBdwVaVbKxi/Z2xDieADOIVkgp+XXW7LQgaigk+RVfCMlPxs3TJAMYo9MrY0rvhPmJ2s 2rM3ArqRPMigMmkaEddtemft6khWVX3QgVKzzEEhFwNbXTCGa4fIJ8z7j6fLHVFnmab8UF mWXlNLLyEv6WhRqIRQmuh31IuKoXZ1E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-544-0diXEYmwOtCqdwMF0aftgg-1; Fri, 15 Jan 2021 06:56:23 -0500 X-MC-Unique: 0diXEYmwOtCqdwMF0aftgg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09E3E802B40; Fri, 15 Jan 2021 11:56:21 +0000 (UTC) Received: from localhost (ovpn-12-38.pek2.redhat.com [10.72.12.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3807A5D74D; Fri, 15 Jan 2021 11:56:16 +0000 (UTC) Date: Fri, 15 Jan 2021 19:56:14 +0800 From: Baoquan He To: Mike Rapoport Cc: Andrew Morton , Andrea Arcangeli , Borislav Petkov , 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 0/2] x86/setup: consolidate early memory reservations Message-ID: <20210115115614.GB19300@MiWiFi-R3L-srv> References: <20210115083255.12744-1-rppt@kernel.org> <20210115114219.GA19300@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115114219.GA19300@MiWiFi-R3L-srv> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 01/15/21 at 07:42pm, Baoquan He wrote: > On 01/15/21 at 10:32am, Mike Rapoport wrote: > > From: Mike Rapoport > > > > Hi, > > > > David noticed that we do some of memblock_reserve() calls after allocations > > are possible: > > > > https://lore.kernel.org/lkml/6ba6bde3-1520-5cd0-f987-32d543f0b79f@redhat.com > > Thanks for CC-ing me, so I think the above patch from Roman is dangerous. > KASLR does put kernel randomly in a place, but we did a brutal parse to > get SRAT table so that we know where is hotpluggable area during boot > decompression stage. In kernel, at the beginning, we don't know that > before ACPI init. Roman's patch is wrong if I don't miss something. Sorry, I was wrong. Bottom up searching disregarding kernel end is good optimization. Please ignore this noise. > > I will add comment in that thread. > > Thanks > Baoquan > > > > > For now there is no actual problem because in top-down mode we allocate > > from the end of the memory and in bottom-up mode we allocate above the > > kernel image. But there is a patch in the mm tree that allow bottom-up > > allocations below the kernel: > > > > https://lore.kernel.org/lkml/20201217201214.3414100-2-guro@fb.com > > > > and with this change we may get a memory corruption if an allocation steps > > on some of the firmware areas that are yet to be reserved. > > > > The below patches consolidate early memory reservations done during > > setup_arch() so that memory used by firmware, bootloader, kernel text/data > > and the memory that should be excluded from the available memory for > > whatever other reason is reserved before memblock allocations are possible. > > > > The patches are vs v5.11-rc3-mmots-2021-01-12-02-00 as I think they are > > prerequisite for the memblock bottom-up changes, but if needed I can rebase > > then on another tree. > > > > Mike Rapoport (2): > > x86/setup: consolidate early memory reservations > > x86/setup: merge several reservations of start of the memory > > > > arch/x86/kernel/setup.c | 85 +++++++++++++++++++++-------------------- > > 1 file changed, 43 insertions(+), 42 deletions(-) > > > > -- > > 2.28.0 > >