Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp401809lqp; Tue, 11 Jun 2024 07:49:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXNvx/ykbg9N09mtC8CxUV+sjLLMB9To7yN90DwvwsIkT62JwZgmKnxhdN6kLQIMj4lhdyuOd8R8A36BGQiN1FYMzfpkhY2oyywWwflaw== X-Google-Smtp-Source: AGHT+IFJd7myzmJ6GGalHtKySZ4Dr0hqDCG4JMfHGHhXaaoQF+24dM4sIynoaL+4jRIPczeLThWi X-Received: by 2002:a05:620a:4155:b0:795:89be:8e5a with SMTP id af79cd13be357-79589be9171mr810545485a.14.1718117398349; Tue, 11 Jun 2024 07:49:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718117398; cv=pass; d=google.com; s=arc-20160816; b=T/RXH3WELBjVbYReSLlSamT0PjFNypkiTeamy5gm7AajIxdBpQULS04JdhiO4Mfg6t L1VKXbD+kJUJnZluWSUstgG3DmUks6h08KoLW7nCs/3G0cXFvdkadUtZGacuKNNaiwno /pVfTNC57vQMKCNUns6Wk2BGsxwLQpaLy40U97n0BXeDIFWkPFdQ6t0rqbdnNpdEEuJx lI3psd/RtoXeto9klWYEs0U4zrQs9FOKkYLzCYxr/ImsgYZL0nsC822h1mBRGSnp+sUv UltOi7fpSWB19BpfQl+gr4ig0OWx46WpqFFPiCQj5mkZkAA7t+vsBbVIbMg5JEwVy49t pVuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=ZR5VQ90ZVMnvrAnWcqdc5KE2OBHygirUwjTUkw3SWgM=; fh=QORXSiDV/x9VWq4RcqWjO5bZNJ5t7To8OgD4cz5pN8M=; b=ZkGTnljV4WtFxsRf096syKMecW/xVlLZ+djtUTLmbIv71WU9f5uKSgYzu1mQH3sV63 yDaNVzQICVx+l9Au5UULZ5xBcmn06o10lf2D8tQ3Ooog01ZZrnRfNsmVEUUdJaYQHC1b u+No3rnYEIzNAtP3Abd6uus+FDNqDbsYrG3d03yC5Re1+c6hgvc+JiHyDdsEjI/D+7A8 LLLH6ulhvCaDSjy3rY1UVEOIV5UT3pnBdASYF0S3RmJPw+fUFITfiJrkR5JF76QU6Ue8 yGU/zKrjVSPShCXAIE7LBFKGtnrkjTGRJkY4kRJ+Z10gVxSjcj54CtH9c2Q4Z92K0+52 mxAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-210087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210087-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79533339da1si1247400885a.565.2024.06.11.07.49.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 07:49:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-210087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210087-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 188331C2306D for ; Tue, 11 Jun 2024 14:49:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEE3D1CFA0; Tue, 11 Jun 2024 14:49:34 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4B7DB17C9E; Tue, 11 Jun 2024 14:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718117374; cv=none; b=qDMhsUQBYdmo8c3MYk8JCSmbbyQREL8xb8VYK96YV6CMB0bM6NEwzNaw40rN43LdPmShkNW65qY+iQzw52nYUDi86E3xetfgtWFejYBfTxnAOrCbsZhNoXG4nxl2ZKnzBnIlB2j5Ey1mUeebDiHZIxHrhpcFi3c0YGTYcjI7dPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718117374; c=relaxed/simple; bh=OpSqoPGOqKMo5eag5KgPTMflmJGctnG7QbWMhkWZzy0=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=kaJwd4Y8vOrlrJtmTzlIDKOGhQXtVjy8r60VgHNTBRyQEeR6dBpRFnDj83OOgK/oickOZ6Iqpu15sNrlhlJhudZFMlapK29AwBWAtQ8rZPs11q7T67kAownjIC1oyOKZc8ETX+COjAd3UrnEXmiiAYNp7rCVQHloW62BKIkQ0L8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C55C8C4AF61; Tue, 11 Jun 2024 14:49:33 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sH2on-00000001OoA-3XSY; Tue, 11 Jun 2024 10:49:49 -0400 Message-ID: <20240611144949.703297941@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 11 Jun 2024 10:49:13 -0400 From: Steven Rostedt To: 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, 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: [PATCH v3 2/2] pstore/ramoops: Add ramoops.mem_name= command line option References: <20240611144911.327227285@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=UTF-8 From: "Steven Rostedt (Google)" Add a method to find a region specified by reserve_mem=nn:align:name for ramoops. Adding a kernel command line parameter: reserve_mem=12M:4096:oops ramoops.mem_name=oops Will use the size and location defined by the memmap parameter where it finds the memory and labels it "oops". The "oops" in the ramoops option is used to search for it. This allows for arbitrary RAM to be used for ramoops if it is known that the memory is not cleared on kernel crashes or soft reboots. Signed-off-by: Steven Rostedt (Google) --- Changes since v2: https://lore.kernel.org/linux-trace-kernel/20240606150316.916395285@goodmis.org - Removed "built-in" from module description that was changed from v1. fs/pstore/ram.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index b1a455f42e93..0653b76c70fe 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -50,6 +50,10 @@ module_param_hw(mem_address, ullong, other, 0400); MODULE_PARM_DESC(mem_address, "start of reserved RAM used to store oops/panic logs"); +static char *mem_name; +module_param_named(mem_name, mem_name, charp, 0400); +MODULE_PARM_DESC(mem_name, "name of kernel param that holds addr"); + static ulong mem_size; module_param(mem_size, ulong, 0400); MODULE_PARM_DESC(mem_size, @@ -914,6 +918,16 @@ static void __init ramoops_register_dummy(void) { struct ramoops_platform_data pdata; + if (mem_name) { + unsigned long start; + unsigned long size; + + if (reserve_mem_find_by_name(mem_name, &start, &size)) { + mem_address = start; + mem_size = size; + } + } + /* * Prepare a dummy platform data structure to carry the module * parameters. If mem_size isn't set, then there are no module -- 2.43.0