Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp993623pxk; Fri, 18 Sep 2020 00:27:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZYWH6uCd4ipQGifMvLpLVClzqQtcRc5H4rbAFhXtLsUcarQdo+lxttVSeGqFb5X7Ojm4s X-Received: by 2002:a50:fd0a:: with SMTP id i10mr36411582eds.277.1600414044939; Fri, 18 Sep 2020 00:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600414044; cv=none; d=google.com; s=arc-20160816; b=ydJc40u7uoPC8cm/8BJye9CXBdwQjc4M1I6bP2Jmm/o4zryeYRfq7zR1EJphV2ZOMc hw9zNXKxFSgiofIngkHkCIJGTD5K9okN53D5zYCqnrVZx+OI5n6H8Y3+yzGVhRp0t8iS 0TX9DtUGHIcuTHElMQXKieGVtt13FsbiwaGBPC+RdKfdrBn1auiy0uqu8p7y8I0ApBs8 hUeqmbvEP8RFXvLbFjNbkeWNhgofJ5polA5sQxuc9SwqjJ9XPn/0pyhUAud4GVZ6OsAr WlT1mRp8V8Lj03vLkZfc/Hdk5lSohLtTQvfA3qdPuEDYUpGXX4up7kkhLLdiFjnmu1uG 9j7A== 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=mqIgxLpQiWo1ZnzGLjH16sr1JY5Yhmtp14BB8uVAi5A=; b=Zd/IN7BgHTiXphsx3gEqo/zxIBHXbntfpJ/gTnulAxoGnGtCp8seVEfk3JgYgAn+iJ 7Q0Xli6gYWZk/lgyIg9Cr7JljRUKvxGwOwHmONpwLR1vOo+QybFGWPVHd4I8BRjoUlzn cuCt0XIxKlC9PDmtpLd65PTtCguEEYpM0An9rGbPcyTE3vuiyUZN4fF6gwALwosva6X5 ATPj/0/fZwEH1YKuyrYSJryKfQPi1Q7S0C1e4E2JifOJGrqfaaEAfSV7myXGiuqFocAc +7az3etjjdX4Nh5Y1KVjTeGXEPv9rf3aXZMyAePvKwPTbkUnRBEcq7zSOYYkV/WIfGJb LWXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IbeG4P6Z; 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 dp1si1713073ejc.662.2020.09.18.00.27.01; Fri, 18 Sep 2020 00:27:24 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IbeG4P6Z; 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 S1726793AbgIRHZm (ORCPT + 99 others); Fri, 18 Sep 2020 03:25:42 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:20779 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726360AbgIRHZm (ORCPT ); Fri, 18 Sep 2020 03:25:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600413940; 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=mqIgxLpQiWo1ZnzGLjH16sr1JY5Yhmtp14BB8uVAi5A=; b=IbeG4P6ZLbMJEZMDpbZ8Y1dNY1L+ke7QTbHKLcqoVdoxjW52w+2+0MPhJhoJHgfbbEG5ds /RIHsydGbk6wV3blk8nGlU7iVW6cTVTYfTh3EwoT6+wEJ3H/8IkRmfGY98WEUUSYzuS8hE UCXDDbMXmm/JMsCCLL450uIR4Zo6nZw= 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-563-nwmjKfwgO6id3kUaSUiMUQ-1; Fri, 18 Sep 2020 03:25:36 -0400 X-MC-Unique: nwmjKfwgO6id3kUaSUiMUQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6DB41018725; Fri, 18 Sep 2020 07:25:33 +0000 (UTC) Received: from localhost (ovpn-12-42.pek2.redhat.com [10.72.12.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D823460C13; Fri, 18 Sep 2020 07:25:29 +0000 (UTC) Date: Fri, 18 Sep 2020 15:25:26 +0800 From: Baoquan He To: Chen Zhou Cc: catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, tglx@linutronix.de, mingo@redhat.com, dyoung@redhat.com, corbet@lwn.net, John.P.donnelly@oracle.com, prabhakar.pkin@gmail.com, bhsharma@redhat.com, horms@verge.net.au, robh+dt@kernel.org, arnd@arndb.de, nsaenzjulienne@suse.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-doc@vger.kernel.org, guohanjun@huawei.com, xiexiuqi@huawei.com, huawei.libin@huawei.com, wangkefeng.wang@huawei.com, rppt@linux.ibm.com Subject: Re: [PATCH v12 3/9] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel[_low]() Message-ID: <20200918072526.GD25604@MiWiFi-R3L-srv> References: <20200907134745.25732-1-chenzhou10@huawei.com> <20200907134745.25732-4-chenzhou10@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200907134745.25732-4-chenzhou10@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 09/07/20 at 09:47pm, Chen Zhou wrote: > To make the functions reserve_crashkernel[_low]() as generic, > replace some hard-coded numbers with macro CRASH_ADDR_LOW_MAX. > > Signed-off-by: Chen Zhou > --- > arch/x86/kernel/setup.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > index d7fd90c52dae..71a6a6e7ca5b 100644 > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -430,7 +430,7 @@ static int __init reserve_crashkernel_low(void) > unsigned long total_low_mem; > int ret; > > - total_low_mem = memblock_mem_size(1UL << (32 - PAGE_SHIFT)); > + total_low_mem = memblock_mem_size(CRASH_ADDR_LOW_MAX >> PAGE_SHIFT); Just note that the replacement has been done in another patch from Mike Rapoport, partially. He seems to have done reserve_crashkernel_low() part, there's one left in reserve_crashkernel(), you might want to check that. Mike's patch which is from a patchset has been merged into Andrew's next tree. commit 6e50f7672ffa362e9bd4bc0c0d2524ed872828c5 Author: Mike Rapoport Date: Wed Aug 26 15:22:32 2020 +1000 x86/setup: simplify reserve_crashkernel() > > /* crashkernel=Y,low */ > ret = parse_crashkernel_low(boot_command_line, total_low_mem, &low_size, &base); > @@ -451,7 +451,7 @@ static int __init reserve_crashkernel_low(void) > return 0; > } > > - low_base = memblock_find_in_range(CRASH_ALIGN, 1ULL << 32, low_size, CRASH_ALIGN); > + low_base = memblock_find_in_range(CRASH_ALIGN, CRASH_ADDR_LOW_MAX, low_size, CRASH_ALIGN); > if (!low_base) { > pr_err("Cannot reserve %ldMB crashkernel low memory, please try smaller size.\n", > (unsigned long)(low_size >> 20)); > @@ -504,8 +504,9 @@ static void __init reserve_crashkernel(void) > if (!crash_base) { > /* > * Set CRASH_ADDR_LOW_MAX upper bound for crash memory, > - * crashkernel=x,high reserves memory over 4G, also allocates > - * 256M extra low memory for DMA buffers and swiotlb. > + * crashkernel=x,high reserves memory over CRASH_ADDR_LOW_MAX, > + * also allocates 256M extra low memory for DMA buffers > + * and swiotlb. > * But the extra memory is not required for all machines. > * So try low memory first and fall back to high memory > * unless "crashkernel=size[KMG],high" is specified. > @@ -539,7 +540,7 @@ static void __init reserve_crashkernel(void) > return; > } > > - if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) { > + if (crash_base >= CRASH_ADDR_LOW_MAX && reserve_crashkernel_low()) { > memblock_free(crash_base, crash_size); > return; > } > -- > 2.20.1 >