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 91D55C27C53 for ; Fri, 7 Jun 2024 19:55:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD3036B00A1; Fri, 7 Jun 2024 15:55:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C81A76B00A4; Fri, 7 Jun 2024 15:55:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B703E6B00A5; Fri, 7 Jun 2024 15:55:15 -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 993F16B00A1 for ; Fri, 7 Jun 2024 15:55:15 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 141108194D for ; Fri, 7 Jun 2024 19:55:15 +0000 (UTC) X-FDA: 82205146590.05.2A17E3C Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf25.hostedemail.com (Postfix) with ESMTP id 48822A000A for ; Fri, 7 Jun 2024 19:55:12 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=R44bug6F; dmarc=none; spf=pass (imf25.hostedemail.com: domain of gpiccoli@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=gpiccoli@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717790112; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BTOKnMT5T2ZhEPykgSzSOI+vQfKzqcBhRm9xKY95hq0=; b=GdAyaaRPg5rSyDdz5m8xWeLNtWSpO34nme3OZiUEZD8bgzwpcVYnOp0tkim1ov6IDjA733 pJlc29mnxJMTWh4rncnKAmsRiN0q3OcDxq0f37Z1N5JtjACHvJYZNqgMqGXnA/hoP6w0+3 HG5OksQLhks0KTCGXux1Rt9xgKyhfcA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=R44bug6F; dmarc=none; spf=pass (imf25.hostedemail.com: domain of gpiccoli@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=gpiccoli@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717790112; a=rsa-sha256; cv=none; b=fNDEBgBQSaz5V+JeV2tquA5ehtRI8Zpk676p7zPYMm4DSN3i9kCbDGfZH/uJ/l2Oag8Tjw agZB4u6FwripFAAiASWRj8OuF9UwRmQVNCElNE6wCr2VmXgfeeQPZ6mnvDtUBPuPVLOEiH hZEqjN/gmzRg3rTYa4fx8eNjl8SeKTo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BTOKnMT5T2ZhEPykgSzSOI+vQfKzqcBhRm9xKY95hq0=; b=R44bug6FEwA67verN95KlbS9di Fb8CAXgDV9V6Fo/fnNRkOHDlmWl+/SlxbIJARzGMbsqbqEk5f2xW5Jtp3qWZBBEzokNzzrXzz19qv /WE4/VrRKejOXXQjCeYydUF4AJM86CtbacqxXsVq9zkEo/zX0yahufFC3j8avIi7xiRoCCmIe1Y4f GNnHt8ZCEBxwrDWv+OmP8c2uLcuFGHUwQEKAbenoum408yBPqLakeLwpm1cJPQ6twJIhJeAGCrX6D vd8ce+A19emKZNv1UETrYjdVp9du7jZkI66AmYgnp6sZgQeEWGv/gwnr/BSMxtywxUbqpZMDs1SxU i3D7ZbGw==; Received: from [191.205.188.103] (helo=[192.168.1.60]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1sFffp-000eQE-AD; Fri, 07 Jun 2024 21:54:53 +0200 Message-ID: Date: Fri, 7 Jun 2024 16:54:41 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v2 0/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up Content-Language: en-US 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 , 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 References: <20240606150143.876469296@goodmis.org> From: "Guilherme G. Piccoli" In-Reply-To: <20240606150143.876469296@goodmis.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 48822A000A X-Stat-Signature: sft99tihw1w7drq8jid5z3xmaoj7b7ef X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1717790112-664198 X-HE-Meta: U2FsdGVk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wvin4HCFMGoIUtXD55kdHtkhQiX82+s6tH2F4z8hjUbH9iCwieccCig/FXrLelPBKXBClxF3v2tFNlvWioPhx07UJOjnPr6+teTusRj0dQuSewWJtvj+JZmQIsEmwpRL1Vn4NHtAWGXlolbo9JILGIGBE 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 06/06/2024 12:01, Steven Rostedt wrote: > Reserve unspecified location of physical memory from kernel command line > [...] > Solution: > > The solution I have come up with is to introduce a new "reserve_mem=" kernel > command line. This parameter takes the following format: > > reserve_mem=nn:align:label > > Where nn is the size of memory to reserve, the align is the alignment of > that memory, and label is the way for other sub-systems to find that memory. > This way the kernel command line could have: > > reserve_mem=12M:4096:oops ramoops.mem_name=oops > > At boot up, the kernel will search for 12 megabytes in usable memory regions > with an alignment of 4096. It will start at the highest regions and work its > way down (for those old devices that want access to lower address DMA). When > it finds a region, it will save it off in a small table and mark it with the > "oops" label. Then the pstore ramoops sub-system could ask for that memory > and location, and it will map itself there. > > This prototype allows for 8 different mappings (which may be overkill, 4 is > probably plenty) with 16 byte size to store the label. > > I have tested this and it works for us to solve the above problem. We can > update the kernel and command line and increase the size of pstore without > needing to update the firmware, or knowing every memory layout of each > board. I only tested this locally, it has not been tested in the field. > Hi Steve, first of all, thanks for this work! This is much appreciated. The kdumpst tooling (Arch Linux) makes use of pstore when available, and the recommendation so far was to reserve memory somehow, like "mem=" or use kdump instead, if no free RAM area was available. With your solution, things get way more "elegant". Also, I think we all know pstore is not 100% reliable, specially the RAM backend due to already mentioned reasons (like FW memory retraining, ECC memory, etc), but it's great we have a mechanism to **try it**. If it works, awesome - for statistical analysis, this is very useful; pstore has been used with success in the Steam Deck, for example. With all that said, I've tested your patches on top of 6.10-rc2 in 2 qemu VMs (one running legacy BIOS - seabios - and the other UEFI - using ovmf) and on Steam Deck, and it's working flawlessly. I've tested only using ramoops as module. Some code review in the patches themselves (like a missing EXPORT_SYMBOL_GPL), but all in all, that's a great addition! Feel free to add my: Tested-by: Guilherme G. Piccoli Thanks, Guilherme