Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp485137imu; Fri, 9 Nov 2018 00:41:11 -0800 (PST) X-Google-Smtp-Source: AJdET5eR33K9cvbzfvcDDGZcFNr6ZnXnG6qZtyEFveoDpwmCZkWmay0LXSZd6E5C82Va+f1y/J+W X-Received: by 2002:a63:4566:: with SMTP id u38mr6651897pgk.4.1541752871009; Fri, 09 Nov 2018 00:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541752870; cv=none; d=google.com; s=arc-20160816; b=WltnN8kaZWMCTJtv27Op8SIl8JZac94EqUdZETpYTdhkdWGDaaqn2XCOtVgw5oovMT BV780SRuV7GE4Qa6eHiH8wWQ2d9LKvSHLWxNL3k4vwuNmyJzM7TOowXVE9uwiWSWIAhY nLFDlI/sa1x/qHZJeZFlo6z8LBHgvhN3F3IThF5WQvQuxnSQCqyLKIm9uETraPNOVig2 ul1SaISLGgYo5LkiRtg/B+cUK7pK6wzFjHrAqvOvx5FExTauMB8XhFUGyQ8vNLz2EZuk vrETxwEkn7FQXtmKA90drspNKw31lIJPyUSKUEa43y3gtUiS06uo3j5juSPP+0jZHGWd Nh9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:subject:cc:to:from:date; bh=7F9Z8yO8u3CRRZIdNmg4XPbRfUs1Wc+bxwBdK5sqc2k=; b=FhP3HyFP1roRLofy3EUw+Gf7bvSLNnNbqpiq8dL0qYSKx/wA4IQPtjlIQxeZdwDQ9K 0Iqe/hWhs+rLsfrUN2T4oMTSCU57bHLed3SOqo6K45AT2TbtSUvpJSC17nJHhqrHp63j Pijg/wc6szArglEeIqO+f+cPTRn16+y1aAh4OgZUZ+BBfS3z3siMaVluk9AVyMpRHZm1 75gOPyrOs+LhTIQ1A1reUjgm4ZW9csO1K7jXQmvxovJUoj83VKuoT8cMLbAXik/KEhSQ fpTB0+j2kq3xpQGKvhCKpLzx13j3AXWyMglqN5outuGsYZ/HwNmz/pBmJTiiUUuMptMy igQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w66si6414681pgw.64.2018.11.09.00.40.54; Fri, 09 Nov 2018 00:41:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727725AbeKISS2 (ORCPT + 99 others); Fri, 9 Nov 2018 13:18:28 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38534 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727676AbeKISS2 (ORCPT ); Fri, 9 Nov 2018 13:18:28 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA98Z35F081954 for ; Fri, 9 Nov 2018 03:38:55 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nn192uar7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 09 Nov 2018 03:38:55 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Nov 2018 08:38:53 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 9 Nov 2018 08:38:51 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wA98codP64684168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Nov 2018 08:38:50 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0950A405B; Fri, 9 Nov 2018 08:38:50 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAA3AA4054; Fri, 9 Nov 2018 08:38:49 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.205.51]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 9 Nov 2018 08:38:49 +0000 (GMT) Date: Fri, 9 Nov 2018 10:38:48 +0200 From: Mike Rapoport To: =?utf-8?B?6ZmI5Y2O5omN?= Cc: Thomas Bogendoerfer , Ralf Baechle , Paul Burton , James Hogan , linux-mips , linux-kernel , rppt Subject: Re: [[PATCH]] mips: Fix switch to NO_BOOTMEM for SGI-IP27/loongons3 NUMA References: <20181108144428.28149-1-tbogendoerfer@suse.de> <20181108161823.GB15707@rapoport-lnx> <20181108175217.f55065d6115edbafd6aa3487@suse.de> <43783525-DEC2-46A5-A61E-4C3BF3DDE4A0@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 18110908-4275-0000-0000-000002DE3988 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18110908-4276-0000-0000-000037EB3B91 Message-Id: <20181109083847.GA7819@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-09_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811090081 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 09, 2018 at 10:54:26AM +0800, 陈华才 wrote: > Hi, > > It seems the patch below can solve many problems after switched to NO_BOOTMEM, because the memory allocation behavior is more similar as before. Yes, this should work. Still, simplifying the max_low_pfn evaluation has it's value regardless. > diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c > index 070234b..7a449d9 100644 > --- a/arch/mips/kernel/setup.c > +++ b/arch/mips/kernel/setup.c > @@ -839,6 +839,7 @@ static void __init arch_mem_init(char **cmdline_p) > > /* call board setup routine */ > plat_mem_setup(); > + memblock_set_bottom_up(true); > > /* > * Make sure all kernel memory is in the maps. The "UP" and > diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c > index 0f852e1..15e103c 100644 > --- a/arch/mips/kernel/traps.c > +++ b/arch/mips/kernel/traps.c > @@ -2260,10 +2260,8 @@ void __init trap_init(void) > unsigned long size = 0x200 + VECTORSPACING*64; > phys_addr_t ebase_pa; > > - memblock_set_bottom_up(true); > ebase = (unsigned long) > memblock_alloc_from(size, 1 << fls(size), 0); > - memblock_set_bottom_up(false); > > /* > * Try to ensure ebase resides in KSeg0 if possible. > @@ -2307,6 +2305,7 @@ void __init trap_init(void) > if (board_ebase_setup) > board_ebase_setup(); > per_cpu_trap_init(true); > + memblock_set_bottom_up(false); > > /* > * Copy the generic exception handlers to their final destination. > > > ------------------ Original ------------------ > From: "Mike Rapoport"; > Date: Fri, Nov 9, 2018 02:01 AM > To: "Thomas Bogendoerfer"; > Cc: "Ralf Baechle"; "Paul Burton"; "James Hogan"; "Huacai Chen"; "linux-mips"; "linux-kernel"; "rppt"; > Subject: Re: [[PATCH]] mips: Fix switch to NO_BOOTMEM for SGI-IP27/loongons3 NUMA > > > > On November 8, 2018 6:52:17 PM GMT+02:00, Thomas Bogendoerfer wrote: > >On Thu, 8 Nov 2018 18:18:23 +0200 > >Mike Rapoport wrote: > > > >> On Thu, Nov 08, 2018 at 03:44:28PM +0100, Thomas Bogendoerfer wrote: > >> > Commit bcec54bf3118 ("mips: switch to NO_BOOTMEM") broke SGI-IP27 > >> > and NUMA enabled loongson3 by doing memblock_set_current_limit() > >> > before max_low_pfn has been evaluated. Both platforms need to do > >the > >> > memblock_set_current_limit() in platform specific code. For > >> > consistency the call to memblock_set_current_limit() is moved > >> > to the common bootmem_init(), where max_low_pfn is calculated > >> > for non NUMA enabled platforms. > >> [..] > >> > >> As for SGI-IP27, the initialization of max_low_pfn as late as in > >> paging_init() seems to be broken because it's value is used in > >> arch_mem_init() and in finalize_initrd() anyway. > > > >well, the patch is tested on real hardware and the first caller of > >a memblock_alloc* function is in a function called by > >free_area_init_nodes(). > > Then, apparently, I've missed something else. > The Onyx2 I worked on is dead for a couple of years now ;-) > > >> AFAIU, both platforms set max_low_pfn to last available pfn, so it > >seems we > >> can simply do > >> > >> max_low_pfn = PFN_PHYS(memblock_end_of_DRAM()) > >> > > Should have been PHYS_PFN, sorry. > > >> in the prom_meminit() function for both platforms and drop the loop > >> evaluating max_low_pfn in paging_init(). > > > >sounds like a better plan. I'll prepare a new patch. > > > >Thomas. > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. -- Sincerely yours, Mike.