Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp243101lqs; Thu, 13 Jun 2024 08:55:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+pMHI6fOoAXIcneTmfPnGwcqUsregczyRQWIWMPC5P4eoj+Zhvo+XTB/vM/O3ggFXJy+XTy3b0SmeyVe3flpMt3ghr7OgQNQ2SqwGqA== X-Google-Smtp-Source: AGHT+IEjx7JG6Qq0Pezbwoc2SIyTeIlQDk83wE2b6Ge1xcba5Bc/6bDQca5hkq8dHcGFfJ1fqmrb X-Received: by 2002:a05:6902:52f:b0:dfa:7798:ef80 with SMTP id 3f1490d57ef6-dfe68a1e8eamr5175136276.59.1718294120599; Thu, 13 Jun 2024 08:55:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718294120; cv=pass; d=google.com; s=arc-20160816; b=wvjCM0q0uEr484J8gaQ47b90UW6xPpI5cwStiQK+4Nam718JruN6EjxmEf+3+kJvFG tR30luBaeUjSYd7ldcGoRYFFPoVe0KM6IdU2pNDdVDCf3JvU7a5aleSaERmsduIY0YFx 32QC+eY4wLTw2AezMo6GhIKzeXtwl6mnPNL3IrAx230I2W4UpG6mIii9Mu3Wpb2Gb8qU 5OueRuT1iMhRYTYJ4k7AROrBsa+BX9Uu1eY59kycMawnHrBja4VReN1FHJ2nMsTo0XgB e6cj2VSlFCl3DpwsLmS73he40lxjwHhBr/H2oYnVtkh4FpmH4+fBl2DdBm1MSS38g2/z Hnew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=w+ZXZPQClapHT/X2vMnzpm9JbMo83C3snvSkDU+A3xM=; fh=utmKxJnE0qV2HUjB57CT0YlCxA/Y7V1+mXeSYrRW87A=; b=Ng8Jkji2cgyw3qe+HuYFEYehm056TTN9QPkYuheXvCCOVbLF4l3/51b6SUJ1meaiMv NY/AjQSgTzcMr40IJcVFd3RaoIinjUwCm5uxeVCmSdtbuxGdBEibk55+lo99X7Kl0Msa 4i/BAUeQqJlhfhmtMx50oUr2SrTWbpVjSwFeaLaxKtN+ngHmt+lBQjzo2wGyJQ93YxOr obQPRXlJv+TNmXC7ek1dGVNVXz1iHrkVdNiYQGx69qvjMMxtM5ejUo9SbIVzqPBDcYZt Li1TBXnFajm+unGo0vDpmHWp8wyI6wkyH0rj0WA0XZ3GTmoM9EDSOJZrUKclw0zr8YGp 2zRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-213609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213609-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5afe04fsi17725416d6.192.2024.06.13.08.55.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 08:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-213609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213609-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 456C61C24054 for ; Thu, 13 Jun 2024 15:55:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCBAD12FF8E; Thu, 13 Jun 2024 15:55:07 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C69612EBCE; Thu, 13 Jun 2024 15:55:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718294107; cv=none; b=Vaa4mv3RuiFjh/GKnym2Xy/na1Mk15YBgzajHNWn3U9PWBs967Uh7aqG1tbe5kyrZKcOpARien9AaX6eLVXxhNg0hAW1Z47icco6Nw/7rKTgcFaEzMttWnKDwpIdYWMc5XTOgyrL6bwgD5nIbRqtXpyH6FTRPCipOhcG557yyeQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718294107; c=relaxed/simple; bh=Esf3q33brjoqUwaXiIkQEpGg/NSTn3JNAhG3HUzu698=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ecrG/gY5Y9PxgFRxt88yjqN03AXghPZMayer8Mf7vapE3rYfsyrtWxOz9MNhu3PesbSYOABUTq2EW4BejZ5wVIYYFPfU7/OCiUiD9pcFvrL5Kewuy4k/4DMifWteCtxmsXuwRxb+xE2mXqehDoHHpa9cpl9oZMioATqE/kouFYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8EE3C32786; Thu, 13 Jun 2024 15:55:06 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sHmnP-00000001jn0-2ONq; Thu, 13 Jun 2024 11:55:27 -0400 Message-ID: <20240613155527.437020271@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 13 Jun 2024 11:55:07 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Vincent Donnefort , Joel Fernandes , Daniel Bristot de Oliveira , Ingo Molnar , Peter Zijlstra , suleiman@google.com, Thomas Gleixner , Vineeth Pillai , Youssef Esmat , Beau Belgrave , Alexander Graf , Baoquan He , Borislav Petkov , "Paul E. McKenney" , David Howells , Mike Rapoport , "Guilherme G. Piccoli" Subject: [PATCH v6 1/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up References: <20240613155506.811013916@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: "Steven Rostedt (Google)" In order to allow for requesting a memory region that can be used for things like pstore on multiple machines where the memory layout is not the same, add a new option to the kernel command line called "reserve_mem". The format is: reserve_mem=nn:align:name Where it will find nn amount of memory at the given alignment of align. The name field is to allow another subsystem to retrieve where the memory was found. For example: reserve_mem=12M:4096:oops ramoops.mem_name=oops Where ramoops.mem_name will tell ramoops that memory was reserved for it via the reserve_mem option and it can find it by calling: if (reserve_mem_find_by_name("oops", &start, &size)) { // start holds the start address and size holds the size given This is typically used for systems that do not wipe the RAM, and this command line will try to reserve the same physical memory on soft reboots. Note, it is not guaranteed to be the same location. For example, if KASLR places the kernel at the location of where the RAM reservation was from a previous boot, the new reservation will be at a different location. Any subsystem using this feature must add a way to verify that the contents of the physical memory is from a previous boot, as there may be cases where the memory will not be located at the same location. Not all systems may work either. There could be bit flips if the reboot goes through the BIOS. Using kexec to reboot the machine is likely to have better results in such cases. Link: https://lore.kernel.org/all/ZjJVnZUX3NZiGW6q@kernel.org/ Suggested-by: Mike Rapoport Tested-by: Guilherme G. Piccoli Signed-off-by: Steven Rostedt (Google) --- .../admin-guide/kernel-parameters.txt | 22 ++++ include/linux/mm.h | 2 + mm/memblock.c | 117 ++++++++++++++++++ 3 files changed, 141 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index b600df82669d..56e18b1a520d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5710,6 +5710,28 @@ them. If is less than 0x10000, the region is assumed to be I/O ports; otherwise it is memory. + reserve_mem= [RAM] + Format: nn[KNG]::