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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BAABCCF9E3 for ; Mon, 10 Nov 2025 08:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CoKojaskLBR6PzEuZ4qSFL6ygxd9zLbisaOhoCbAjLM=; b=pS8OQ703U0GfB/UUsZmsy5WBTU pah4e+zCL9Djb/LauMeRss0VZ2XVRV1yVdd/iuq9++AAAC0qmKnlzi/oZLMbAcKkn/YrTg4oksvS+ 9ndE9UMpO3UN06n66WjSma20O2BVC5XwBjvjEAOIk3I3DzWto2YatHTeONFBu5GucHiZxQ7Zbt8Ic G6u6sROG3coMHwKZEsjgX3kwqt52Rp02eA4Yx7GzLBXCwTzO9oMnkSudiqBrdFo4IYKZMounJXAC/ w851jLS94wz6XKeWFAKU54hzo2vFRZiq8Iby4b03l9oQKZtGvqY0qeCJb/zc08EyLwRq4Pxlrjv+t 1Cs/BA0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vINRT-000000050JX-26rQ; Mon, 10 Nov 2025 08:40:03 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vINRQ-000000050Iu-3sHl for kexec@lists.infradead.org; Mon, 10 Nov 2025 08:40:02 +0000 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5A9KjEar017554; Mon, 10 Nov 2025 08:40:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=CoKoja skLBR6PzEuZ4qSFL6ygxd9zLbisaOhoCbAjLM=; b=YHA9LAJeAu997JGQ76AmMi XJ8xOvUXLaqdw7LLD2nqQZyXH9zoMHMhanYe7yYBGfR9vPxYIvBV3HOncBkjKtVJ djxHk4jmtVd7vgJ4qfPllH4MfgaKi/1ux2LZ477LSVf735jx5E+z5ge2KAiOkBnh dRSeKVwkU+OEs9xyyFh178p5Je7xp0D0nsa27HH3IpLDwlwv8aXcM/BhEzWIDLBw n5yL0mZbEVBj6pgVPCwVETF8qjy3YJv2faeOqufyGsXhFg/8WxRUfZ1UqJw6yIQn QGHayHlClwR3Ty+WraXVL+QIu2Z8RjXM2JOdKaeScpNUwYYvR0uKTjGS7rfeBkKg == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4a9wk7y87p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Nov 2025 08:39:59 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5AA8Mnw0017921; Mon, 10 Nov 2025 08:39:59 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4a9wk7y87m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Nov 2025 08:39:59 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5AA4g8rf008190; Mon, 10 Nov 2025 08:39:57 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4aah6mmp20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Nov 2025 08:39:57 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5AA8drjX30146954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Nov 2025 08:39:53 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C5172004B; Mon, 10 Nov 2025 08:39:53 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C5A020040; Mon, 10 Nov 2025 08:39:50 +0000 (GMT) Received: from [9.109.204.116] (unknown [9.109.204.116]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 10 Nov 2025 08:39:50 +0000 (GMT) Message-ID: <09c4c181-eb4b-43ea-a439-04b83f4c20ba@linux.ibm.com> Date: Mon, 10 Nov 2025 14:09:49 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 5/5] crash: export crashkernel CMA reservation to userspace To: Baoquan he Cc: linux-kernel@vger.kernel.org, Aditya Gupta , Andrew Morton , Dave Young , Hari Bathini , Jiri Bohac , Madhavan Srinivasan , Mahesh J Salgaonkar , Pingfan Liu , "Ritesh Harjani (IBM)" , Shivang Upadhyay , Vivek Goyal , linuxppc-dev@lists.ozlabs.org, kexec@lists.infradead.org References: <20251110043143.484408-1-sourabhjain@linux.ibm.com> <20251110043143.484408-6-sourabhjain@linux.ibm.com> Content-Language: en-US From: Sourabh Jain In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTA4MDAyMiBTYWx0ZWRfX/lFqTdb+Ix31 +ZxCwVkKK4eLHYKRdw/zlF4OBjYsPLlqSV25Ey2IeqS9NvBniaYxHkvF7FVO5m//S9NFjJtAr7c x+zUQ3zVKM+8B0loekFp8s1iK6uvGGEvpheDNbSz7rbDNaglzi3KA8vStXj4M2VNK9JR1hg9r3X 198c4gYtB0Y2BajB3OnPTSXEuq0i3ilYkad5nEI3C7JPuFId2TM375JeY7tDkXGYDGR+vft1/px QGqA8ILewfwDDP/jSo3C052x1yR+0F2QGAocwZSt26JpIWE/KkD/WZKQnX+cSpRqfTEeAyVhaDv flIRIJ8demq62mlo0xYXj2LfLlkswpcV9/2s3ZUex1CD0df7TobM+yqNS+oOxpJSoBTvKRP1Ua0 pfPdzQ51fWSodz1TMxO6uSB7k4aY4w== X-Authority-Analysis: v=2.4 cv=ZK3aWH7b c=1 sm=1 tr=0 ts=6911a4df cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=Z4Rwk6OoAAAA:8 a=20KFwNOVAAAA:8 a=pGLkceISAAAA:8 a=voM4FWlXAAAA:8 a=JfrnYn6hAAAA:8 a=nZ6l4sNALc67V84wghEA:9 a=QEXdDO2ut3YA:10 a=HkZW87K1Qel5hWWM3VKY:22 a=IC2XNlieTeVoXbcui8wp:22 a=1CNFftbPRP8L7MoqJWF3:22 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-ORIG-GUID: DwbPY7ohE7XwxBRgz3LrgMxK1K-_LihJ X-Proofpoint-GUID: PlH9k_X-djhYdUkQ_pkrIaAwTCZLBdtr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-10_03,2025-11-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 phishscore=0 impostorscore=0 spamscore=0 bulkscore=0 adultscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511080022 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251110_004000_978026_6E018A66 X-CRM114-Status: GOOD ( 22.90 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org On 10/11/25 12:38, Baoquan he wrote: > On 11/10/25 at 10:01am, Sourabh Jain wrote: >> Add a sysfs entry /sys/kernel/kexec/crash_cma_ranges to expose all >> CMA crashkernel ranges. > I am not against this way. While wondering if it's more appropriate to > export them into iomem_resource just like crashk_res and crashk_low_res > doing. Handling conflict is challenging. Hence we don't export crashk_res and crashk_low_res to iomem on powerpc. Checkout [1] And I think conflicts can occur regardless of the order in which System RAM and Crash CMA ranges are added to iomem. [1] https://lore.kernel.org/all/20251016142831.144515-1-sourabhjain@linux.ibm.com/ - Sourabh Jain > >> This allows userspace tools configuring kdump to determine how much >> memory is reserved for crashkernel. If CMA is used, tools can warn >> users when attempting to capture user pages with CMA reservation. >> >> The new sysfs hold the CMA ranges in below format: >> >> cat /sys/kernel/kexec/crash_cma_ranges >> 100000000-10c7fffff >> >> Cc: Aditya Gupta >> Cc: Andrew Morton >> Cc: Baoquan he >> Cc: Dave Young >> Cc: Hari Bathini >> Cc: Jiri Bohac >> Cc: Madhavan Srinivasan >> Cc: Mahesh J Salgaonkar >> Cc: Pingfan Liu >> Cc: Ritesh Harjani (IBM) >> Cc: Shivang Upadhyay >> Cc: Vivek Goyal >> Cc: linuxppc-dev@lists.ozlabs.org >> Cc: kexec@lists.infradead.org >> Signed-off-by: Sourabh Jain >> --- >> Changelog: >> - Add the missing hunk to export crash_cma_ranges sysfs >> >> --- >> .../ABI/testing/sysfs-kernel-kexec-kdump | 10 ++++++++++ >> kernel/kexec_core.c | 17 +++++++++++++++++ >> 2 files changed, 27 insertions(+) >> >> diff --git a/Documentation/ABI/testing/sysfs-kernel-kexec-kdump b/Documentation/ABI/testing/sysfs-kernel-kexec-kdump >> index 00c00f380fea..f59051b5d96d 100644 >> --- a/Documentation/ABI/testing/sysfs-kernel-kexec-kdump >> +++ b/Documentation/ABI/testing/sysfs-kernel-kexec-kdump >> @@ -49,3 +49,13 @@ Description: read only >> is used by the user space utility kexec to support updating the >> in-kernel kdump image during hotplug operations. >> User: Kexec tools >> + >> +What: /sys/kernel/kexec/crash_cma_ranges >> +Date: Nov 2025 >> +Contact: kexec@lists.infradead.org >> +Description: read only >> + Provides information about the memory ranges reserved from >> + the Contiguous Memory Allocator (CMA) area that are allocated >> + to the crash (kdump) kernel. It lists the start and end physical >> + addresses of CMA regions assigned for crashkernel use. >> +User: kdump service >> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c >> index 7476a46de5d6..da6ff72b4669 100644 >> --- a/kernel/kexec_core.c >> +++ b/kernel/kexec_core.c >> @@ -1271,6 +1271,22 @@ static ssize_t crash_size_store(struct kobject *kobj, >> } >> static struct kobj_attribute crash_size_attr = __ATTR_RW(crash_size); >> >> +static ssize_t crash_cma_ranges_show(struct kobject *kobj, >> + struct kobj_attribute *attr, char *buf) >> +{ >> + >> + ssize_t len = 0; >> + int i; >> + >> + for (i = 0; i < crashk_cma_cnt; ++i) { >> + len += sysfs_emit_at(buf, len, "%08llx-%08llx\n", >> + crashk_cma_ranges[i].start, >> + crashk_cma_ranges[i].end); >> + } >> + return len; >> +} >> +static struct kobj_attribute crash_cma_ranges_attr = __ATTR_RO(crash_cma_ranges); >> + >> #ifdef CONFIG_CRASH_HOTPLUG >> static ssize_t crash_elfcorehdr_size_show(struct kobject *kobj, >> struct kobj_attribute *attr, char *buf) >> @@ -1289,6 +1305,7 @@ static struct attribute *kexec_attrs[] = { >> #ifdef CONFIG_CRASH_DUMP >> &crash_loaded_attr.attr, >> &crash_size_attr.attr, >> + &crash_cma_ranges_attr.attr, >> #ifdef CONFIG_CRASH_HOTPLUG >> &crash_elfcorehdr_size_attr.attr, >> #endif >> -- >> 2.51.1 >>