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 BABB1C04AA5 for ; Thu, 25 Aug 2022 07:48:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3526E940007; Thu, 25 Aug 2022 03:48:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3030A6B0075; Thu, 25 Aug 2022 03:48:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CA42940007; Thu, 25 Aug 2022 03:48:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0D1F46B0074 for ; Thu, 25 Aug 2022 03:48:45 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D251581867 for ; Thu, 25 Aug 2022 07:48:44 +0000 (UTC) X-FDA: 79837338168.03.F7D831D Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf03.hostedemail.com (Postfix) with ESMTP id 1EFD520002 for ; Thu, 25 Aug 2022 07:48:42 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38A45B826BF; Thu, 25 Aug 2022 07:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FB93C433D7; Thu, 25 Aug 2022 07:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661413719; bh=dQKKQ6rhEloN80vnbe6U+fegbAvUdopbeJMAvtIxeJs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HfTOxogQpjcTXyROKDnxZKor+jiOMfeJ+0KNfJwxtE3mgA0Xmwl+LnH+mBtCHpG69 aHlFw5k+hSqJ7HSRxVX8hY3Uas7I4miAePUMWXRUHRhycnej5Zlr5iytNWZIKmbZJq OtrJhVALfvEfkefQwiUP8TGEKUWJ2tZlQthU0dsxmnxjyi7q/uFF1P1rT0jYZ6AAsx pcDJFM3Y5G9vyU4YChRDMBGPZOk1c42KFzw8XFec3PY0XiETXK078KXrWcV21LOrbh MoEXRYIQOsKJUeEcqFPacnMQo+L94HDVrm3L9ecAH/6HT3N0zEyJGojIqlCE8bf0Ca e/6RTdOYHV/0A== Date: Thu, 25 Aug 2022 10:48:21 +0300 From: Mike Rapoport To: Baoquan He 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661413723; a=rsa-sha256; cv=none; b=2G2cfYR5J6CP6tJelqv+81SnnN2wMZEpJjNQDTbnp5W09VoA1Z6ucHCxs23dzLlpQetSQN /gDgdriP+2x2NcFfs0yNGHvl0XKU9tNUrj4f7VMYWtJ2goYXXp2fW/XrNAJ/2KrwPMuS96 AQKUb2JvJY8UNwd2Kl9y/50MrsxiEbw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HfTOxogQ; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661413723; 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=k9Osj8ijieR6aeaWRxz5TJL8P0bwqYoK2ANCsjI1fCU=; b=jknLxWaKl/W1MWq0Sk6a/iUXYWOpxqLh2iN8SmOwhSe7/j6F7T+uqwVDT0wJenF4jZUZBb GkhJILc6yemvQabu6bVIla8+74x5X8M81dtZ4Bat9clucudU9RY3iqhIf9BZM1yy3/ikH4 90FX4zHy9r4fPZfFp3oRsRO5os928j8= Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HfTOxogQ; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: gxcpyg9d5q8kzyj8jiohuzs3zayrouym X-Rspamd-Queue-Id: 1EFD520002 X-HE-Tag: 1661413722-839865 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: Hi Baoquan, On Thu, Aug 25, 2022 at 03:35:04PM +0800, Baoquan He wrote: > Add kexec list in CC > > On 08/19/22 at 07:11am, Mike Rapoport wrote: > > From: Mike Rapoport > > > > Hi, > > > > 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. 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. > Thanks > Baoquan > -- Sincerely yours, Mike.