Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3129107ybe; Sun, 15 Sep 2019 08:13:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbAfbPR3Idf7Usn0JugTcQY9hqH/we1fgGH1YU6pLLHmq53DdvG28lKqfwU2OCjtmiG+/S X-Received: by 2002:a17:906:c79a:: with SMTP id cw26mr7457218ejb.265.1568560407983; Sun, 15 Sep 2019 08:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568560407; cv=none; d=google.com; s=arc-20160816; b=PWfUSizpwnnP11frqrl1V13bM4hI2tKXVj2riF8VJUEYjjD4KabHQco4nIlvX0jKgu 8LluUjDJC0wXZZtzUeUBjHCZpugUFxWXmXsEfyF/jxcsmQJFvjBdqBc9gZCQTRzakpsK XhFxBKK50UERzQIuA3NeiU8UbRiNqMrwQ7yCiBXHrQ24hIx/P4xbfYx+XbVr6/aVB1n6 l6I3tGkVvEhT/tfeMqGPfvnEUehtpAC7HryXYa5DODNA0cDcn1VhqLXGarSwNfHq5Xen ydnaerjeqnXN+YszueVoF6pd4+bmenqCAtmpLeLmY6SBhOlSsBw2k117eiDKc2v56H11 bS5A== 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=4AhTZte00rXabXBHyyUAJm3i9/nNkpWpyCbN1OSGaxI=; b=CQI2UujDyJ71PEyQ4BrrpyDyrGfmW3K16fJy8mZ9sQPGaQStUiX1vqRaR0/T113y3x 7YA3DqNqqbuYdwsGIDtphp2qmSuvTq3AwAjpBtEJZ6x7Ng+0jd+xqZdwVI+5NNfaaRpX U4aBk1qiAjTFsJ08yIC/s9YDFoCknOIx4JlThyC8VorTBIOvxxcJlOxNYbMjb51dfIDC p4wXYd7NNn4hru+eyg67P4xUrDmyI6iyQH5zWQvwgpduoHdM/90WwfOx4HjQPfSFznxr IgirXwWl+T2qUCCGFuQNFjzvJD2O/78WUmSpmgdTvIK5J6JfC+t+S5AGekZkKSpAq76r 7ALA== 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 j51si21222982ede.301.2019.09.15.08.13.01; Sun, 15 Sep 2019 08:13:27 -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 S1731214AbfIONXd (ORCPT + 99 others); Sun, 15 Sep 2019 09:23:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:14194 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731163AbfIONXb (ORCPT ); Sun, 15 Sep 2019 09:23:31 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8FDMcnU049956 for ; Sun, 15 Sep 2019 09:23:29 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v1d70t6ja-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 15 Sep 2019 09:23:29 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 15 Sep 2019 14:23:27 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 15 Sep 2019 14:23:25 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8FDNOjw52166872 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 15 Sep 2019 13:23:24 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A631A4060; Sun, 15 Sep 2019 13:23:24 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E13AFA405B; Sun, 15 Sep 2019 13:23:22 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.199.54.91]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 15 Sep 2019 13:23:22 +0000 (GMT) From: Sourabh Jain To: linuxppc-dev@ozlabs.org Cc: mahesh@linux.vnet.ibm.com, hbathini@linux.ibm.com, linux-kernel@vger.kernel.org, mpe@ellerman.id.au, corbet@lwn.net, linux-doc@vger.kernel.org Subject: [PATCH 4/4] powerpc/fadump: sysfs for fadump memory reservation Date: Sun, 15 Sep 2019 18:53:10 +0530 X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190915132310.13542-1-sourabhjain@linux.ibm.com> References: <20190915132310.13542-1-sourabhjain@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19091513-0012-0000-0000-0000034BEF4F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091513-0013-0000-0000-000021866297 Message-Id: <20190915132310.13542-5-sourabhjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-15_07:,, 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-1908290000 definitions=main-1909150147 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 | 14 ++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-fadump b/Documentation/ABI/testing/sysfs-kernel-fadump index ed8eec3d759c..34cb89173872 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/fadump_mem_reserved +Date: Sep 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 4fd7f5eab97d..7e8404052ba7 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/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 bb70fa208a86..d970ce2a8a44 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) @@ -1430,6 +1437,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); @@ -1487,6 +1497,10 @@ static void fadump_init_files(void) pr_err("unable to create fadump/fadump_release_mem sysfs file (%d)\n", rc); } + rc = sysfs_create_file(fadump_kobj, &fadump_mem_reserved_attr.attr); + if (rc) + pr_err("unable to create fadump_mem_reserved sysfs file (%d)\n", + rc); return; } -- 2.17.2