From patchwork Thu Jun 13 00:34:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13695706 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 BBD29C27C77 for ; Thu, 13 Jun 2024 00:34:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72F8D6B0099; Wed, 12 Jun 2024 20:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7069A6B009B; Wed, 12 Jun 2024 20:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CE8E6B009D; Wed, 12 Jun 2024 20:34:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 426006B0099 for ; Wed, 12 Jun 2024 20:34:57 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E45621A01BF for ; Thu, 13 Jun 2024 00:34:56 +0000 (UTC) X-FDA: 82223995392.12.D4564BE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 5A62A20004 for ; Thu, 13 Jun 2024 00:34:54 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of "SRS0=ySKb=NP=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=ySKb=NP=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=1718238894; 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=IF7gnmwzCbL09N/BnrgDnto0pWPyks122xl7Egbstng=; b=pnCUW46SQ9JdQs6n6Mr9s8+bn/vA2GYAyZQJYLULxTcmlXXVnnLCRS9Ko/1Fxk9VR97RfY 1ZJpXAtahGBsWLVTxuNFivYdNsPRLhF7mKcF1/0l40EwRzBVJ0F1/rgGb9Vz5PLG7Xp3Af RyDTiSZuuyATaw3T1CNcgTvwupalKos= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of "SRS0=ySKb=NP=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=ySKb=NP=goodmis.org=rostedt@kernel.org"; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718238894; a=rsa-sha256; cv=none; b=v2JTTttn0QrTiOmyViI6zv8bIr8fxHubUB4ydKuNeEe7PKipAa79QdPKQdOvmbx8pa6mCN dlZn8ctsqnIkrx1UVEIuHU66xBaZqD/A/VUmJa0Tw1i/ScW/V0sEMzj74HW2RJAcusnh5U hcm0z329+tsRiwZmVVpc6IWbj8ga3RI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0A03F614FE; Thu, 13 Jun 2024 00:34:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99BC8C4AF1C; Thu, 13 Jun 2024 00:34:52 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sHYQn-00000001eNW-0G6T; Wed, 12 Jun 2024 20:35:09 -0400 Message-ID: <20240613003508.918902349@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 12 Jun 2024 20:34:37 -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 v5 2/2] pstore/ramoops: Add ramoops.mem_name= command line option References: <20240613003435.401549779@goodmis.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 5A62A20004 X-Stat-Signature: 35no9ruiz8jya8kz3oknzbd49axfmk9y X-HE-Tag: 1718238894-517661 X-HE-Meta: U2FsdGVkX1+V65fGXm4tOUPQNB0j3oNiPdFuUAokS0LI3I7NLSvR/H/bf2TighXgjVa7snWhjktFCO8PQxdZzeR/PsTewbLKsIDVxHiqMq4OXk9KtGKntho9yKBc0bh+28vx3aFo/Th+lXNkA1gxxAfeVw7TAEeRxJdwf5EesNtNOwR1pghDz6oGhMyhhuFHpa35sEBOMiUscam4b6Lf0HokhewBmlORNARi9nLYNVX+WXgRhe7rVRwuaTVGvF/l2bibPnI98Yc/fT6F4T677Q8ike0VIJTt56UUvpzV2gryNZQW+g/LL4NbVIijcYofZ4SWJ8MkcYW+sRv0+N5KOUVGa3sAt/opW79wX0ZNuFucvIrA90j4VNaIDKQ2Kf9eP2ij21x2NsydFmSku/EGXXSoSSeG4iYn2QaHsnzehp/8P7mKGoEW/75BlqaeV3CO5zO0MRpKEBhWxvnkgv1iSuJ/+ER79IAh11OYJduoppDJ7t2OScfWQQzIfzN/KSugVClkjmXRyL5NLkq6ob7H0IQ+HDeer7iYxUkb+hHi8Jp2cruMN7fYu9TG+F4NlCZ0KNLQ9J8LSdU3gIelM0KDwV+2wFzlKWwr8v8yewwCe++tj23Lix4mOE4wuaFeRKTtiCyi9HHg/ODmWqQxfQ2Mty2S0407DnzF5YRt5q0wyPbAGhdE2kxeoi9R2CqFSp4xRTiE6up10WqS7uS+wPMRqaFCUmTFmvfiRPpI+TUfbN54WkJFQ0NN8NOzFRpaXW4gK5+YSsTYOLpfp1U0eU2s2lZspTcXfH96vwdArL1eWQZdfT/51IDYULY1iUQjrQQ/6oqylFUVZUVVMMl364X/dQnk75+AXal5jNJp0qE7KjFq+uZ/899CR4pqNKreUgXCeI0lEN3Dwwxawe2Az9vlvltFYxsbFKFOJmcNRpc+HKCRErZqLxpudXtaj17rAxL7REbRwny/NiGYIzOHm5k E7vL7BRg 3GT6bcQV8baWoh8UWlm+jNba7VHMJO4ySXe7z/tSik4AJAC13q53erQxsdKZxURhTXt280EmtgP4cHB1lI9q/DQS2m/JrWix/bmEd3BJ61XYDY0fasOGrfzwxxY+iC1AB8tf4802NK6auE1GQtMZb3nOCYNFDwl8CwlwtvgR3q7OMnGrdySVXfq0SkA33PKaQ58xlIguD3D4FRfCQpisanKwcn3WY0+Mo63mUkFJBPqyHB/SH1cy3tXXqT7Fd45Mpnt4L04Gnc2ppwNdYGLiJMt4p4pbtOxBdJPmgcaIIQR8wOF/KOPpNLBH5OgUHNyPAxfzP2WWWHKmS05cYQ6ye9ZKGtb8by7joOFkQbxi0hwk51vYWMFCR8tGvnGtmiWGBlbNu+0W7QBmXXzKVwzPV3kzhsSIn2ZFqwdXrOi4Nylsg/K0vWWX8hBMtqusdha15RR5cp+GrpTB5KBo= 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. Tested-by: Guilherme G. Piccoli Signed-off-by: Steven Rostedt (Google) --- 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