Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1847118ybl; Sat, 10 Aug 2019 11:00:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpq6PDqZWwLzwk6+9b6VtkA9LI7BMkquD8G2Qcqau1xm12Q1OGlKzHK9yK10XFTRwidxnA X-Received: by 2002:a17:902:9688:: with SMTP id n8mr24548191plp.227.1565460026148; Sat, 10 Aug 2019 11:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565460026; cv=none; d=google.com; s=arc-20160816; b=gawXmQnfmVN85ue6ds182OMFCOTslM3CfVm8lXe5GXE+7nHvmr2IdeMqc8kbt63H9U k8ufL+SNwUlqSMoLV5CT3xOFcoZJ+2Aa1S2fk47Ch79HhqJDaflBILtWdjPsvAif0MbR nVxFPWcfRwLs/9fdbXD7rIFXBxyCFPUNEJ8IvUpg8WAqT1M7vxDev3VJk2rRDuwRtE1c O7dYWCsuyvZzK99vafjfOAEazgH1uG7YEbJ3KqakB0aKetf26cDPOm8wRWRlF2CjXKeO ikGfDUS8uoC855tTCxLD10of4yxAYJ5LC2vwDyHBa4uriQZ6drSeD3EcCxmpJsIJ7Smr YnxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=9I9A6o1aNdS8DB3gVROqGIxutYTkdOZkr4gBxEVLOi0=; b=G5lO6jGdjjqKx+n+MjrOfBmWXGFd7gVy834Ej7mvuoC7MZuzAOlSoqx8q+HYcFYXLW Qa9Yhlu+BF/MumXlfm5mZ/FvU6vwGQ1sfTnJrSbZ/r3nu/Y+Nl2w/YNWmPIVLrndvZUG +8lFNlu/FSGA199vV0yY4EaU45xbjJm2tYY6Ng7dVSjyZHQ6QxqyiUDUGsnI07AiAhlq /A7gq0nbL+N+69gVBe3rvVwUa7rqtZI53JKw4Iqf+r2qbsfmYf9TXzalW691dCEXF/k0 YKftraAvmzYXp2Nb8O09Bka8zyJNmiC6Dm7iqimBF3x01/h001Uqv79HPf4y4Yu7gzpc b0nQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x18si55674850plm.292.2019.08.10.11.00.09; Sat, 10 Aug 2019 11:00:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbfHJR7e (ORCPT + 99 others); Sat, 10 Aug 2019 13:59:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:25994 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725788AbfHJR7e (ORCPT ); Sat, 10 Aug 2019 13:59:34 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7AHuiFp139762 for ; Sat, 10 Aug 2019 13:59:32 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2u9qjc7y1b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 10 Aug 2019 13:59:32 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 10 Aug 2019 18:59:31 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 10 Aug 2019 18:59:28 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7AHxQL949676360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 10 Aug 2019 17:59:26 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B43BCA405B; Sat, 10 Aug 2019 17:59:26 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA01EA405C; Sat, 10 Aug 2019 17:59:19 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.199.50.95]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 10 Aug 2019 17:59:19 +0000 (GMT) From: Sourabh Jain To: mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, mahesh@linux.vnet.ibm.com, hbathini@linux.ibm.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, corbet@lwn.net, Sourabh Jain Subject: [PATCH v3] powerpc/fadump: sysfs for fadump memory reservation Date: Sat, 10 Aug 2019 23:29:05 +0530 X-Mailer: git-send-email 2.17.2 X-TM-AS-GCONF: 00 x-cbid: 19081017-0008-0000-0000-0000030788CC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19081017-0009-0000-0000-00004A259485 Message-Id: <20190810175905.7761-1-sourabhjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-10_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908100201 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a sys interface to allow querying the memory reserved by fadump for saving the crash dump. Add an ABI doc entry for new sysfs interface. - /sys/kernel/fadump_mem_reserved Signed-off-by: Sourabh Jain --- Changelog: v1 -> v2: - Added ABI doc for new sysfs interface. v2 -> v3: - Updated the ABI documentation. --- Documentation/ABI/testing/sysfs-kernel-fadump | 6 ++++++ Documentation/powerpc/firmware-assisted-dump.rst | 5 +++++ arch/powerpc/kernel/fadump.c | 14 ++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-kernel-fadump diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump b/Documentation/ABI/testing/sysfs-kernel-fadump new file mode 100644 index 000000000000..ec034939475b --- /dev/null +++ b/Documentation/ABI/testing/sysfs-kernel-fadump @@ -0,0 +1,6 @@ +What: /sys/kernel/fadump_mem_reserved +Date: August 2019 +Contact: linuxppc-dev@lists.ozlabs.org +Description: read only + Provide information about the amount of memory + reserved by fadump to save the crash dump. diff --git a/Documentation/powerpc/firmware-assisted-dump.rst b/Documentation/powerpc/firmware-assisted-dump.rst index 9ca12830a48e..a5dfb20d4dc3 100644 --- a/Documentation/powerpc/firmware-assisted-dump.rst +++ b/Documentation/powerpc/firmware-assisted-dump.rst @@ -222,6 +222,11 @@ Here is the list of files under kernel sysfs: be handled and vmcore will not be captured. This interface can be easily integrated with kdump service start/stop. + /sys/kernel/fadump_mem_reserved + + This is used to display the memory reserved by fadump for saving the + crash dump. + /sys/kernel/fadump_release_mem This file is available only when fadump is active during second kernel. This is used to release the reserved memory diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 4eab97292cc2..cd373d1d4b82 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1514,6 +1514,13 @@ static ssize_t fadump_enabled_show(struct kobject *kobj, return sprintf(buf, "%d\n", fw_dump.fadump_enabled); } +static ssize_t fadump_mem_reserved_show(struct kobject *kobj, + struct kobj_attribute *attr, + char *buf) +{ + return sprintf(buf, "%ld\n", fw_dump.reserve_dump_area_size); +} + static ssize_t fadump_register_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -1632,6 +1639,9 @@ static struct kobj_attribute fadump_attr = __ATTR(fadump_enabled, static struct kobj_attribute fadump_register_attr = __ATTR(fadump_registered, 0644, fadump_register_show, fadump_register_store); +static struct kobj_attribute fadump_mem_reserved_attr = + __ATTR(fadump_mem_reserved, 0444, + fadump_mem_reserved_show, NULL); DEFINE_SHOW_ATTRIBUTE(fadump_region); @@ -1663,6 +1673,10 @@ static void fadump_init_files(void) printk(KERN_ERR "fadump: unable to create sysfs file" " fadump_release_mem (%d)\n", rc); } + rc = sysfs_create_file(kernel_kobj, &fadump_mem_reserved_attr.attr); + if (rc) + pr_err("unable to create sysfs file fadump_mem_reserved (%d)\n", + rc); return; } -- 2.17.2