Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1952971rwl; Fri, 24 Mar 2023 19:11:25 -0700 (PDT) X-Google-Smtp-Source: AKy350abHNfQyxSSgTgYRYEyIX1+x/XeUvV1Lj8JwTsQd8LTu1rxQ00LTYI3i3fxsWPGdpLai6F4 X-Received: by 2002:a17:906:a107:b0:932:365a:c1e7 with SMTP id t7-20020a170906a10700b00932365ac1e7mr5022020ejy.67.1679710284964; Fri, 24 Mar 2023 19:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679710284; cv=none; d=google.com; s=arc-20160816; b=CEKq6bcalJiUYGqYBKwunAe+GiNVp48CWhUZRsLOd1EQ+XUp7o0n7K8dUY2WbOXfyh 3loDyr8jnT/78qKjU506HNstUmKHj7mrN5E3SVNCr2KTAEPdv0L0/xOc36nWscSsVJa4 P0PWsby2oLAf9ZV+oqSqvT1e7Cw1E+jmyOT+sQux8QVHXkTghjZ0ze8VqUQejHskx/Go d69ySmaWA/P2jbsDXfXMy5ZZ0KP2veLzaUAVk2/76bfzqKo72ibEVvLvDZ/hWikOWlmc 5tSGKh4RxI9s4YCWv99YVDptkomhRamKmvITGdngIx8OxSUPL0btqr26e9qmfQapwCZO Khrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=pDjUwwmYpyvlnSZV2KN0mAK7x0dJ/Ztbtf49zEw9U1Y=; b=l7DLfaWJedKHlRyibcKsX7JEQRMncbKv2kQuPu/Vti9I/mZw5m69xFmUIf9fpeO9CV 5VdYaN++4ck7ezG/w/JJAT87ZpeTlalnVJGLamQz4iPLn8AAu/R7htc0/pyumBl0MLK/ SfYt4/3lEAsfZkTzlI3wLH41qzHqcM3qlMbPTmdyW90kk53iiW386/UIEkc9vt2bkX84 /5LKotiicbKPC31gHvw6RD8NKam5Iod+3czG4tSdh2/caQXp8OD5r6XU5slGbAqv/mPj MnbpyDAHcc3eVmUSyMO8d6EWoPsqEVwJrmsNjCY+t/g6iSJvbpGqO4PrTCEGhZw4yOcO 1XeQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca15-20020a170906a3cf00b008dd491949d5si22515872ejb.553.2023.03.24.19.11.00; Fri, 24 Mar 2023 19:11:24 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbjCYBxm (ORCPT + 99 others); Fri, 24 Mar 2023 21:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbjCYBxl (ORCPT ); Fri, 24 Mar 2023 21:53:41 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CCC2129 for ; Fri, 24 Mar 2023 18:53:39 -0700 (PDT) Received: from dggpemm500006.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Pk2C52DV1zrWWm; Sat, 25 Mar 2023 09:52:33 +0800 (CST) Received: from [10.174.178.55] (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.2507.21; Sat, 25 Mar 2023 09:53:36 +0800 Subject: Re: [PATCH v4] arm64: kdump: simplify the reservation behaviour of crashkernel=,high To: Baoquan He CC: Catalin Marinas , , , , , , References: <20230306084124.300584-1-bhe@redhat.com> <4d4ecdd6-9716-570d-5595-e47bfbb58cdf@huawei.com> From: "Leizhen (ThunderTown)" Message-ID: Date: Sat, 25 Mar 2023 09:53:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 2023/3/24 22:53, Baoquan He wrote: > Hi Leizhen, > > On 03/24/23 at 10:47am, Leizhen (ThunderTown) wrote: > ...... >>>>>> 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. >>> >>>> 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. >>> >>>> 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. >> >> Recently, I've also been rethinking the performance issues when kdump is >> enabled. I have a new idea. For crashkernel=X, we can temporarily search >> for free memory from the low address to the high address. As below: >> >> save_bottom_up = memblock_bottom_up(); >> if (!high) >> memblock_set_bottom_up(true); >> crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, crash_base, crash_max); >> memblock_set_bottom_up(save_bottom_up); >> >> The final code change should be small, and I'll try it today. > > I have sent a patchset to remove the crashkernel region protection code > as per Catalin's confirmation. I personally like the code conciseness w/o > protection because kinds of crahskernel reservation has been complex, > the situation on arm64 will makes it worse if we try to keep the > protection and fix the performance issue. While I am glad to see any > attempt to achieve the two goals if it's satisfactory. I saw the patchset. No protection is also a good idea, the code is simplified a lot. > > . > -- Regards, Zhen Lei