Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp13526ybz; Tue, 21 Apr 2020 03:47:30 -0700 (PDT) X-Google-Smtp-Source: APiQypIjAtUWH4aKQpKc0boEnlPa7vqNSety/aGKNG7RptO9z7s0P6t7PeHfZVcc2fJUkJ1EbY2x X-Received: by 2002:a50:9e2a:: with SMTP id z39mr18940843ede.178.1587466050220; Tue, 21 Apr 2020 03:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587466050; cv=none; d=google.com; s=arc-20160816; b=u2txNrG2y7jOBc/ejxDhUGHtvV6zC5h0Nb8cWsoX0G5TAbfyJHyDFr2X3Rc2bCdMTM xL0uSr3dckrI/TTbTFUqQB3zu/ZXxte6Y4Ttwkw15I4QneqfbuNEAIiw35E/o18twEqn zn+RrFvnf1vy3rJudx7Inx7p3/8r12E534hIGURd3bR07AGQO3SsUh4zj8onUmm7rD5q kpnEqUlT+sjE0NQ6rSDa9zqbxmMZcG4wI+/wdD7jZJ9G5JYRBvfk+TU8FbPPg2eE65Mq 8SpIodDoUVs5z0/B1stSKYWr63fZ/bxXaVg1ypBLSXppbPSZUXIrsc5eiFukze7AfFm/ RSKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=utGZRXXECRqn3xAYHc6L1gtwYW/vE6ZtwXqvLxQBQ5Y=; b=MzW5DSX0Ls3c/KYkrR2TcDa0byRT6gH+2mlyT5pBABLS9EIiB4PquszKJ2hfEJSwuw 4kmWDNj2JVn7yQuNRy8VKnzeLqK+t4uetdPuKOrq/kQOeT125UNKUNlmF79y3m4lWRnQ 20VwyHGy9ABsgs53KMPaANULPQdDkymrBB8CWPQcvbaetEYBw5u0fle/gLA2HPYYue8t XutZTRtMQObTiXr1ShZQ+Xm2ykuLKjdKnCda7O2rveZR9ylHn7JT9uns9dq0nE/an+w1 8JlrKC3rOWFzMnxIAe/XGX3t6IT5Yug/RJhnHEPUGxds9ysDCMIXsMt79Ra9/BZTTm5q CsNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@flygoat.com header.s=vultr header.b="P/FBQyCS"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id aq18si1322662ejc.201.2020.04.21.03.47.07; Tue, 21 Apr 2020 03:47:30 -0700 (PDT) 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=fail header.i=@flygoat.com header.s=vultr header.b="P/FBQyCS"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728533AbgDUKp3 (ORCPT + 99 others); Tue, 21 Apr 2020 06:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgDUKp3 (ORCPT ); Tue, 21 Apr 2020 06:45:29 -0400 Received: from vultr.net.flygoat.com (vultr.net.flygoat.com [IPv6:2001:19f0:6001:3633:5400:2ff:fe8c:553]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3545C061A0F; Tue, 21 Apr 2020 03:45:14 -0700 (PDT) Received: from flygoat-x1e (unknown [IPv6:240e:390:49b:be80::d68]) by vultr.net.flygoat.com (Postfix) with ESMTPSA id AC459204A5; Tue, 21 Apr 2020 10:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=vultr; t=1587465913; bh=DnSjaOgoALX2m+iSeVkiSgAR/vBfkUhTJ1AIukm8RPU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=P/FBQyCSpMosEP2ImcpLDQ+rg7+sVgJoUZq86JSCUbnsGa/GfcRcXknXKfr1nD+/U cADK2Led8HtfksaLuX07yKUj/byaAuV7MR8LgX0hInLB9vPJbaR5Lox/o1mX55LHLM E+FoI9zWIcYAn2nCu5ffwlPPcvf17sl3o8UXe7JcMBEG1x0mjMRsjwdgwK+mchXVKW 2oeGsJd6xtlHsH1fJhGoAS32EAzmOBGMXi6uvcM1cuTFjFFrRTl8VcAxz6nd7grIyz gVVo63K3XD6bJm0xzzn3Xhih1H/3B41JKdN4hXPPmMEwbD4B1Gs0cloD2lbsep/Uiu 536IuqO8Fay1Q== Date: Tue, 21 Apr 2020 18:45:00 +0800 From: Jiaxun Yang To: Tiezhu Yang Cc: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Juxin Gao Subject: Re: [PATCH 3/3] MIPS: Reduce possibility of kernel panic under CONFIG_SWIOTLB Message-ID: <20200421184500.368b7e2a@flygoat-x1e> In-Reply-To: <20200421173525.460949b0@flygoat-x1e> References: <1587459869-12183-1-git-send-email-yangtiezhu@loongson.cn> <1587459869-12183-4-git-send-email-yangtiezhu@loongson.cn> <20200421173525.460949b0@flygoat-x1e> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 Apr 2020 17:35:25 +0800 Jiaxun Yang wrote: > On Tue, 21 Apr 2020 17:04:29 +0800 > Tiezhu Yang wrote: > [...] > > AFAIK there are some reasons that we set it to bottom_up. > On some platforms, bootloader won't place cmdline & devicetree into > reserved memory but place them just after kernel in memory. That means > if you set it as bottom up, then early allocate memory might collide > with these boot arguments. Sorry please ignore it. I had a wrong impression on memory layout. It should be fine. Thanks. > > I'm not even sure if it works fine on Loongson with early PMON. > > I had met that issue before, the solution for me is to reduce SWIOTLB > size. > > > > > Reported-by: Juxin Gao > > Co-developed-by: Juxin Gao > > Signed-off-by: Juxin Gao > > Signed-off-by: Tiezhu Yang > > --- > > arch/mips/kernel/setup.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c > > index 5481a0c..8db533c 100644 > > --- a/arch/mips/kernel/setup.c > > +++ b/arch/mips/kernel/setup.c > > @@ -700,7 +700,17 @@ static void __init arch_mem_init(char > > **cmdline_p) memblock_reserve(crashk_res.start, > > resource_size(&crashk_res)); #endif > > device_tree_init(); > > + > > + /* > > + * In order to reduce the possibility of kernel panic when > > failed to > > + * get IO TLB memory under CONFIG_SWIOTLB, it is better to > > allocate > > + * low memory as small as possible before > > plat_swiotlb_setup(), so > > + * make sparse_init() using top-down allocation. > > + */ > > + memblock_set_bottom_up(false); > > sparse_init(); > > + memblock_set_bottom_up(true); > > + > > plat_swiotlb_setup(); > > > > dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); > > -- > Jiaxun Yang >