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 82A49C27C7A for ; Tue, 11 Jun 2024 14:40:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4A376B009D; Tue, 11 Jun 2024 10:40:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF9466B009E; Tue, 11 Jun 2024 10:40:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B72D66B009F; Tue, 11 Jun 2024 10:40:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9967F6B009D for ; Tue, 11 Jun 2024 10:40:35 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3FAD8A0F59 for ; Tue, 11 Jun 2024 14:40:35 +0000 (UTC) X-FDA: 82218868830.20.561961F Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf18.hostedemail.com (Postfix) with ESMTP id 190DE1C000A for ; Tue, 11 Jun 2024 14:40:32 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mv3OyNrl; spf=pass (imf18.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718116833; h=from:from:sender:reply-to: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=CD74/Q6BwBYrB0ifBeus+QerIwpQuK+1OT0JxpVCDgY=; b=JTD7LTu5KXUynhO5B9QaV1Cr+lPcBqn09+enEcz7pC9ny6GVcFkMbWfu/Q/7ELl5JNQ5zU Y3KUDWxAkHu91IwdsGeB389eFW7NmqAB2eQzvEi969ICWydjOFVty8Vb39maoM9Jy8q0R2 2HF2oxI/RLXlXdlA/KQxgKq8+pHmWDo= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mv3OyNrl; spf=pass (imf18.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718116833; a=rsa-sha256; cv=none; b=urJ7S2w/rLbcEmjmSSlj1w8pDHmgZoP1AUJUEWISyRUDbS/ZAGNl4fGhqDRxvo1aNH+HIz GRsMFS8mX4DDIaSSzBX/K6f2qKG08GLmm9bprCgvpdiFj9hhCGVN3r3ddanMcFfB7UFvkw /RllxCTJhtvW++XVM2aOT5ZFHkV8XVc= Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-57ca578ce8dso107983a12.2 for ; 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=kvack.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=mv3OyNrlpM6MzmnlJN/d2b2IpxCE1tqQDhIPMNBtxBfsiNuQ+3mxVjgapbRN9MnDJc n//TWU7W4bTJOi0d7coSHIDdpsizvzQCPI/EzCN/jg2yNSf7Ht/YJ6TG5msE7rcsqLnp kIDrKSIQtjW9J8PrUzLfgU6bmrpHw2GI5Yh4tBgMPSuKE55oTb6+/HH/pJeB3wBkoFoK wowVr0BqwEMF7SAemadQCS5obCIf+LojjrxVDP5ce9DbBYoX6wUke3rl1r1TK35vCEEb YXY3NnE03ohDFunBTWrXGMdjVvREEAbvFI2aKkknnahLOiI0kYcslwL263dX/YMleIkq WVQQ== 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=Tdc52FAPuAcPAqa3szb4N4nlnfIe4dC/LEskbiBChANmgD7ZI09/0XZZP1bRQ3RFwQ Zv2P9ifr555WdJPoBqRPeYLO5JWq+eOPmwLfWnnkkDlAP1nLvyWD/ccrm40ZDtQiIuHK iC6I9iStYz/Bb+fUxB9+9uX/ouJskxFlmuoyFgSUI+3tnBan/W1HwinGQ/5W2VvFULub aNrqBifLkgrnsC6iaGd7OtAMstv0OXP27QvE0Y+JceDVnrarO3DXLu6NTaFeWXHp5xam QtYDMKclFUmcXHcd97oQ03hCLrUtJ1qjMzmhs3ucyCJ0iOm4w4WMXfRjmVJZzfCErxQU mOXw== X-Forwarded-Encrypted: i=1; AJvYcCW3iURTJv6nL2N91aZPPgHoHpMeUSBSWZtVzzo2qpVVBSuY+8zxQvSGZEDTKRQmP60dVt2Nn0JkYAGvEPj3RbJS/fA= X-Gm-Message-State: AOJu0YwsByDJlYca5+Aoy3F0A9AB2S+DtAEAExn9F2Q05I6F0+p6Fhj4 jFMs70UEmOYpWq9R48GH1TBl/9FESLZdsEf0HV+iDdMbmx3bQrRI X-Google-Smtp-Source: AGHT+IETTSmb9f2mSZl1DzcL730oxQUbsn9eKmJZp9/x4oOat5y9b76ZBSsAyPdKyr0ZFXTiyYPY+w== 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> 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) X-Rspamd-Queue-Id: 190DE1C000A X-Rspam-User: X-Rspamd-Server: rspam09 X-Stat-Signature: uj8ifpcdky1kpt7on1g6y5kgbf1dqb7p X-HE-Tag: 1718116832-4176 X-HE-Meta: U2FsdGVkX1+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DPlat8VLQIh347PCah8cda1vlStQ6bm1mou5167fkky6SjjavsWrKZi5OIQF5hWoYdoHCowYO9MANMjGg+DRR052q95jaSbAuEb6lZJsE+gbyv6JOkFrEi7wjR2NXlZxPpR2naUqZIsSVfdo0nsiXTneT/yYBTSXU+0lBs6dKZ0u0QvqygiFUKUvcI+9X7k4K4q5FgKBfgezAf2zSmTTfI8nZ0yTHlUIeKAJAGEOIQT8VdvPLPVssn5nyDNkm9jbrA/60csfq6VtjbSA5ywyXZDB7H0gmZmXiWtPKic9+LZnvWca2KeYFMFMzggaKYS5QLdRbn6w+NYlmTPXpU1X4qSqp0nd4trFNzPSSFmkUrnZF26KCFAixyjeCXw+UXpwjJ4rcDJIsm63IiKJ19K1tZDeDl9hyPPPf8MHOU3Lx8z76E9U1v9sfrYrBHhwFG/sQGb6IwyAN+qtW9G/H18A4V6ETTYL8a5VP38sRlj6SZ/LktTLCgMRMpDvSiFJ/M4y/kzCtLSNhKQ/Jx1ylw8PhX+vQqE18Yj5UvNqxC9htnMboNunk+9mCTBzca7aqtNzjufXj8wq5h6hseYbdiei2LdAQh2S/w9wc3ioyclhBD 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 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]::