Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1267655lqt; Fri, 7 Jun 2024 12:55:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXh2ww/UhXMjmCTWzvD4dEGFt4Eppif+VsyVmebwFP514EuV2158soYN3pd2Q+ZZzwwuJSC5EIfNeYfzlmcOt3uWTBaUmYhij4XBoU2bw== X-Google-Smtp-Source: AGHT+IF5YESfOh1OR/2EMDduH+ZPmDwPWq8vrtb5I1emdRUo2VoHZXzeu7R80VUhF5R8A9io/ZZj X-Received: by 2002:a05:6a21:3996:b0:1b2:addb:298c with SMTP id adf61e73a8af0-1b2f9c6eadfmr4130945637.50.1717790130700; Fri, 07 Jun 2024 12:55:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717790130; cv=pass; d=google.com; s=arc-20160816; b=0WLn8rkpSH3mwK0xFKeKopCfmUuH8IfxMMqLnYqHc/0e7BThQzpZhP1GtojS2Z0U3U LTfVyhObiIMkHYCvaRN/Y4C0gKlRVPfzFrCmgGocXpVBVHZfjp8Xk0FHHanWCZM4SCEz kETUYGQif6oeeT9g+mH4lHE1ooHy829xeY6m/8AOxrydPwckRsjkeKmBmKeR8sct0Ivo y2fiz6p4lHoTOcLnnOSL4KXM9YqwCFwIe+18bxfe6h+K6DGsSKIb95LyRvUnN8LvPNHL XzTaPpUTJE4snmSdkH9twTp6Y+nTFYf5nNPsk7VEEQ0H48A1fT4LAQneULLsFM8SSysK hw6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=BTOKnMT5T2ZhEPykgSzSOI+vQfKzqcBhRm9xKY95hq0=; fh=faY85W9XIcREt0WS3r5tPnyXAbY0isvmWWgIDqC5KIU=; b=gCpnQW4ekTIYntGaLjHnNYQWlNXtrS24w0gq7AN/aAARwi69e8MccSSYuxudUJTtSY afFgWKVKcPy5IWKh9R42yQRvBtfzmTb+lZy85ioGr3f7Jd+FiGpdQvZz3nrLiBu9/ErF f8tIUnqwA6jRVkcxveg1nix4Dr00ikZ1rSKCU/ftLs41S6Vg99NlCOIHJWSMf3kwt1OV jzxvqpuYLWFUVMLfnd5gTutIz4TExpamnkQDP2Zl/N5bo36Q7JeRzNAz4ahTqAhgRAWm 1Z4a4TT4WNjSFyvJlTHr76XfzDyQjnPenHUP0sCDRgHzRF1x5Zttr3sX05jK9vaPTnWp WsCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=R44bug6F; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-206681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206681-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2a852564si3453397a12.842.2024.06.07.12.55.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 12:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=R44bug6F; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-206681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206681-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 9E4F8B21B28 for ; Fri, 7 Jun 2024 19:55:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C5D114F135; Fri, 7 Jun 2024 19:55:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="R44bug6F" Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (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 A8EB9D27A; Fri, 7 Jun 2024 19:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717790104; cv=none; b=f425aOW5R6PVgxbVlOosCe3l/+mT69aoN6tqcBYT6SC8T7dVZHvVVXOwx7Odv8zfkb/V8M+hku1T99I5ugmOs9RBsNNSJlY4PkTKuXCv74PJXszOfFF93KVTzg8hNwiHIBgRz015O66FmZo5+q+rztVuqsX/0+2CZNrRG/dQL7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717790104; c=relaxed/simple; bh=CSYTB2dVOTn1wxVQwAkOMx1O39MevSRp/szfd1u8ONI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iSWWuYGh7YGv124ZS5TAjVnJ2BsP987oN6qxk9P5gFYLx+jAVV6eBQZBCC/bWlI+gaFSJ0O3MxkwW95jtU1mruVAxpJByu8wGlZnfqcIbmlEySSL4DZuHkTN/gzKk+Pi67JCGsB1Q7V1JSQSGLWHhYNMtOpGNBLamJCvVBdSHrk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=R44bug6F; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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