From patchwork Tue Jun 11 21:56:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13694218 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 87895C27C65 for ; Tue, 11 Jun 2024 21:57:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 210B06B00D9; Tue, 11 Jun 2024 17:57:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 19A9D6B00DA; Tue, 11 Jun 2024 17:57:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 013CA6B00DB; Tue, 11 Jun 2024 17:57:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D344A6B00D9 for ; Tue, 11 Jun 2024 17:57:51 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 98906140308 for ; Tue, 11 Jun 2024 21:57:51 +0000 (UTC) X-FDA: 82219970742.27.257B483 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 9E3164000B for ; Tue, 11 Jun 2024 21:57:49 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of "SRS0=hOOK=NN=goodmis.org=rostedt@kernel.org" designates 145.40.73.55 as permitted sender) smtp.mailfrom="SRS0=hOOK=NN=goodmis.org=rostedt@kernel.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718143070; 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:in-reply-to: references:references; bh=YXo/YT1vJixhRXaGjIE44HrAi+hqmXha/emumEXytCE=; b=bpLdFGJ+0o9pcsiWjJY2GEuH3f6bOcnB/qJOj/h3lVx0PDhJQfqIqNpLw99SrtH3NuTsWc Qez87HrT/AeyYPTlRtc4eUVfT70QhaEo6HimaNbStLAoy3akSdjuLC3pUKIo5iXNMJcuYU oPKgfVumMsVNc8ZL/zeGE4JDpRl3zUU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of "SRS0=hOOK=NN=goodmis.org=rostedt@kernel.org" designates 145.40.73.55 as permitted sender) smtp.mailfrom="SRS0=hOOK=NN=goodmis.org=rostedt@kernel.org"; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718143070; a=rsa-sha256; cv=none; b=ejyfuR2U4edqZ6Nvx9OsmVU0TD5S4YWvJJLo9RMyt0vPWyGUTUg97FjYRf78t9ExKfqfCp JhmNdl08IlQCwOKnJYmT5TVeLkereJ2yNpn1VzfkmhS6vl8UiHjdjEIZbpB1GBuecf4KS6 PoH5El0VZCf3J0L101it50+aCZ2/xBA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id D244BCE1E75; Tue, 11 Jun 2024 21:57:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC5BDC4AF52; Tue, 11 Jun 2024 21:57:44 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sH9VB-00000001VTw-39PZ; Tue, 11 Jun 2024 17:58:01 -0400 Message-ID: <20240611215801.605742243@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 11 Jun 2024 17:56:12 -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 v4 2/2] pstore/ramoops: Add ramoops.mem_name= command line option References: <20240611215610.548854415@goodmis.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 9E3164000B X-Rspamd-Server: rspam01 X-Stat-Signature: hu3t4eznrffp4xej8wkydishqshu4y6z X-HE-Tag: 1718143069-585593 X-HE-Meta: U2FsdGVkX19ujHjwvYBDCXknSHjaaUzg0zRgHq3Rk62qo3oWw9V7qrTel13lPiCn04RPv3oPn6LGIb02uVmJwlZT6ifCM1D7ZcVSnoLCTdesoo7jhjsHzp2tD9PgzjVTVTYwTFs2oJ+3X12KXtsFoZq5IAiWvtkO1pnb/Yp2no4T3hiiUK5V5VQHjg6bAPe/ZIvVa+yXpCr+ajknox4L3SQ/GhctVBpqOY5QSGMSoMxzOs2W4eO7P5y4Y9hDOKyaXk2SUo/bnZbmOU3isot8dzW3BbhQ82y1DowKO7lzBIx4bsEt4Puakx1l0oHZYS0n8Kavd2nvcHAaOo0FAcR7nd1mbCr76gTAan0eoO8S7qJQ1EbXMHSqUzyisIGynByCirjRuKW5VE4LFeNVAqvB47MQTXXAinQD5kL4AES8SJnINeIU+8sxZfvg9cyx8WQ26tydGjFO+xaFLjVy9YsAa9gOie85omQKmC0u5gRP+5BqKxaPEBPJchyYPIBE7RG68hL/nKVyTTd7D507m7MtAhZFbv9ULr8SX5PAGNVHa3/lP/+wQiJpKKyo0UUP8mjBfVaa7wXvqrewbraAuNdcQsr5RKvX04tg+mBwoaU2szShac2adqczOk08kH+2E3rFmCfMYBViD+W/hKnq6FGh+hzq88+qbkWykr5eo2re39Vl2+K3lu+j8gRtvoIhNV68cfIpaM2Avi0ucCIE0RTR8IPP0EHCZXIkLIEQZCkcBXwKg1bNP3vw2Qau976P7nrXwOvtmLin5jWXdlbb2MnKMIi73RLIj1JcQDu9RCe+Il/1y2lPeHSXu2RU4Gbr1urWifYnrOQUJgvFhDH5kZLi26GavhpHT+RDtbqtcThNXAT7c2gsRqIES7P2VgK6ScO+xXiiHfbgPHCqYnhlhCxzYLcMpG6DILKerbW3X7mBITJ3KQ/9nIpuw+MramjesZQQE7i5iBjK04dlPc2SPFs f4dt9SWS QU5Bd55+7zylZk/VSrzhGw8XNDrPqanokdOMY2xyPPTxiDVCoWHUoA8N0OSK6uh/oRN1uLxakGR71x0QB9xUedmMPx7LZW53twM5q/JAFNiPXv9Cf4KHXL3t3Hhkr5lpXvcucxLqK5UlEp6sy1ekb2JfFQQnJ4iX6KN9B9Ar4l0l+fLMAC3PwGBHGLyk7yz2TuWjUeeQqon3VoXI+1SzE408mz3HwzqV3bl6zriLdmzvK3nqOyUI09jsUKCrTq7gFwTqhI2iJQd24sq0BgJW3eFhC6pzRBez40eYASUW3yaey281eF2fyg7SoOcfgSlkKDmFvUfLl8QyZE1KxHE0C11R/CQH4xI+ZutFUpPYDdfBaA1CRAvX5W8+zhzXiolb5DF+tdDKiM9JUc48hZFXkxBD8bDnCwkFVQq2rRPLcm79ur83ozG+dOBqHrzfE0uVDyB/1oFtFIVjPZEo= 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: 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) Reviewed-by: Guenter Roeck --- Changes since v3: https://lore.kernel.org/linux-trace-kernel/20240606150316.916395285@goodmis.org - Change type of start and size to phys_addr_t fs/pstore/ram.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index b1a455f42e93..4311fcbc84f2 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) { + phys_addr_t start; + phys_addr_t 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