Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp395979lqp; Tue, 11 Jun 2024 07:40:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJ/7NBvC7CC9/2FpXRAPTJZw3f38o2tpQQa3SXrHYRwOyZWYJCfDCA60W2NmaGXt+V0SufJ+CasKCAdP2BcnpfEAyoXRnC5O1EJRqkWg== X-Google-Smtp-Source: AGHT+IHDXR3C4rPhenbW6rdI5vI5MAdxFjFq7H0brZ/ZeeLWCllno4ugvkzQLw7Wu6tIt+cvKwAg X-Received: by 2002:a17:906:3c06:b0:a6f:1f5d:4db5 with SMTP id a640c23a62f3a-a6f1f5d4e67mr384423166b.34.1718116842560; Tue, 11 Jun 2024 07:40:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718116842; cv=pass; d=google.com; s=arc-20160816; b=sZ9euZ+2RpFgtukbRqt4W1Th3B2eo9aDzd0LGTwvo3U0hjJMrhouoF/JafyyrZcVtV KAbjWX15wqoSdfu3LYSELStgjR/bklyPf4PcpyqEBIu/FNLR/MdaYf89IZguWJ6fOlDr IHAv+NExU5redw1ttXMIeX+AiWTlxslfgr+YbAxXI6+1R/DqB+ODgdO3JEDJEEB+jnsa XzF53e1wEJQD1+B2DFPIc+E6UJznU2OsG3GvlDV6Z7oPORaQxFGcRv1tJCewLnEPjiDn uAi/A0qZYw9+tG7eHa8XX+/huarI+BnCgXh+gfmP2f3HS/+qqQjJxFnQO1Exd1F95lDK srvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=CD74/Q6BwBYrB0ifBeus+QerIwpQuK+1OT0JxpVCDgY=; fh=QvFmG5ck199R9XVq1fLSzy+4huFM1FKEK2V2h/BJm/w=; b=JehlZ98h44KQYO6tqtbFhUvOiw5lf4w0zxaNn8E/g3gwYsppwmjjd1hqhf0KA4TRYN yDesByhH65ei0DRkgVQ8motqPhrMocDcILYql30p/5H4C4D3tlzDHuIkMwc1Acvh9H5x aMyGkR3ipmv4L2OQ2ax/7pKorwD3b+q57aksIfyYJZUrZZQWPBdZQTkwBvEAv/lt1LGD 2h/DQ2iUn5oiRBBdkNSQZoYPgO1u+sjh9DyeTpb42BooQgSzqGFuXJxYDAxSbMMZHTvn QAaldE+0eaxUf2nq1BckygeNR8bHGnCfHMZt/+h8pM/M4irTJWE65+UAS1wkLn3ehkPZ JsjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iE6jUO9I; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c6f4c1bbesi3631114a12.79.2024.06.11.07.40.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 07:40:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=iE6jUO9I; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210073-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 214771F23C2E for ; Tue, 11 Jun 2024 14:40:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C03817DE0A; Tue, 11 Jun 2024 14:40:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iE6jUO9I" Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19D1017D898; Tue, 11 Jun 2024 14:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718116835; cv=none; b=ooZ11Oy7gCie9cUOJvP/EX0txIxiu5y/5WSJ1iQa+Q66s7uMlGNH8Mkf7ktCRQWYHIX1jIGJr5h3OKfOYqeNSlWoXfy6d8Gg/7mE5rNjjOH45qcgtoUe/ZbvsOOr4jESRNeLZJ60zgkR6uPTtXDaM9kbVGu6aluEwz6RxJ2pdOQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718116835; c=relaxed/simple; bh=E+eifSgiqjt0/Xb7FI0O+6SLORcIIdWOsj17VsAssYA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fgr9PhchtgrSOn+Z07vFCVgvnX1cGX5ljVgxCUk9iH5ftyVpAkxrZj2j7ZhY5qrDWuoRY6aBkVOpAg7Qla8h1s9OYDzb3RuL+xLYlgg69c/evAnHRQRGTKnpFaTbQYOVwN2qQXlbeeLEmFrgwwAwwFmL/oXhPWXDTEsM1KAq41A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iE6jUO9I; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a6f176c5c10so129936066b.2; Tue, 11 Jun 2024 07:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718116831; x=1718721631; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=CD74/Q6BwBYrB0ifBeus+QerIwpQuK+1OT0JxpVCDgY=; b=iE6jUO9IZgUTtXbL2BUhuIbqQBr262KkNyrNC2geNCgFzhRBdQGXjuwXzIa3c0hZH1 uQqxawdSrGVoTWZre6jmTnrfoQ5R6hbWoHiisNOKn6hhIUIR9oKRR6ekpMQulNoTEPQ3 yB+9raoWGdklYWwi5N9xGtnPOOJjYnE0/pfI2E8Ujx4xdjZ+YzHwqwQxCIJSpH3nwia3 wEXxfcwiZWtA60fddc2dlwRsfXnFxcs4ojs4TQvMzlbSP5kNLcX+hKYGcQifYOZf96Kt 6dEpUuAwZq2MrldraoLh8gQlktMy3rR9f9kLxj/Ph6kSPX2+hUyxqApS7pbqsObroKVW K+ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718116831; x=1718721631; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CD74/Q6BwBYrB0ifBeus+QerIwpQuK+1OT0JxpVCDgY=; b=rYAkbof44XMC9tqjjIs5AwEP8xI97zIgru7MhL0ufmyqOeT4x8R6Ktag33cFaCznIv 8DRMxs8k6eWWjGQ5ttrvzxENN4wHQTwaRi3KxjzaPg4l6giu9E6P42pUctJMvNjMlggj WSf1Gh12c4kPEQSZUPYnYXNrb/ZD+o2/nQsBoyMLNnTVkps87GpaChbu5VGrIfR2nW2y 0VxG5CqmCO1/RX0PJ1/1qFxe7zt+J1ME5EicYuQEmlpVgc0tXI6xd32V6wyvb2opOceX bl5QyHt99Sbil1axm7IHsn4xORv1I4AxstJJdfZVjSCfpworhWSld+54cMDLKf/QZW9N EZbQ== X-Forwarded-Encrypted: i=1; AJvYcCUvK1vsu7U9SD2BS8VUik0usSZvn40eYPKbMJAYdGTk+XQdIMe+ojdBndE4F+gf3RwlFnDQthwA9KYjT2fOl476KUxKk4DepqAgCvnDH28wMWl3frnE0kxkrqHr7UZZZXIk7e9yZcwaQSEWigytaCejSWX+ X-Gm-Message-State: AOJu0YwJnpND2xcb7epz8+/BG9/RFLEaqFFhuYwKPccN2P2WaKiz4nvR Q4qBGs02FXFNbWw709jU6M6I3VwNmfyDLj5NfwFQX3ngqUnFIU6DP5DPvm/dwPY= X-Received: by 2002:a17:906:b0ce:b0:a68:d2dd:e006 with SMTP id a640c23a62f3a-a6cd6d17d61mr867037466b.17.1718116831044; Tue, 11 Jun 2024 07:40:31 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f34591542sm115300466b.55.2024.06.11.07.40.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Jun 2024 07:40:30 -0700 (PDT) Date: Tue, 11 Jun 2024 14:40:29 +0000 From: Wei Yang To: Steven Rostedt Cc: 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 , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , linux-hardening@vger.kernel.org, Guenter Roeck , Ross Zwisler , wklin@google.com, Vineeth Remanan Pillai , Joel Fernandes , Suleiman Souhlal , Linus Torvalds , Catalin Marinas , Will Deacon , Ard Biesheuvel , Mike Rapoport Subject: Re: [PATCH v2 1/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up Message-ID: <20240611144029.h7egl4aif5mjlrwf@master> Reply-To: Wei Yang References: <20240606150143.876469296@goodmis.org> <20240606150316.751642266@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=us-ascii Content-Disposition: inline In-Reply-To: <20240606150316.751642266@goodmis.org> User-Agent: NeoMutt/20170113 (1.7.2) On Thu, Jun 06, 2024 at 11:01:44AM -0400, Steven Rostedt wrote: >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 >Signed-off-by: Steven Rostedt (Google) >--- > .../admin-guide/kernel-parameters.txt | 20 ++++ > include/linux/mm.h | 2 + > mm/memblock.c | 97 +++++++++++++++++++ > 3 files changed, 119 insertions(+) > >diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt >index b600df82669d..4b2f7fb8de66 100644 >--- a/Documentation/admin-guide/kernel-parameters.txt >+++ b/Documentation/admin-guide/kernel-parameters.txt >@@ -5710,6 +5710,26 @@ > 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]::