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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 77067C433E6 for ; Thu, 25 Feb 2021 14:43:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28BBE64F1A for ; Thu, 25 Feb 2021 14:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbhBYOne (ORCPT ); Thu, 25 Feb 2021 09:43:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:59158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231248AbhBYOnZ (ORCPT ); Thu, 25 Feb 2021 09:43:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C24564E28; Thu, 25 Feb 2021 14:42:40 +0000 (UTC) Date: Thu, 25 Feb 2021 14:42:38 +0000 From: Catalin Marinas To: Baoquan He Cc: Chen Zhou , mingo@redhat.com, tglx@linutronix.de, rppt@kernel.org, dyoung@redhat.com, will@kernel.org, nsaenzjulienne@suse.de, corbet@lwn.net, John.P.donnelly@oracle.com, prabhakar.pkin@gmail.com, horms@verge.net.au, robh+dt@kernel.org, arnd@arndb.de, james.morse@arm.com, xiexiuqi@huawei.com, guohanjun@huawei.com, huawei.libin@huawei.com, wangkefeng.wang@huawei.com, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org Subject: Re: [PATCH v14 02/11] x86: kdump: make the lower bound of crash kernel reservation consistent Message-ID: <20210225144237.GA23418@arm.com> References: <20210130071025.65258-1-chenzhou10@huawei.com> <20210130071025.65258-3-chenzhou10@huawei.com> <20210224143547.GB28965@arm.com> <20210225070717.GG3553@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210225070717.GG3553@MiWiFi-R3L-srv> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 03:08:46PM +0800, Baoquan He wrote: > On 02/24/21 at 02:35pm, Catalin Marinas wrote: > > On Sat, Jan 30, 2021 at 03:10:16PM +0800, Chen Zhou wrote: > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > > index da769845597d..27470479e4a3 100644 > > > --- a/arch/x86/kernel/setup.c > > > +++ b/arch/x86/kernel/setup.c > > > @@ -439,7 +439,8 @@ static int __init reserve_crashkernel_low(void) > > > return 0; > > > } > > > > > > - low_base = memblock_phys_alloc_range(low_size, CRASH_ALIGN, 0, CRASH_ADDR_LOW_MAX); > > > + low_base = memblock_phys_alloc_range(low_size, CRASH_ALIGN, CRASH_ALIGN, > > > + CRASH_ADDR_LOW_MAX); > > > if (!low_base) { > > > pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n", > > > (unsigned long)(low_size >> 20)); > > > > Is there any reason why the lower bound can't be 0 in all low cases > > here? (Sorry if it's been already discussed, I lost track) > > Seems like a good question. > > This reserve_crashkernel_low(), paired with reserve_crashkernel_high(), is > used to reserve memory under 4G so that kdump kernel owns memory for dma > buffer allocation. In that case, kernel usually is loaded in high > memory. In x86_64, kernel loading need be aligned to 16M because of > CONFIG_PHYSICAL_START, please see commit 32105f7fd8faa7b ("x86: find > offset for crashkernel reservation automatically"). But for crashkernel > low memory, there seems to be no reason to ask for 16M alignment, if > it's taken as dma buffer memory. > > So we can make a different alignment for low memory only, e.g 2M. But > 16M alignment consistent with crashkernel,high is also fine to me. The > only affect is smaller alignment can increase the possibility of > crashkernel low reservation. I don't mind the 16M alignment in both low and high base. But is there any reason that the lower bound (third argument) cannot be 0 in both reserve_crashkernel() (the low attempt) and reserve_crashkernel_low() cases? The comment in reserve_crashkernel() only talks about the 4G upper bound but not why we need a 16M lower bound. -- Catalin 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=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 15466C433DB for ; Thu, 25 Feb 2021 14:44:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC68F64EB7 for ; Thu, 25 Feb 2021 14:44:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC68F64EB7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=11z2c4YAsKdj1oZR+MwhyhM8VwKYevJ00Ry6SlrKB9A=; b=Xl2SCIFbf/3t02B5s6k7EkDQl l2cva0BEdVWFIjRpVG8TARZXAwiXcwH0NXeoA9i7SOy9nlcadDEWTx34TJJG3OlTg9F86XKv7OZaY TUgqv+7VSufJmG43e1fqP+SeL8Y5CGKQ8+lwS5yEDLIXj2iDRO1S8cGRd3ygtGa6xMPJK1KJtPMua 0Ut2iKYtB5QHX1vuU2Cgis3qwQqOG9oXzB9m8l94849/Jv33MQxF+GsVCFssHAK9dVWmsaBQkS0N7 vJJEgj/czn+BEQo6Wa5Ndx9Qk7kQCEmd9BKhVXkZyJRHew+TCNNsx/Z55Xhq6RwVfW8MdeA7LGY6b DFl0Yo6Gg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFHqr-000255-JB; Thu, 25 Feb 2021 14:42:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFHqn-00023z-Os; Thu, 25 Feb 2021 14:42:46 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C24564E28; Thu, 25 Feb 2021 14:42:40 +0000 (UTC) Date: Thu, 25 Feb 2021 14:42:38 +0000 From: Catalin Marinas To: Baoquan He Subject: Re: [PATCH v14 02/11] x86: kdump: make the lower bound of crash kernel reservation consistent Message-ID: <20210225144237.GA23418@arm.com> References: <20210130071025.65258-1-chenzhou10@huawei.com> <20210130071025.65258-3-chenzhou10@huawei.com> <20210224143547.GB28965@arm.com> <20210225070717.GG3553@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210225070717.GG3553@MiWiFi-R3L-srv> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210225_094245_945763_A293108D X-CRM114-Status: GOOD ( 21.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wangkefeng.wang@huawei.com, linux-doc@vger.kernel.org, Chen Zhou , huawei.libin@huawei.com, guohanjun@huawei.com, will@kernel.org, corbet@lwn.net, mingo@redhat.com, dyoung@redhat.com, John.P.donnelly@oracle.com, arnd@arndb.de, xiexiuqi@huawei.com, horms@verge.net.au, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, james.morse@arm.com, rppt@kernel.org, prabhakar.pkin@gmail.com, nsaenzjulienne@suse.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 25, 2021 at 03:08:46PM +0800, Baoquan He wrote: > On 02/24/21 at 02:35pm, Catalin Marinas wrote: > > On Sat, Jan 30, 2021 at 03:10:16PM +0800, Chen Zhou wrote: > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > > index da769845597d..27470479e4a3 100644 > > > --- a/arch/x86/kernel/setup.c > > > +++ b/arch/x86/kernel/setup.c > > > @@ -439,7 +439,8 @@ static int __init reserve_crashkernel_low(void) > > > return 0; > > > } > > > > > > - low_base = memblock_phys_alloc_range(low_size, CRASH_ALIGN, 0, CRASH_ADDR_LOW_MAX); > > > + low_base = memblock_phys_alloc_range(low_size, CRASH_ALIGN, CRASH_ALIGN, > > > + CRASH_ADDR_LOW_MAX); > > > if (!low_base) { > > > pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n", > > > (unsigned long)(low_size >> 20)); > > > > Is there any reason why the lower bound can't be 0 in all low cases > > here? (Sorry if it's been already discussed, I lost track) > > Seems like a good question. > > This reserve_crashkernel_low(), paired with reserve_crashkernel_high(), is > used to reserve memory under 4G so that kdump kernel owns memory for dma > buffer allocation. In that case, kernel usually is loaded in high > memory. In x86_64, kernel loading need be aligned to 16M because of > CONFIG_PHYSICAL_START, please see commit 32105f7fd8faa7b ("x86: find > offset for crashkernel reservation automatically"). But for crashkernel > low memory, there seems to be no reason to ask for 16M alignment, if > it's taken as dma buffer memory. > > So we can make a different alignment for low memory only, e.g 2M. But > 16M alignment consistent with crashkernel,high is also fine to me. The > only affect is smaller alignment can increase the possibility of > crashkernel low reservation. I don't mind the 16M alignment in both low and high base. But is there any reason that the lower bound (third argument) cannot be 0 in both reserve_crashkernel() (the low attempt) and reserve_crashkernel_low() cases? The comment in reserve_crashkernel() only talks about the 4G upper bound but not why we need a 16M lower bound. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Date: Thu, 25 Feb 2021 14:42:38 +0000 From: Catalin Marinas Subject: Re: [PATCH v14 02/11] x86: kdump: make the lower bound of crash kernel reservation consistent Message-ID: <20210225144237.GA23418@arm.com> References: <20210130071025.65258-1-chenzhou10@huawei.com> <20210130071025.65258-3-chenzhou10@huawei.com> <20210224143547.GB28965@arm.com> <20210225070717.GG3553@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210225070717.GG3553@MiWiFi-R3L-srv> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Baoquan He Cc: wangkefeng.wang@huawei.com, linux-doc@vger.kernel.org, Chen Zhou , huawei.libin@huawei.com, guohanjun@huawei.com, will@kernel.org, corbet@lwn.net, mingo@redhat.com, dyoung@redhat.com, John.P.donnelly@oracle.com, arnd@arndb.de, xiexiuqi@huawei.com, horms@verge.net.au, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, james.morse@arm.com, rppt@kernel.org, prabhakar.pkin@gmail.com, nsaenzjulienne@suse.de On Thu, Feb 25, 2021 at 03:08:46PM +0800, Baoquan He wrote: > On 02/24/21 at 02:35pm, Catalin Marinas wrote: > > On Sat, Jan 30, 2021 at 03:10:16PM +0800, Chen Zhou wrote: > > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > > index da769845597d..27470479e4a3 100644 > > > --- a/arch/x86/kernel/setup.c > > > +++ b/arch/x86/kernel/setup.c > > > @@ -439,7 +439,8 @@ static int __init reserve_crashkernel_low(void) > > > return 0; > > > } > > > > > > - low_base = memblock_phys_alloc_range(low_size, CRASH_ALIGN, 0, CRASH_ADDR_LOW_MAX); > > > + low_base = memblock_phys_alloc_range(low_size, CRASH_ALIGN, CRASH_ALIGN, > > > + CRASH_ADDR_LOW_MAX); > > > if (!low_base) { > > > pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n", > > > (unsigned long)(low_size >> 20)); > > > > Is there any reason why the lower bound can't be 0 in all low cases > > here? (Sorry if it's been already discussed, I lost track) > > Seems like a good question. > > This reserve_crashkernel_low(), paired with reserve_crashkernel_high(), is > used to reserve memory under 4G so that kdump kernel owns memory for dma > buffer allocation. In that case, kernel usually is loaded in high > memory. In x86_64, kernel loading need be aligned to 16M because of > CONFIG_PHYSICAL_START, please see commit 32105f7fd8faa7b ("x86: find > offset for crashkernel reservation automatically"). But for crashkernel > low memory, there seems to be no reason to ask for 16M alignment, if > it's taken as dma buffer memory. > > So we can make a different alignment for low memory only, e.g 2M. But > 16M alignment consistent with crashkernel,high is also fine to me. The > only affect is smaller alignment can increase the possibility of > crashkernel low reservation. I don't mind the 16M alignment in both low and high base. But is there any reason that the lower bound (third argument) cannot be 0 in both reserve_crashkernel() (the low attempt) and reserve_crashkernel_low() cases? The comment in reserve_crashkernel() only talks about the 4G upper bound but not why we need a 16M lower bound. -- Catalin _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec