Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6621972ybh; Thu, 8 Aug 2019 03:09:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQhfi/wRqXuc8Q8ko+l/4sw/+3VGj8v5hHPOh6QmvobOtiAoCcyeI8uhLzFads/q/zUdMX X-Received: by 2002:a17:902:b497:: with SMTP id y23mr13042191plr.68.1565258979054; Thu, 08 Aug 2019 03:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565258979; cv=none; d=google.com; s=arc-20160816; b=A6YtUWDE1ZFaFFiX/Vk0aS+MukLXGRZD4zhUtrNlJQghoHgGCEI4pa6P3Otq3Vnat4 vM55eh041sRC3azL9NOHjOHXWNZii8nRXnC7Jao8tbBLRmlA/FqN6ZFxCnYZMAji+0Py lYOjaj87zZGgYs4xbJ9pEAfnEGaG3NAyb6+Bhn0rD6TXN0pNmGu70bGgMyig+TsRZuGK vQgHNlFDzIHOVPi8TU+ikYuTcPH6jkO3DCKeJkrVO38XkqYKFPYR13o/f6rMGalNLJOz oqpDIKNH0I31X7kTB3W7LzxTkOq7Hwe/gAxuI3cPoosVVatNEsLnihFKL1XOV7VhCUi8 M7Lg== 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=9RN8/ZWnJF1NKdXVEIKJp4hTti1Duulj1SoxJDxrFTY=; b=gf9/jutJDrVoKHuqcwACHNmkYoHH/8aN3Fn1XvbGeH6SWtEjNVPomp1707cGGqRxiw nvqTsn5R/08k/WGV1YGXvLoi+Nrfe0xJrWJjvLLy7Tnxd6lVSYey2u4Rz4Z0sp7A5mPk qYm355ENk21L0Hnt92HJqUooG/QuZech1XgYPLb5yar1PA9pj4un+x8+xAtobFksx6v7 JWVdrImOCPf7pT0MeAspwcSkjeLfzIbpD+BXhV4kTb3EJPsjFMtzxbAZnNuGxwcw9QyD zemOBez0zTIpKjDEIcZSgUSpUtAnoq3tPKB4lnIrTyd/W0pTvcz3bp7M//TnwGIAjEDl jyUQ== 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 y3si53378671pge.429.2019.08.08.03.09.20; Thu, 08 Aug 2019 03:09:39 -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 S2389801AbfHHKIq (ORCPT + 99 others); Thu, 8 Aug 2019 06:08:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:7418 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389793AbfHHKIp (ORCPT ); Thu, 8 Aug 2019 06:08:45 -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 x789vG49102916 for ; Thu, 8 Aug 2019 06:08:44 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2u8g0fcnjv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 08 Aug 2019 06:08:43 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Aug 2019 11:08:42 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 8 Aug 2019 11:08:39 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x78A8bgT43712954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Aug 2019 10:08:37 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28129A4051; Thu, 8 Aug 2019 10:08:37 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A847AA4040; Thu, 8 Aug 2019 10:08:35 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.86]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Aug 2019 10:08:35 +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 v2] powerpc/fadump: sysfs for fadump memory reservation Date: Thu, 8 Aug 2019 15:38:33 +0530 X-Mailer: git-send-email 2.17.2 X-TM-AS-GCONF: 00 x-cbid: 19080810-4275-0000-0000-0000035692A0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19080810-4276-0000-0000-00003868976C Message-Id: <20190808100833.30367-1-sourabhjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-08_05:,, 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=1011 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-1908080110 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 --- v1 -> v2: - Added ABI doc for new sysfs interface. --- 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..003e2f025dcb --- /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 saving 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