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 F370EC4345F for ; Wed, 1 May 2024 16:13:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E7866B0087; Wed, 1 May 2024 12:13:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5719F6B0088; Wed, 1 May 2024 12:13:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C2A96B0089; Wed, 1 May 2024 12:13:35 -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 1D4326B0087 for ; Wed, 1 May 2024 12:13:35 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8FE8EA0B6D for ; Wed, 1 May 2024 16:13:34 +0000 (UTC) X-FDA: 82070322348.01.CDCA9DB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id E3F2440017 for ; Wed, 1 May 2024 16:13:32 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SK76njsD; spf=pass (imf17.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 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=1714580013; 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=Aw9lf5sPa5PWSp7uV1A86FDCi3Jf3ZFSX8U93wKWbeE=; b=KlKuYUWrdH3UtZnkjYHJjzX3ZeEilczYv3wsI2CoHSaDhChG4VgrtrQctdKm3+9+E+MtZY FJxcp0xKi/84E5GqXBQdGjrez80i9HR8bglsu4Jp45Krw+BWFwOG5h+mj0CiYULGDNTFou C6YJuyhoUDdsVyh3dYXsdrwvY7hmFZk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SK76njsD; spf=pass (imf17.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714580013; a=rsa-sha256; cv=none; b=fz3BX9XlyeCglPYjOQ3JcRgcMuYe41vfR+WLmkgbb2dePBvZZtVZHpGLWE1cY2hfOQXo5/ T6nVH+pTrG4DAS+QZlEWssAx1m40QjCNtqRg8ELrl93yQRbAJ20o2T01uPG7vnOthhdIAB CU7frvDKodDgaLR/CXMNm4W/xSpK7oQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C368A6144C; Wed, 1 May 2024 16:13:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FA2DC072AA; Wed, 1 May 2024 16:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714580011; bh=dFzfiSp+K+7eC8iqd8lGaatDkcEc0b44t6mRfekFWs0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SK76njsD/UbgyWhKEa5gdiXSDYZ7FmYrHbjk4phy4JQ/5y++dgaAoK7dFrTnpbgJm wWqEsJ5UHazwnyXBq6qImP5pWtHrNCce6zW2vPHGcBPotG1/tWoiJPC2bQ6ETPpuLD 4EzW/uEvNHTm/x3mPEh/1agcO0v6woJRSKhugvfmwXAyGCT3/BtkrU9EYh/7s8n7Yc WJ4yH29ddvKTUhqJTvKmHJYADF6hgHLpuh5KVdp95Du1ZUbMx2Ry/MJLU/peSJ02Gx rJdVEZoG89TjPu1YbCz0ASGT8cme30P+XUQHFhwv9omUtihZ90EV6FDEgjt4eNqLjE 7Jutct3+m0Z2Q== Date: Wed, 1 May 2024 19:11:58 +0300 From: Mike Rapoport To: Steven Rostedt Cc: "Guilherme G. Piccoli" , "Luck, Tony" , Kees Cook , Joel Fernandes , "linux-kernel@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes , "linux-mm@kvack.org" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "x86@kernel.org" , "H. Peter Anvin" , Peter Zijlstra , "linux-hardening@vger.kernel.org" , Guenter Roeck , Ross Zwisler , "wklin@google.com" , Vineeth Remanan Pillai , Suleiman Souhlal , Linus Torvalds , Catalin Marinas , Will Deacon Subject: Re: [POC][RFC][PATCH 0/2] pstore/mm/x86: Add wildcard memmap to map pstore consistently Message-ID: References: <202404091519.B7B2221@keescook> <3391c693-cf54-526b-79a8-d565e7140947@igalia.com> <20240411154007.5bdf8d95@gandalf.local.home> <20240412132243.053ad096@gandalf.local.home> <20240501105455.42b78a0b@gandalf.local.home> <20240501120904.61c7617c@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240501120904.61c7617c@gandalf.local.home> X-Rspamd-Queue-Id: E3F2440017 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: h9633zjjor8qth7obc9tswiphz1fwpoz X-HE-Tag: 1714580012-671016 X-HE-Meta: U2FsdGVkX1920sGh9zyj51vexZ1T1jyVVbJ5rdRJ+TqpkWWxvPILeuDk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zu3HrlTcNLB2XgvIhvl6zdTn3HZG3LNPjrwNgOeCdebonNbMwNDfvCcJobiPLbS+LEwBwR400GD/GLz7h+WaMd/53gJtPgS0Tn2B3nBxCt//iew22GFJhPgrG+qJKOUFNZDTG0Da3wc8FEfEDfY1zhDc5 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: List-Subscribe: List-Unsubscribe: On Wed, May 01, 2024 at 12:09:04PM -0400, Steven Rostedt wrote: > On Wed, 1 May 2024 18:30:40 +0300 > Mike Rapoport wrote: > > > > > /* > > > > * Parse early_reserve_mem=nn:align:name > > > > */ > > > > static int __init early_reserve_mem(char *p) > > > > { > > > > phys_addr_t start, size, align; > > > > char *oldp; > > > > int err; > > > > > > > > if (!p) > > > > return -EINVAL; > > > > > > > > oldp = p; > > > > size = memparse(p, &p); > > > > if (p == oldp) > > > > return -EINVAL; > > > > > > > > if (*p != ':') > > > > return -EINVAL; > > > > > > > > align = memparse(p+1, &p); > > > > if (*p != ':') > > > > return -EINVAL; > > > > > > > > start = memblock_phys_alloc(size, align); > > > > > > So this will allocate the same physical location for every boot, if booting > > > the same kernel and having the same physical memory layout? > > > > Up to kaslr that might use that location for the kernel image. > > But it's the same as allocating from e820 after kaslr. > > > > And, TBH, I don't have good ideas how to ensure the same physical location > > with randomization of the physical address of the kernel image. > > I'll try it out. Looking at arch/x86/boot/compressed/kaslr.c, if I read the > code correctly, it creates up to a 100 slots to store the kernel. > > The method I used was to make sure that the allocation was always done at > the top address of memory, which I think would in most cases never be > assigned by KASLR. > > This looks to just grab the next available physical address, which KASLR > can most definitely mess with. On x86 memblock allocates from top of the memory. As this will run later than e820, the allocation will be lower than from e820, but still close to the top of the memory. > I would still like to get the highest address possible. > > -- Steve -- Sincerely yours, Mike.