Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp692951ybl; Fri, 6 Dec 2019 04:50:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzigjPEFFubrWLjkIRq88xe0llJRnxG/XC1GMmEdsjKHUhgcjDNJNydhAD029cHAgePNvVm X-Received: by 2002:a9d:6b12:: with SMTP id g18mr10543527otp.211.1575636647752; Fri, 06 Dec 2019 04:50:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575636647; cv=none; d=google.com; s=arc-20160816; b=0Cvw9rWr5mQvbi8Su/j7s3D5rF1lRbqKFqMRwuPzie1uWe9A2xItSWbyEZoq9gEVVG fmibQmsEAsgA3H5l14pnOUXhT0iJdAIVdSZHg0rjPxbrsHiH5Xc+RJkeafFfVhd6nXq6 l8YJqKbwBUXzFgS3Xo29LEVmr9pGi7K7R8vxMWJPtqtlwTX1WpgHz8fxKYiy9753hq4a QfzvOq9ePL00zyIwVK3HeBxkBkDgbRB5uv4cxbKrljaYpUlXzRWNALNAnIF/CZfCASnf BAJD1udEMi6txKHcfwnee2M4coP1SdUA2cuN50mdhD03A3v0iakau7vvk4QGVbyiYXWi /4DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=K4mbEOYeWNqn2FUMcKjHoZYxwU7bj0SoGqL7iXSzEc0=; b=sDFXO4pVEEqly/FHEEP0nT92Hyahmxl4grrwN9bwDR16VcZT6/fqXBIokJtUnogmXz 1xkucWHtET3aR3jRCq00U6fSJhZLXo3KDJB2k4tuEkcL2C5KloFinevjJPsDfNw6WTDw TFy44V7vpcULIvUfch6QRisyGP1az8Fms3AaSlZ/guujn8JxSagDGjnf2lx61PTNJ08K k35pIKiPoYaFkq6PrbdH4x3g//Chx0pZbVR13lPmzUPDT4/tXU8pD/XB+OYoif+gyUYv Xtexew5dhyc3EYMioWiBtUAlRwhwM+ZWrc9s/tuftm9fzfjRNWBGv1LVnYmNSBaiJvzN dUHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mq6KZ0gL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si6319758otq.37.2019.12.06.04.50.34; Fri, 06 Dec 2019 04:50:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=mq6KZ0gL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726347AbfLFMs7 (ORCPT + 99 others); Fri, 6 Dec 2019 07:48:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:51408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbfLFMs7 (ORCPT ); Fri, 6 Dec 2019 07:48:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6665205F4; Fri, 6 Dec 2019 12:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575636538; bh=RcAid3Q85jwRgv30uwm5l3b6o2yOnXW3SLXq6APNSfk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mq6KZ0gLrxaZO23IUL/dIcoNXVplyKO2N1F/AmlUgbvXsbymiL7rtfoxlvtt6CkB9 hxPxNmzW0R4BOePNeBwnH3okTWl8xlBcu2bF4WG+RH4rBWLBRISiqp3jRAN6bIVbxQ 6W4/DcMJ9YNECSVgkaECzhfCgTzccVdw5YVVfBZE= Date: Fri, 6 Dec 2019 13:48:55 +0100 From: Greg KH To: Sourabh Jain Cc: mpe@ellerman.id.au, 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 Subject: Re: [PATCH v4 6/6] powerpc/fadump: sysfs for fadump memory reservation Message-ID: <20191206124855.GE1360047@kroah.com> References: <20191206122434.29587-1-sourabhjain@linux.ibm.com> <20191206122434.29587-7-sourabhjain@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191206122434.29587-7-sourabhjain@linux.ibm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 06, 2019 at 05:54:34PM +0530, Sourabh Jain wrote: > 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 5d988b919e81..8f7a64a81783 100644 > --- a/Documentation/ABI/testing/sysfs-kernel-fadump > +++ b/Documentation/ABI/testing/sysfs-kernel-fadump > @@ -31,3 +31,10 @@ Description: write only > the system is booted to capture the vmcore using FADump. > It is used to release the memory reserved by FADump to > save the crash dump. > + > +What: /sys/kernel/fadump/mem_reserved > +Date: Dec 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 365c10209ef3..04993eaf3113 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 41a3cda81791..b2af51b7c750 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,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); __ATTRI_RO()? > + > > DEFINE_SHOW_ATTRIBUTE(fadump_region); > > @@ -1464,6 +1475,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); Again, put it in an attribute group, that would have only required one line, and not this mess of not cleaning up if something went wrong. thanks, greg k-h