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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB1E3C433EF for ; Wed, 22 Dec 2021 13:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245412AbhLVNMo (ORCPT ); Wed, 22 Dec 2021 08:12:44 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:33896 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245325AbhLVNM0 (ORCPT ); Wed, 22 Dec 2021 08:12:26 -0500 Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JJtyT3TtlzcbyR; Wed, 22 Dec 2021 21:12:01 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 22 Dec 2021 21:12:24 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 22 Dec 2021 21:12:23 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH v18 06/17] x86/setup: Update comments in reserve_crashkernel() Date: Wed, 22 Dec 2021 21:08:09 +0800 Message-ID: <20211222130820.1754-7-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211222130820.1754-1-thunder.leizhen@huawei.com> References: <20211222130820.1754-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add comments to describe which bootup parameters are processed by the code, and make comments close to the code being commented. Signed-off-by: Zhen Lei --- arch/x86/kernel/setup.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 07a58313db5c5f7..52aa925877ca787 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -485,20 +485,20 @@ static void __init reserve_crashkernel(void) if (flag == CRASHKERNEL_MEM_NONE) return; - /* 0 means: find the address automatically */ 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. - * 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. + * For the case of crashkernel=X[@offset] and offset is omitted, + * try the low memory first. */ if (!(flag & CRASHKERNEL_MEM_HIGH)) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, CRASH_ADDR_LOW_MAX); + + /* + * If low memory allocation failed above, or for the case of + * crashkernel=X,high, try the high memory. + */ if (!crash_base) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, @@ -510,6 +510,10 @@ static void __init reserve_crashkernel(void) } else { unsigned long long start; + /* + * The case of crashkernel=X@offset and offset is specified. + * Only user-specified space can be reserved. + */ start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base, crash_base + crash_size); if (start != crash_base) { @@ -520,6 +524,10 @@ static void __init reserve_crashkernel(void) #ifdef CONFIG_X86_64 if (crash_base >= (1ULL << 32)) { + /* + * Ensure that at least 256M extra low memory is allocated for + * DMA buffers and swiotlb, if low memory size is not specified. + */ if (!(flag & CRASHKERNEL_MEM_LOW)) { /* * two parts from kernel/dma/swiotlb.c: -- 2.25.1 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41DC0C433EF for ; Wed, 22 Dec 2021 13:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nenV/Ke3NVLBP6DX5RYqmEfKVc9BoZ9IAGMvvoioHSM=; b=23jnkbMBCS2cuB ktGHaj5Y1FL05gLktx14w6Uq9w6FbyFefhPc/JTYyau1/Rp1tdtWT0lLagfrG13V8wQjTpFnNuoZA y2RccIBglXkztiEFL2LzUPLPd24vAI5YLION7pkFmz77n9ck9RIlT9FMqSgz2dXROiBjCH29hIW0h 6yweInwELOBYOoeCtVVdCGF0GyoXnwZMZl//FTrSoCSE6aPHgYg8RyEM5GNoMd9LUYsw7N88MJjvi 3UKL5qe8+UzySqUbZSxOLTJdf0KjInsUBjwkWmnsB4Czo7Flhiw4nMFOREHutDa3e9rtAn1BarNIj uLuYdl9d/gRiQFkV356Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n01SC-00AQbU-LK; Wed, 22 Dec 2021 13:14:48 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n01Pu-00APDK-D1; Wed, 22 Dec 2021 13:12:28 +0000 Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JJtyT3TtlzcbyR; Wed, 22 Dec 2021 21:12:01 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 22 Dec 2021 21:12:24 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 22 Dec 2021 21:12:23 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH v18 06/17] x86/setup: Update comments in reserve_crashkernel() Date: Wed, 22 Dec 2021 21:08:09 +0800 Message-ID: <20211222130820.1754-7-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211222130820.1754-1-thunder.leizhen@huawei.com> References: <20211222130820.1754-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_051226_820947_4E327D4A X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Add comments to describe which bootup parameters are processed by the code, and make comments close to the code being commented. Signed-off-by: Zhen Lei --- arch/x86/kernel/setup.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 07a58313db5c5f7..52aa925877ca787 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -485,20 +485,20 @@ static void __init reserve_crashkernel(void) if (flag == CRASHKERNEL_MEM_NONE) return; - /* 0 means: find the address automatically */ 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. - * 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. + * For the case of crashkernel=X[@offset] and offset is omitted, + * try the low memory first. */ if (!(flag & CRASHKERNEL_MEM_HIGH)) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, CRASH_ADDR_LOW_MAX); + + /* + * If low memory allocation failed above, or for the case of + * crashkernel=X,high, try the high memory. + */ if (!crash_base) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, @@ -510,6 +510,10 @@ static void __init reserve_crashkernel(void) } else { unsigned long long start; + /* + * The case of crashkernel=X@offset and offset is specified. + * Only user-specified space can be reserved. + */ start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base, crash_base + crash_size); if (start != crash_base) { @@ -520,6 +524,10 @@ static void __init reserve_crashkernel(void) #ifdef CONFIG_X86_64 if (crash_base >= (1ULL << 32)) { + /* + * Ensure that at least 256M extra low memory is allocated for + * DMA buffers and swiotlb, if low memory size is not specified. + */ if (!(flag & CRASHKERNEL_MEM_LOW)) { /* * two parts from kernel/dma/swiotlb.c: -- 2.25.1 _______________________________________________ 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: From: Zhen Lei Subject: [PATCH v18 06/17] x86/setup: Update comments in reserve_crashkernel() Date: Wed, 22 Dec 2021 21:08:09 +0800 Message-ID: <20211222130820.1754-7-thunder.leizhen@huawei.com> In-Reply-To: <20211222130820.1754-1-thunder.leizhen@huawei.com> References: <20211222130820.1754-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 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: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , linux-kernel@vger.kernel.org, Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , kexec@lists.infradead.org, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Rob Herring , Frank Rowand , devicetree@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org Cc: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , John Donnelly Add comments to describe which bootup parameters are processed by the code, and make comments close to the code being commented. Signed-off-by: Zhen Lei --- arch/x86/kernel/setup.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 07a58313db5c5f7..52aa925877ca787 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -485,20 +485,20 @@ static void __init reserve_crashkernel(void) if (flag == CRASHKERNEL_MEM_NONE) return; - /* 0 means: find the address automatically */ 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. - * 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. + * For the case of crashkernel=X[@offset] and offset is omitted, + * try the low memory first. */ if (!(flag & CRASHKERNEL_MEM_HIGH)) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, CRASH_ADDR_LOW_MAX); + + /* + * If low memory allocation failed above, or for the case of + * crashkernel=X,high, try the high memory. + */ if (!crash_base) crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, CRASH_ALIGN, @@ -510,6 +510,10 @@ static void __init reserve_crashkernel(void) } else { unsigned long long start; + /* + * The case of crashkernel=X@offset and offset is specified. + * Only user-specified space can be reserved. + */ start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base, crash_base + crash_size); if (start != crash_base) { @@ -520,6 +524,10 @@ static void __init reserve_crashkernel(void) #ifdef CONFIG_X86_64 if (crash_base >= (1ULL << 32)) { + /* + * Ensure that at least 256M extra low memory is allocated for + * DMA buffers and swiotlb, if low memory size is not specified. + */ if (!(flag & CRASHKERNEL_MEM_LOW)) { /* * two parts from kernel/dma/swiotlb.c: -- 2.25.1 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec