Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1170184rwl; Fri, 24 Mar 2023 07:10:41 -0700 (PDT) X-Google-Smtp-Source: AKy350Yy8wjjolIzcdyiwmwcTjZ0cuZQjfT5sye3Uz+FNsCZ1KwGCZ/ufAgxXMolIx4HeqYpzzvA X-Received: by 2002:a17:906:7cc8:b0:932:8dc:5afe with SMTP id h8-20020a1709067cc800b0093208dc5afemr2512277ejp.67.1679667040992; Fri, 24 Mar 2023 07:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679667040; cv=none; d=google.com; s=arc-20160816; b=Io1Ww2OsHaaLotSt+BbK7lkjcl/CWHPwaJm9G/9eUkiLj0NoKfBD7xoEUh5OGxPoT6 30CRCwmeaXL+fPmhRMjTEjmwol72sSulX5FRberucO96pR5WeHLZA7Ui6G+G8PylTncc d1H81KXvELKdNrRYt5D83siAlEG7bVXGKUypUNghy/OCZRoLgR5nHBLJ8iIgVHo/ruZQ hE14OtmX2QnC9XjMEkMN4pNAF84b265Ju+myUaLKqzt+SGYWTJa4MFQbF45Pj52RqCpU IMIrBKBwaMWgReoXll7YzA0Khq8DCTHtltNPTnGgIlXy24atf1j+GOXUJp/UJ5XySd/X Ttkw== 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=O+tn/kXR61AO+WDaXgWWmPQgnXc7AQxt+1ZeYSataW8=; b=jwkTj87kkaG8wEtLVcA7cymvsAZ6srjUxxpeVUp4cGcOX/gVKtXmjMa3u1wRlglNHs u8+sGV3fKKNn2eEIS4SuVXiCMpemgUMayNOUCxfHMyulo8DokQoS0WtwthZHEGsNrM1O jNVMq/mIgsfyXhbbAepRAbQtSH90kxFPzNPY85eNRGzOjZL2DSJ1bmqChdos2Dh+1ZYT PtPVSK8uq3ap4zwjKY5p9gzI+zwYlpc8IGpR+69+hpddzNuBO7hoEJSMwI56a+3ZU+d6 9HLrL0QEzeDap2hdwIFFLFWzU4zfHaPGR8FZK2asWW0HFY1KlcHhecHIYa1lgbRheaUq E7Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MzS5MT0S; 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 io4-20020a17090780c400b0093ba70535e8si7135640ejc.767.2023.03.24.07.10.14; Fri, 24 Mar 2023 07:10:40 -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=MzS5MT0S; 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 S231737AbjCXOJQ (ORCPT + 99 others); Fri, 24 Mar 2023 10:09:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbjCXOJP (ORCPT ); Fri, 24 Mar 2023 10:09:15 -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 EBC4230E1 for ; Fri, 24 Mar 2023 07:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679666908; 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=O+tn/kXR61AO+WDaXgWWmPQgnXc7AQxt+1ZeYSataW8=; b=MzS5MT0SaQgulMactRzJ/ef+HSMYLMVFBFiWLH1x/jgLKsisMOcVbXtuAjrI9D9WBzGWsZ J3OXxkb5l5nBZu+euygpIpVRVzOw1DOWwcxqDJmp06WoEMEs/OmJV0dt+lg5FkfEjU3sWD oR5FJSCML0u79IqUCJbKn/4iC8khxks= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-81-XvGosRNcNVuckGVqssdLRg-1; Fri, 24 Mar 2023 10:08:21 -0400 X-MC-Unique: XvGosRNcNVuckGVqssdLRg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37FEB101A552; Fri, 24 Mar 2023 14:08:21 +0000 (UTC) Received: from localhost (ovpn-12-55.pek2.redhat.com [10.72.12.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51E1F492B0B; Fri, 24 Mar 2023 14:08:19 +0000 (UTC) Date: Fri, 24 Mar 2023 22:08:17 +0800 From: Baoquan He To: Catalin Marinas Cc: linux-kernel@vger.kernel.org, horms@kernel.org, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, will@kernel.org, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4] arm64: kdump: simplify the reservation behaviour of crashkernel=,high Message-ID: References: <20230306084124.300584-1-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 03/23/23 at 05:25pm, Catalin Marinas wrote: > On Mon, Mar 20, 2023 at 09:12:08PM +0800, Baoquan He wrote: > > On 03/17/23 at 06:05pm, Catalin Marinas wrote: > > > On Fri, Mar 17, 2023 at 11:09:13PM +0800, Baoquan He wrote: > > > > In fact, what I want to achieve is we set CRASH_ADDR_LOW_MAX to 4G > > > > fixedly on arm64, just like what we do on x86_64. As for RPi4 platform, > > > > we leave it to crashkernel=size@offset syntax. Two reasons for this: > > > > 1) crashkernel is needed on enterprise platform, such as workstation or > > > > server. While RPi4 is obviously not the target. I contacted several RPi4 > > > > players in Redhat and my friends, none of them ever played kdump > > > > testing. If they really have to, crashkernel=size@offset is enough for > > > > them to set. > > > > > > I'd like crashkernel=size (without @offset) on RPi4 to still do the > > > right thing: a low allocation at least as we had until recently (or > > > high+low where high here is maybe above 1GB). IOW, no regression for > > > this crashkernel=size case. We can then change the explicit > > > crashkernel=x,high to mean only above 4GB irrespective of the platform > > > and crashkernel=x,low to be below arm64_dma_phys_limit. > > > > Since crashkernel=,high and crashkernel=size fallback was added in arm64 > > recently, with my understanding, you are suggesting: > > > > on arm64: > > RPi4: > > crashkernel=size > > 0~1G: low memory (no regression introduced) > > And, if not enough low memory, fall back to memory above 1GB (for RPi4; > it would be above 4GB for any other system). > > > crashkernel=size,high > > 0~1G: low memory | 4G~top: high memory > > Yes. > > > Other normal system: > > crashkernel=size|crashkernel=size,high > > 0~4G: low memory | 4G~top: high memory > > Yes. > > IOW, specifying 'high' only forces the high allocation above 4GB instead > of arm64_dma_phys_limit, irrespective of the platform. If no 'high' > specified search_base remains CRASH_ADDR_LOW_MAX (1GB on RPi4, 4GB for > the rest). > > > > > 2) with the fixed CRASH_ADDR_LOW_MAX as 4G, we can easily fix the > > > > problem of base page mapping for the whole linear mapping if crsahkernel= > > > > is set in kernel parameter shown in [1] at bottom. > > > > > > That's a different problem ;). I should re-read that thread, forgot most > > > of the details but I recall one of the counter arguments was that there > > > isn't a strong case to unmap the crashkernel reservation. Now, if we > > > place crashdump kernel image goes in the 'high' reservation, can we not > > > leave the 'low' reservation mapped? We don't really care about it as it > > > wouldn't have any meaningful code/data to be preserved. If the 'high' > > > one goes above 4G always, we don't depend on the arm64_dma_phys_limit. > > > > Yes, this looks ideal. While it only works when crashkernel=,high case and > > it succeeds to reserve a memory region for the specified size of crashkernel > > high memory. At below, we have 4 cases of crashkernel= syntax: > > > > crashkernel=size > > 1)first attempt: low memory under arm64_dma_phys_limit > > 2)fallback: finding memory above 4G > > (2) should be 'finding memory above arm64_dma_phys_limit' to keep the > current behaviour for RPi4. Then for RPi4, with case 2), it will find memory above arm64_dma_phys_limit, namely 1G. Then it will get two memory regions, one could be in [1G, 4G], another is below 4G. I am fine with this, as long as it won't cause confusion that people may think two low memory regions you mentioned earlier. Please help confirm if I understand your suggestioin correctly. I will start making patch with this clarified. Thanks. > > > crashkernel=size,high > > 3)first attempt: finding memory above 4G > > 4)fallback: low memory under arm64_dma_phys_limit > > Yes. > > > case 3) works with your suggestion. However, 1), 2), 4) all need to > > defer to bootmem_init(). With these cases and different handling, > > reserve_crashkernel() could be too complicated. > > Ah, because of the fallback below arm64_dma_phys_limit as in (4), we > still can't move the full crashkernel reservation early. Well, we could > do it in two steps: (a) early attempt at crashkernel reservation above > 4G if 'high' was specified and we avoid mapping it if successful and (b) > do the late crashkernel reservation below arm64_dma_phys_limit and skip > unmapping as being too late. This way most server-like platforms would > get a reservation above 4G, unmapped. Yeah, this covers case 3), while other cases are still in pit. > > > I am wondering if we can cancel the protection of crashkernel memory > > region on arm64 for now. In earlier discussion, people questioned if the > > protection is necessary on arm64. After comparison, I would rather take > > away the protection method of crashkernel region since they try to > > protect in a chance in one million , while the base page mapping for the > > whole linear mapping is mitigating arm64 high end server always. > > This works for me. We can add the protection later for addresses above > 4GB only as mentioned above. Thanks, I have posted a patchset to cancel the protection on crashkernel memory region as per your confirmation here. This can give distros a chance to back port them to fix the performance issue caused by the base page mapping. I personally expect we can hold the crashkernel region unprotected till we have a ideal solution since the code will be elegant with comfortable simplicity. Let's wait and see the code change if people interested want to keep the protection methods.