Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1800215rwd; Mon, 15 May 2023 03:17:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ImCnDRQ5Vging9uOf6F79F1l+2mydWC7V8epP7pqU8dcLOA79VAY0tYyNlVJYCXVOmD5y X-Received: by 2002:a17:90a:fd93:b0:252:7118:4713 with SMTP id cx19-20020a17090afd9300b0025271184713mr16965917pjb.17.1684145824495; Mon, 15 May 2023 03:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684145824; cv=none; d=google.com; s=arc-20160816; b=t0VAGEHQsr8FE2Yzq7erkLC+06DDqg/YlWBYnOKYiKCEwZnBEJ+f7MYQjGsq9N88Lk VadpZFKaUR1ttn6s/rQAqtemw8hBCU6y8/JjcMa2p1GTnrFFOtNtXk2goHdQ4OfWxzUm PIv/lJIIX2WokcVji6GVlnVtadocj8cl+XtdI0b1iy5XlO+iAVGHkfxXndL7lY28tDmD sow2uPIbpo3lFRaGOTTsugOwY8MmkKLpM3zqestJSgqXCfYrBuXts78zybZiswI5ARDQ E7V++NtkP+34fPNoblV8yeyOQ+bjJQ/DdVEdCa4vhTePcU5QquuC5C8p90qMaWwJjMBt adjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=G8znqVw87JzE/GiUPHNFG+C6yuIz096Ng+G8V1HRe2s=; b=RqQw4PUdZ8G/Rmpc+jjqq30ILt/lDZarpZt5tSGreI84eN+DcPYAiSE6ux55QHol/M wJVb9KZPB7lZ9na7n3tAl7JMBIaENr/ouIWObi4vKI0nYlqru7WWIW8JuodMDVNB0NYe xBAsR7XgxNNhP32B3BUcCkiPp2x9uCh4xr/KiemC12wv9bjsiEt7Kv2S8Q6T6xMNjrx4 78ZwBTgBGrBaH7wikPwHa78QlQl98v2KutIZmtwnfIj3647tX//nKCj0LLIHsLSTlG8e yINcwsLfzFgc/HBXikgfpVv4EgKVY1a6ozQ8lPBbwvjEOZPGnXZ7SWS+uBZBLBMTn9aW o8dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zp5laAS+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a17090a740d00b0024dec84c2fcsi29186852pjg.122.2023.05.15.03.16.51; Mon, 15 May 2023 03:17:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zp5laAS+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239795AbjEOKIt (ORCPT + 99 others); Mon, 15 May 2023 06:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240422AbjEOKIc (ORCPT ); Mon, 15 May 2023 06:08:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 987811FD0 for ; Mon, 15 May 2023 03:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684145236; 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=G8znqVw87JzE/GiUPHNFG+C6yuIz096Ng+G8V1HRe2s=; b=Zp5laAS+YKm5zfkxIeyXzETcG1CxIMJFF0YMutuRY8Uv1PloJAA+MVorO3oZUB0moPxQGz zfEj/fz8soXsbm/fr2QjBrkK3i/9IJuVk3iqkt2ooXDI74RkcjcX6GtzjGqgPSpabXJcsM NJZgmW5z9+Kqej6dpHhE7dOFssokgM8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-wcpg3rWqOrmEqBjfNuUdxw-1; Mon, 15 May 2023 06:07:13 -0400 X-MC-Unique: wcpg3rWqOrmEqBjfNuUdxw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22CE43C0F22F; Mon, 15 May 2023 10:07:13 +0000 (UTC) Received: from localhost (ovpn-12-32.pek2.redhat.com [10.72.12.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B7FF63ABB; Mon, 15 May 2023 10:07:12 +0000 (UTC) Date: Mon, 15 May 2023 18:07:09 +0800 From: Baoquan He To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, horms@kernel.org, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 1/2] arm64: kdump: simplify the reservation behaviour of crashkernel=,high Message-ID: References: <20230515060259.830662-1-bhe@redhat.com> <20230515060259.830662-2-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230515060259.830662-2-bhe@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/15/23 at 02:02pm, Baoquan He wrote: > On arm64, reservation for 'crashkernel=xM,high' is taken by searching for > suitable memory region top down. If the 'xM' of crashkernel high memory > is reserved from high memory successfully, it will try to reserve > crashkernel low memory later accoringly. Otherwise, it will try to search > low memory area for the 'xM' suitable region. Please see the details in > Documentation/admin-guide/kernel-parameters.txt. > > While we observed an unexpected case where a reserved region crosses the > high and low meomry boundary. E.g on a system with 4G as low memory end, > user added the kernel parameters like: 'crashkernel=512M,high', it could > finally have [4G-126M, 4G+386M], [1G, 1G+128M] regions in running kernel. > The crashkernel high region crossing low and high memory boudary will bring > issues: > > 1) For crashkernel=x,high, if getting crashkernel high region across > low and high memory boundary, then user will see two memory regions in > low memory, and one memory region in high memory. The two crashkernel > low memory regions are confusing as shown in above example. > > 2) If people explicityly specify "crashkernel=x,high crashkernel=y,low" > and y <= 128M, when crashkernel high region crosses low and high memory > boundary and the part of crashkernel high reservation below boundary is > bigger than y, the expected crahskernel low reservation will be skipped. > But the expected crashkernel high reservation is shrank and could not > satisfy user space requirement. > > 3) The crossing boundary behaviour of crahskernel high reservation is > different than x86 arch. On x86_64, the low memory end is 4G fixedly, > and the memory near 4G is reserved by system, e.g for mapping firmware, > pci mapping, so the crashkernel reservation crossing boundary never happens. > From distros point of view, this brings inconsistency and confusion. Users > need to dig into x86 and arm64 system details to find out why. > > For kernel itself, the impact of issue 3) could be slight. While issue > 1) and 2) cause actual impact because it brings obscure semantics and > behaviour to crashkernel=,high reservation. > > Here, for crashkernel=xM,high, search the high memory for the suitable > region only in high memory. If failed, try reserving the suitable > region only in low memory. Like this, the crashkernel high region will > only exist in high memory, and crashkernel low region only exists in low > memory. The reservation behaviour for crashkernel=,high is clearer and > simpler. > > Note: RPi4 has different zone ranges than normal memory. Its DMA zone is > 0~1G, and DMA32 zone is 1G~4G if CONFIG_ZONE_DMA|DMA32 are enabled by > default. The low memory end is 1G in order to validate all devices, high > memory starts at 1G memory. However, for being consistent with normla > arm64 system, its low memory end is still 1G, while reserving crashkernel > high memory from 4G if crashkernel=size,high specified. This will remove > confusion. > > With above change applied, summary of arm64 crashkernel reservation range: > 1) > RPi4(zone DMA:0~1G; DMA32:1G~4G): > crashkernel=size > 0~1G: low memory | 1G~top: high memory > > crashkernel=size,high > 0~1G: low memory | 4G~top: high memory > > 2) > Other normal system: > crashkernel=size > crashkernel=size,high > 0~4G: low memory | 4G~top: high memory > > 3) > Systems w/o zone DMA|DMA32 > crashkernel=size > crashkernel=size,high > 0~top: low memory > > Signed-off-by: Baoquan He > > arm64: kdump: fix warning reported by static checker > Signed-off-by: Baoquan He Sorry, forgot cleaning up this relic of local patch merging, have resent one to remove it, and add Catalin's Reviewed-by tag. Thanks Baoquan