Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp75613lqp; Tue, 11 Jun 2024 15:26:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCSwBIH1mDATirdCQdlRii0R5vuEgcV1fxuioX4gZdd8+lVtw1oFoo6eR4QDD5ecr03TdzbwQL5x6BBzPTD6zMqy2OD/U9fcYR5YHBIQ== X-Google-Smtp-Source: AGHT+IGHYz7sQ/zJCoFdsZwezQdex7UDMPCMVZbtFPabNU0+O+H/nD9npO/skDRg2nHp8Ypk2dSm X-Received: by 2002:a17:902:eb4c:b0:1f6:daa6:e77b with SMTP id d9443c01a7336-1f83b78bdb8mr1875905ad.68.1718144779827; Tue, 11 Jun 2024 15:26:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718144779; cv=pass; d=google.com; s=arc-20160816; b=Dfm7JXcNsLjWr7y1mJhRiyfasyTcQbGzpMELaiDWU/8faUBXqsslBamN29/y1nOf22 ToPZz9zG1oIJ5dLPa6L1Dft/am6ZiVwzMYKqR1YPbEuODK3gZNHR/Y1m81k/5whlNNQ0 nCjgY3F8p716mh7qxe2Ejv8DyTdFAYxRXl3jCuhOSj7bFlOrNAOM8uWxcTAxakYwtqi8 I4rhJOfRDTKclAtx8y8AaPlVOX4tCzSFaDwqwfbCfb889PIaBTuV13O9DCgkdJPLC+Ih rpZkA+ZCCA6YS/BQbyLL53QST0s+wkX5ot5hq/HojEELNik1JEf4+SHoio0jZYIJsQ8/ UNyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=hGskSVQkT2mm+p3WVge1MIXMpsZtd5S/K/cQqHXRB6Q=; fh=QT5SCZpx8oXqgC1WaTUy0Do2CrRm2cH0pyfYKg0X8/U=; b=XtjlFuh7yzsw5AB8efbiVf+kdWwXQWUWFFg+Bfwm0g9C7ctxyEg7pVAYu5QYGaV0cq v5/W6RICai48WYZMEiXkoDNLKyCkzKvyp7qf9QUBdkOJ2Bte9Xhv+vESa0IfNfAVXCiA CuNwMp05L9Y9ws58TsmEHMHsKoTqegBr//ThLu8tfOB6KAeygWu76tsCAHjIiy5Ke7Th CmXyLuCafeHWW1LJUbyd1Y37FXPXhG+2mGDv+DVv8AbpoPzHgTrn3VS6Hm88G5Bk/7SZ /0n22c9CMV0lrLxipTrMtEOEG742DQDdLLTeka/KsNNQZp8sbs8f7WTBDL44jAD/KceO HTJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FQyW+b2U; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210663-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210663-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f7414d4c31si8545515ad.353.2024.06.11.15.26.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 15:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210663-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FQyW+b2U; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-210663-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210663-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 58B71282918 for ; Tue, 11 Jun 2024 22:26:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA52515532C; Tue, 11 Jun 2024 22:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FQyW+b2U" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 8404D18EAB; Tue, 11 Jun 2024 22:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718144772; cv=none; b=PK72SLYfnyGH1gcNsoJ7uKmtfiK+59gixjSYWrM5uofTscMnoEFuu87aP3t71M9LchON66ZAtPYfXIW/6nixy1EEzoiJeklRaAk0Agr1Im6tGyeAIEmtoUx2WaIaR2GPk7o6pRfitOKWsgaV9xO/eFT69U+B23ikU7tYKY94Jig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718144772; c=relaxed/simple; bh=97P3M9tSwxG1+WXAVu//u6Lo+Muf0Jlq0PIE3q2jHpY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=G9uPSU8xGCeOTa2Ou64ZUkc8lt0RMlpTl8jvv0JX0ZGIid1zgb4c0D58mktqPnpTUsWgvc5q/hhwptsrFkqKYXEq2i7bt6VhMjmsHUJUmQ8RA1arbbVKcZKwgT1Fs8nUWZVpkArNBaMHWiGzhMft8FHv82SP2ZBAyRW1Zdu00lE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FQyW+b2U; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-7041a7d4beeso3819957b3a.2; Tue, 11 Jun 2024 15:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718144770; x=1718749570; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=hGskSVQkT2mm+p3WVge1MIXMpsZtd5S/K/cQqHXRB6Q=; b=FQyW+b2U73mX+YkJo7ZaBPwynNK7YCmGoCzsJQ/ERPN4/vwqdvut9p4Gh18bdK6vdq pz7020kKyxBGA7LvOjCBl/FPLPTeKPyGb6JRgH8QLyuqsI5CdfQjJvYsNrPEfoogao0e JcF0KbGBSEFVfZPp+OEB9SoLFeUQADG0S0ofzez7wgR0cQcGIOVuPArNXdedluFYNx/M 1lGIfNrRhrzpq+Fc7YHzNXK84ggTUdIDDsuKMoP1s4dFrdgP5lkBNUrfLzqIgRWDaTYn IT7kzHVhSSFDyyl+LFiKeog8Us/SCsIpLkDFSfEzKqKXEMr+jyUWLbYD0NGPKg6aj6qY pGKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718144770; x=1718749570; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hGskSVQkT2mm+p3WVge1MIXMpsZtd5S/K/cQqHXRB6Q=; b=mxsOas7zRUivvmJQCvFhi3jfb1OkSwtPmQc3KENG5cBNfxyzkZtFFFN3GOpv+7+fdf GbqUihTYFkwsNEuR1P1U0BOrS8rx0jnuvyUBmJqZgUA93fFbwnj9xBD4a0WOEODSMghc rNjGXr/R+UHMvWOOEjCCq3iQS2VuwLG8u1ScAW8L2ESd+kyBPqMFnbLI9YtYErOi5pZs vxt8TFf+WeIJgZzXIL0Ii6R1Es8OAIObtLY2C/McWXq+9kC7XNjhXilQ9xIw5oiCK6C6 m1JEX20WK3AJZIGQ9wnnb7QY4lz+JUA1HhwhEgvagjhT1NKykjcvWqqEOOF+JtGBmL4K aLhw== X-Forwarded-Encrypted: i=1; AJvYcCXEVS/m4hpGpugDf9P99oIVG+36ueADHnLDgCdEglIuU1rrEAliUZLnn52zuG/RJucRs5WoC6MmULZBQO9D1PDAZdCJE1BNFNx2EJcTbAKx6daonjWwx8iXTe3yrSDM+UGmYkvyrPBBC43TptXCD4TZRr1iT+XJeMogfrn+v5AaYpudPq27oZemIhQvQBNRuaOp X-Gm-Message-State: AOJu0YyNmx2VJdC1Eyl9aIg7aCwOYGQZXENz1xD+2xc9J3Dp8kiVr8Z+ zMISeRhRrTBVDRkdDPE6Npxfy2AroBXDQSffBm19TBA0h72Cj2s94FbCmA== X-Received: by 2002:a05:6a00:3d10:b0:705:9ba5:f3e9 with SMTP id d2e1a72fcca58-705bced526bmr219251b3a.30.1718144769422; Tue, 11 Jun 2024 15:26:09 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7059534a4c4sm4245488b3a.36.2024.06.11.15.26.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jun 2024 15:26:08 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Tue, 11 Jun 2024 15:26:05 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up To: Steven Rostedt , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: 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, Ross Zwisler , wklin@google.com, Vineeth Remanan Pillai , Joel Fernandes , Suleiman Souhlal , Linus Torvalds , Catalin Marinas , Will Deacon , Ard Biesheuvel , Mike Rapoport References: <20240611215610.548854415@goodmis.org> <20240611215801.443593152@goodmis.org> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2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ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <20240611215801.443593152@goodmis.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/11/24 14:56, 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) > --- > Changes since v3: https://lore.kernel.org/linux-trace-kernel/20240606150316.751642266@goodmis.org > > - Changed table type of start and size from unsigned long to phys_addr_t > (as well as the parameters to the functions that use them) > > - Changed old reference to "early_reserve_mem" to "reserve_mem" > > - Check before reservering memory: > o Size is non-zero > o name has text in it > > - If align is less than SMP_CACHE_BYTES, make it SMP_CACHE_BYTES > > - Remove the silly check of testing *p == '\0' after a p += strlen(p) > > .../admin-guide/kernel-parameters.txt | 20 +++ > include/linux/mm.h | 2 + > mm/memblock.c | 115 ++++++++++++++++++ > 3 files changed, 137 insertions(+) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index b600df82669d..ce7de8136f2f 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]::