Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3892040pxb; Mon, 1 Feb 2021 07:18:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJybSdLBJL3M9U9VkB+gwE7FNqOpvgVb2IScTFmPpcc/qlCYv2RVK3jubllmzXOtLV/00wCX X-Received: by 2002:aa7:d395:: with SMTP id x21mr10383613edq.137.1612192731463; Mon, 01 Feb 2021 07:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612192731; cv=none; d=google.com; s=arc-20160816; b=QcljecKm50AyKTulkTQKuU32bXf7zsqE5n/wZqSLGKziF/ZPP5X1vsPPKGrJxAOGg6 zYGAO52+hpEyssOLR54PzKeVMxBldcTA4GTTytCXWw95V20zs3rD0ElrgewkgYJUR/gc oCgeT/GiB+FSIjeQNvAAF1SGmKkLYyCMhGhXRPdatLawZriujFC71xJrXEcTDUbJuMvS 3bi8ZCdEvu/Nq5xk+xKFAxAwT1MWwfDp96m0KlxnmxxcqF+h/ppkRNAZttk499hW1Ot8 nsmqXn7Cz4xQ2CEzXKaNH5nn0W06JgJ3YH/5n2z7fc1doPzZwugeFtjPDzneyp2JW5/W q9XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qJNG6049dtvcplJRxISBTNlmlRDAp6ZgnUx5xKnhzAM=; b=s1aRTjko5sg6bfo2TAI7rCdcH2/LNF7Nvsc815gHT6DtLxMO9MsjyG7unOVzwygPJZ yascNOjwJEfN3wvli9FPYq7EsLZyohErdX3CREoISoHqBV9U01AdM9eugVsgfEokaLSc hrzCu7IvdpvD9mvP5MnLBTBO9aFyTUNiqUYefQYLdh5itBicSz9MK3Mu2sDWaChpET0G k9G1WSjD9h6EskEWCk2iRB10N9hG9AknMPXFG2W2PuwmlZl/6qMHLXQhW1iaRAts+yT0 +zFv4/+RRgJj7D2Fgyo7SBb4S3mjBXRcqvt76OXsLluxtDhf1JeL2nD3CETmczrQkrFB fXww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NZ9yxDBE; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si12021537ejf.121.2021.02.01.07.18.25; Mon, 01 Feb 2021 07:18:51 -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=@redhat.com header.s=mimecast20190719 header.b=NZ9yxDBE; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbhBAPQC (ORCPT + 99 others); Mon, 1 Feb 2021 10:16:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44518 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbhBAO6D (ORCPT ); Mon, 1 Feb 2021 09:58:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612191345; 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=qJNG6049dtvcplJRxISBTNlmlRDAp6ZgnUx5xKnhzAM=; b=NZ9yxDBEnZIDZwaKPQdepm1lzEbP1U8ZVgnzTSodcoVQqZ4W3yfbLlmrnHwiLGLNC15OEU AwsZmqa7ceOV1O0lkCWIWktlhC32PYuIAE/ix3W0sRMbVaoyd/vTPCjLU7FnskqLguuHUX 5lbJJnNctox0IoZQQb+xofKLV9xLKNc= 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-286-g-eMEYKTNbGeF6HKF5rRQg-1; Mon, 01 Feb 2021 09:55:42 -0500 X-MC-Unique: g-eMEYKTNbGeF6HKF5rRQg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B32F802B47; Mon, 1 Feb 2021 14:55:40 +0000 (UTC) Received: from localhost (ovpn-12-141.pek2.redhat.com [10.72.12.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41ABC6F7E9; Mon, 1 Feb 2021 14:55:36 +0000 (UTC) Date: Mon, 1 Feb 2021 22:55:34 +0800 From: Baoquan He To: Mike Rapoport Cc: David Hildenbrand , Andrew Morton , Andrea Arcangeli , Borislav Petkov , Chris Wilson , "H. Peter Anvin" , Ingo Molnar , Linus Torvalds , =?utf-8?Q?=C5=81ukasz?= Majczak , Mel Gorman , Michal Hocko , Mike Rapoport , Qian Cai , "Sarvela, Tomi P" , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v4 1/2] x86/setup: always add the beginning of RAM as memblock.memory Message-ID: <20210201145534.GA9009@MiWiFi-R3L-srv> References: <20210130221035.4169-1-rppt@kernel.org> <20210130221035.4169-2-rppt@kernel.org> <56e2c568-b121-8860-a6b0-274ace46d835@redhat.com> <20210201112605.GA2357@MiWiFi-R3L-srv> <20210201143429.GJ242749@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201143429.GJ242749@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/21 at 04:34pm, Mike Rapoport wrote: > On Mon, Feb 01, 2021 at 07:26:05PM +0800, Baoquan He wrote: > > On 02/01/21 at 10:32am, David Hildenbrand wrote: > > > > > > 2) In init_zone_unavailable_mem(), similar to round_up(max_pfn, > > > PAGES_PER_SECTION) handling, consider range > > > [round_down(min_pfn, PAGES_PER_SECTION), min_pfn - 1] > > > which would handle in the x86-64 case [0..0] and, therefore, initialize PFN > > > 0. > > > > Sounds reasonable. Maybe we can change to get the real expected lowest > > pfn from find_min_pfn_for_node() by iterating memblock.memory and > > memblock.reserved and comparing. > > As I've found out the hard way [1], reserved memory is not necessary present. > > There could be a system that instead of reserving memory at 0xfe000000 like > in Guillaume's report, could have it reserved at 0x0 and populated only > from the first gigabyte... OK. I thought that we can even compare memblock.memory.regions[0].base with memblock.reserved.regions[0].base and take the smaller one as the lowest pfn and assign it to arch_zone_lowest_possible_pfn[0]. When we try to get the present pages, we still check memblock.memory with for_each_mem_pfn_range(). Since we will consider and take reserved memory into zone anyway, arch_zone_lowest_possible_pfn[] only impact the boundary of zone. Just rough thought, please ignore it if something is missed. Thanks Baoquan