Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3839000ybx; Sat, 9 Nov 2019 04:26:03 -0800 (PST) X-Google-Smtp-Source: APXvYqw3g2UebuSioVH4rOoKpljRz8UC64S9M0WkgYTCJXVMCS+j+e0ILPb8n8bF69yHXyzpS9cT X-Received: by 2002:a17:906:2ccc:: with SMTP id r12mr12816066ejr.249.1573302362972; Sat, 09 Nov 2019 04:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573302362; cv=none; d=google.com; s=arc-20160816; b=mRjZfEqf7vII5+qJmD2rALFRd3j0IlbGbgVtl90JTt3mq7jbSomfsXZm9CKv63cEji bgQzP0pDx9UcxT8Fdb6a58X4jaE9LaDhL5A2Ly5IPjDSqCBuSEm/Yrhd1wfKHpUEnFoB +2M7vK1jrc9LLQjHenQnOQh5ANNa8dNZjAqynBkrfqBosKbpaI6aUq94ecY9K4pENmj2 1Wl54bs/AtCRG0pmLiSKD85ywaVcFanoYYKDp40Anbfa0oEzopeg1Q1v3qEH30fAIJur 7VV3MtMlgNTZX3Zhv8Yz6vjeYskgYhqOaGbqbb8yQK6pqG7fTP6RezwuVKo78B7r1NCd L7QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=JwJM94BqVDYg5VAwr4jL/pevvmIC0rvNxyaLIYXur4Q=; b=sIOtkhrf8QtC6b2mPKFwzm/EiwlnHsErXGzfDArKPi3Z6VlmeK7WyZI/VQyDkQmQMF +x4GRMLyD/GYQUzywBYKyZNjyTPu12nT1pgAImEVE8v3ScBoR+ITReetwAvbJY4Nd6th fac0zdLnA0bUdLk1OT8reMHcxMYU8XSoKAEScFR6joZXEInxmT56KY/REZcuUw61vB4u qS+vj4oYmfyaf14PBlpoxuM+9En5FUwmxlu7HyTpKFakND+zjFJwvz4kTCLXW1+wthlB RmdYMf9hGlPb2Da5ZruKIAaiZ4xt6D2wzIe/++u0gpAarj8T/q1doB+kGzJshedUg0Yz mQAA== 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 b7si6325186edb.439.2019.11.09.04.25.40; Sat, 09 Nov 2019 04:26:02 -0800 (PST) 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 S1726702AbfKIMYR (ORCPT + 99 others); Sat, 9 Nov 2019 07:24:17 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:31610 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726591AbfKIMYQ (ORCPT ); Sat, 9 Nov 2019 07:24:16 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA9C6aBL004367 for ; Sat, 9 Nov 2019 07:24:15 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2w5q8w8y70-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 09 Nov 2019 07:24:15 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 9 Nov 2019 12:24:13 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 9 Nov 2019 12:24:09 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA9CO8fR27459614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 9 Nov 2019 12:24:08 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06840A4053; Sat, 9 Nov 2019 12:24:08 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED43BA404D; Sat, 9 Nov 2019 12:24:05 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.85.73.97]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 9 Nov 2019 12:24:05 +0000 (GMT) From: Sourabh Jain To: mpe@ellerman.id.au Cc: mahesh@linux.vnet.ibm.com, hbathini@linux.ibm.com, linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, corbet@lwn.net, linux-doc@vger.kernel.org, Sourabh Jain Subject: [PATCH v3 4/4] powerpc/fadump: sysfs for fadump memory reservation Date: Sat, 9 Nov 2019 17:53:39 +0530 X-Mailer: git-send-email 2.17.2 In-Reply-To: <20191109122339.20484-1-sourabhjain@linux.ibm.com> References: <20191109122339.20484-1-sourabhjain@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19110912-0028-0000-0000-000003B46547 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110912-0029-0000-0000-0000247768F5 Message-Id: <20191109122339.20484-5-sourabhjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-11-09_03:,, 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-1910280000 definitions=main-1911090131 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. Also added Documentation/ABI for the new sysfs file. Signed-off-by: Sourabh Jain --- Documentation/ABI/testing/sysfs-kernel-fadump | 7 +++++++ Documentation/powerpc/firmware-assisted-dump.rst | 5 +++++ arch/powerpc/kernel/fadump.c | 15 +++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump b/Documentation/ABI/testing/sysfs-kernel-fadump index a77f1a5ba389..c1d87c787b9a 100644 --- a/Documentation/ABI/testing/sysfs-kernel-fadump +++ b/Documentation/ABI/testing/sysfs-kernel-fadump @@ -39,3 +39,10 @@ Description: write only The sysfs file is available when the system is booted to collect the dump on OPAL based machine. It used to release the memory used to collect the opalcore. + +What: /sys/kernel/fadump/mem_reserved +Date: Nov 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 in bytes. diff --git a/Documentation/powerpc/firmware-assisted-dump.rst b/Documentation/powerpc/firmware-assisted-dump.rst index fc7b06408cea..01c3c9461cd5 100644 --- a/Documentation/powerpc/firmware-assisted-dump.rst +++ b/Documentation/powerpc/firmware-assisted-dump.rst @@ -268,6 +268,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 a9591def0c84..2ed80f7b2652 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1357,6 +1357,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) @@ -1440,6 +1447,10 @@ static struct kobj_attribute enable_attr = __ATTR(enabled, static struct kobj_attribute register_attr = __ATTR(registered, 0644, fadump_register_show, fadump_register_store); +static struct kobj_attribute mem_reserved_attr = __ATTR(mem_reserved, + 0444, fadump_mem_reserved_show, + NULL); + DEFINE_SHOW_ATTRIBUTE(fadump_region); @@ -1496,6 +1507,10 @@ static void fadump_init_files(void) pr_err("unable to create release_mem sysfs file (%d)\n", rc); } + rc = sysfs_create_file(fadump_kobj, &mem_reserved_attr.attr); + if (rc) + pr_err("unable to create mem_reserved sysfs file (%d)\n", + rc); return; } -- 2.17.2