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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56F7AECAAD2 for ; Sun, 28 Aug 2022 08:37:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C297D6B0073; Sun, 28 Aug 2022 04:37:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD972940009; Sun, 28 Aug 2022 04:37:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA2BF940008; Sun, 28 Aug 2022 04:37:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9B9CF6B0073 for ; Sun, 28 Aug 2022 04:37:40 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 430C5A0733 for ; Sun, 28 Aug 2022 08:37:40 +0000 (UTC) X-FDA: 79848347880.10.D90F2B3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id E556D10004E for ; Sun, 28 Aug 2022 08:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661675858; 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=1J4JhukR56A8LBkxYrQ40MiScD/gDpk4lBoPQg0Po/Y=; b=JmUKVxhrvBHGWtAZg94HLHCFI5p4tZbdQafUQpYT5mrgiAE2fh1ZqMDZGbLMDGvEto/dlq IXa8ih6MOTntzmIRx0u9Y8+Cn90Wx+P2GR8huNqVae1v2mr1yeHkKq9INIeNNkh7FPerUD IcmBv6D+J2oX6o2Z9R5QrIvRByo4jYA= 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-563-AeM-wHoFOuyCuWeyRF405w-1; Sun, 28 Aug 2022 04:37:34 -0400 X-MC-Unique: AeM-wHoFOuyCuWeyRF405w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8BCA101A54E; Sun, 28 Aug 2022 08:37:33 +0000 (UTC) Received: from localhost (ovpn-12-25.pek2.redhat.com [10.72.12.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F4264010D2A; Sun, 28 Aug 2022 08:37:32 +0000 (UTC) Date: Sun, 28 Aug 2022 16:37:29 +0800 From: Baoquan He To: Mike Rapoport Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , kexec@lists.infradead.org, Catalin Marinas , Guanghui Feng , Mark Rutland , Mike Rapoport , Will Deacon , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: Re: [PATCH 0/5] arm64/mm: remap crash kernel with base pages even if rodata_full disabled Message-ID: References: <20220819041156.873873-1-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661675859; a=rsa-sha256; cv=none; b=QwBrXX/93FJ0ahg1tKRUf8F9setKVAjhuBtBm5CrNQl3GuLS5U2oMk/sEFffr4WDptU5dd VDWpiEQ+C3cHjhOPEtp9C98DRoxPgfMMnfaEmlCY15JnxmaTdMuv1tIgzfo7fgVA5W4GBf d2wEAokvqcoV0V/l6MWa0oiSgmD8YaM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JmUKVxhr; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661675859; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1J4JhukR56A8LBkxYrQ40MiScD/gDpk4lBoPQg0Po/Y=; b=M71u0iPKkJfmtcVcQG17NjerMwkfbanHo3bzDPzWvaF+fcV92F/X7r1auMZtaDIO2vVmyw WwKO8lnlQG22sGvbybt/fRRw5jtEtwh1tz/Qe6/M/+VtgCYJxvlFbz9eMhrjlBPy+iHB1x Ti1iWDylpw1vYj5IKuKFHsSLfskQ4vs= X-Stat-Signature: diigbijnauqki66bpjngem46447ujjss Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JmUKVxhr; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E556D10004E X-Rspam-User: X-HE-Tag: 1661675858-456440 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/25/22 at 10:48am, Mike Rapoport wrote: ...... > > > There were several rounds of discussion how to remap with base pages only > > > the crash kernel area, the latest one here: > > > > > > https://lore.kernel.org/all/1656777473-73887-1-git-send-email-guanghuifeng@linux.alibaba.com > > > > > > and this is my attempt to allow having both large pages in the linear map > > > and protection for the crash kernel memory. > > > > > > For server systems it is important to protect crash kernel memory for > > > post-mortem analysis, and for that protection to work the crash kernel > > > memory should be mapped with base pages in the linear map. > > > > > > On the systems with ZONE_DMA/DMA32 enabled, crash kernel reservation > > > happens after the linear map is created and the current code forces using > > > base pages for the entire linear map, which results in performance > > > degradation. > > > > > > These patches enable remapping of the crash kernel area with base pages > > > while keeping large pages in the rest of the linear map. > > > > > > The idea is to align crash kernel reservation to PUD boundaries, remap that > > > PUD and then free the extra memory. > > > > Hi Mike, > > > > Thanks for the effort to work on this issue. While I have to say this > > isnt's good because it can only be made relying on a prerequisite that > > there's big enough memory. If on a system, say 2G memory, it's not easy > > to succeed on getting one 1G memory. While we only require far smaller > > region than 1G, e.g about 200M which should be easy to get. So the way > > taken in this patchset is too quirky and will cause regression on > > systemswith small memory. This kind of sytems with small memory exists > > widely on virt guest instance. > > I don't agree there is a regression. If the PUD-aligned allocation fails, > there is a fallback to the allocation of the exact size requested for crash > kernel. This allocation just won't get protected. Sorry, I misunderstood it. I just went through the log and didn't look into codes. But honestly, if we accept the fallback which doesn't do the protection, we should be able to take off the protection completely, right? Otherwise, the reservation code is a little complicated. > > Also please note, that the changes are only for the case when user didn't > force base-size pages in the linear map, so anything that works now will > work the same way with this set applied. > > > The crashkernel reservation happens after linear map because the > > reservation needs to know the dma zone boundary, arm64_dma_phys_limit. > > If we can deduce that before bootmem_init(), the reservation can be > > done before linear map. I will make an attempt on that. If still can't > > be accepted, we would like to take off the crashkernel region protection > > on arm64 for now. > > I doubt it would be easy because arm64_dma_phys_limit is determined after > parsing of the device tree and there might be memory allocations of > possibly unmapped memory during the parsing. I have sent out the patches with an attempt, it's pretty straightforward and simple. Because arm64 only has one exception, namely Raspberry Pi 4, on which some peripherals can only address 30bit range. That is a corner case, to be honest. And kdump is a necessary feature on server, but may not be so expected on Raspberry Pi 4, a system for computer education and hobbyists. And kdump only cares whether the dump target devices can address 32bit range, namely storage device or network card on server. If finally confirmed that storage devices can only address 30bit range on Raspberry Pi 4, people still can have crashkernel=xM@yM method to reserve crashkernel regions. Thanks Baoquan