Move recovery/coredump configuration to sysfs
v5 cover Move recovery/coredump configuration to sysfs
From Android R onwards Google has restricted access to debugfs in user and user-debug builds. This restricts access to most of the features exposed through debugfs. This patch series removes the recovery/coredump entries from debugfs and moves them to sysfs.
'Coredump' and 'Recovery' are critical interfaces that are required for remoteproc to work on Qualcomm Chipsets. Coredump configuration needs to be set to "inline" in debug/test build and "disabled" in production builds. Whereas recovery needs to be "disabled" for debugging purposes and "enabled" on production builds.
Changelog:
v5 -> v4:
- Fix the cover-letter of tha patch series.
v4 -> v3:
- Remove the feature flag to expose recovery/coredump
v3 -> v2:
- Remove the coredump/recovery entries from debugfs
- Expose recovery/coredump from sysfs under a feature flag
v1 -> v2:
- Correct the contact name in the sysfs documentation.
- Remove the redundant write documentation for coredump/recovery sysfs
- Add a feature flag to make this interface switch configurable.
Rishabh Bhatnagar (2):
remoteproc: Move coredump configuration to sysfs
remoteproc: Move recovery configuration to sysfs
Documentation/ABI/testing/sysfs-class-remoteproc | 44 ++++++ drivers/remoteproc/remoteproc_debugfs.c | 168 ----------------------- drivers/remoteproc/remoteproc_sysfs.c | 120 ++++++++++++++++ 3 files changed, 164 insertions(+), 168 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v5 1/2 remoteproc: Move coredump configuration to sysfs
Move coredump configuration from debugfs to sysfs.This will allow usage of this configuration feature in production devices where access to debugfs might be limited.
--- Documentation/ABI/testing/sysfs-class-remoteproc | 24 +++++++ drivers/remoteproc/remoteproc_debugfs.c | 90 ------------------------ drivers/remoteproc/remoteproc_sysfs.c | 64 +++++++++++++++++ 3 files changed, 88 insertions(+), 90 deletions(-)
Documentation/ABI/testing/sysfs-class-remoteproc +24 -0
@@ -58,3 +58,27 @@ Description: Remote processor name Reports the name of the remote processor. This can be used by userspace in exactly identifying a remote processor and ease up the usage in modifying the 'firmware' or 'state' files. + +What: /sys/class/remoteproc/.../coredump +Date: July 2020 +Contact: Bjorn Andersson <[email protected]>, Ohad Ben-Cohen <[email protected]> +Description: Remote processor coredump configuration + + Reports the coredump configuration of the remote processor, + which will be one of: + + "default" + "inline" + "disabled" + + "default" means when the remote processor's coredump is + collected it will be copied to a separate buffer and that + buffer is exposed to userspace. + + "inline" means when the remote processor's coredump is + collected userspace will directly read from the remote + processor's device memory. Extra buffer will not be used to + copy the dump. Also recovery process will not proceed until + all data is read by usersapce. + + "disabled" means no dump will be collected.
drivers/remoteproc/remoteproc_debugfs.c +0 -90
102 lines not on this page · raw message
drivers/remoteproc/remoteproc_sysfs.c +64 -0
76 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v5 1/2] remoteproc: Move coredump configuration to sysfs
Quoted 1 line · Rishabh Bhatnagar
drivers/remoteproc/remoteproc_debugfs.c +0
-0
[..]
drivers/remoteproc/remoteproc_debugfs.c
Quoted 12 lines
drivers/remoteproc/remoteproc_debugfs.c +12
-0+static ssize_t coredump_store (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct rproc *rproc =to_rproc (dev); + +if (rproc->state ==RPROC_CRASHED ) { +dev_err (&rproc->dev,"can't change coredump configuration\n" ); +return -EBUSY ; + } + +if (sysfs_streq (buf,"disable" )) {
As pointed out by Sibi (somewhere) this should be "disabled" to match what's returned in coredump_show() and what goes into the recovery file.
drivers/remoteproc/remoteproc_debugfs.c
Quoted 4 lines
drivers/remoteproc/remoteproc_debugfs.c +4
-0+ rproc->dump_conf =RPROC_COREDUMP_DISABLED ; + }else if (sysfs_streq (buf,"inline" )) { + rproc->dump_conf =RPROC_COREDUMP_INLINE ; + }else if (sysfs_streq (buf,"default" )) {
As I pointed out in a previous review, I think it makes sense to change the default for dump_conf to "disabled" (a separate change). But in doing so using the word "default" in the sysfs interface would be misleading - and once it's part of sysfs it stays.
So how about changing this to "enabled"?
PS. The change of the default value of dump_conf would, in line with Mathieu's ask, be a separate/unrelated change.
Regards,
Bjorn
PATCH v5 2/2 remoteproc: Move recovery configuration to sysfs
In reply to Rishabh BhatnagarMove recovery configuration from debugfs to sysfs.This will allow usage of this configuration feature in production devices where access to debugfs might be limited.
--- Documentation/ABI/testing/sysfs-class-remoteproc | 20 ++++++ drivers/remoteproc/remoteproc_debugfs.c | 78 ------------------------ drivers/remoteproc/remoteproc_sysfs.c | 56 +++++++++++++++++ 3 files changed, 76 insertions(+), 78 deletions(-)
Documentation/ABI/testing/sysfs-class-remoteproc +20 -0
@@ -82,3 +82,23 @@ Description: Remote processor coredump configuration all data is read by usersapce. "disabled" means no dump will be collected. + +What: /sys/class/remoteproc/.../recovery +Date: July 2020 +Contact: Bjorn Andersson <[email protected]>, Ohad Ben-Cohen <[email protected]> +Description: Remote processor recovery mechanism + + Reports the recovery mechanism of the remote processor, + which will be one of: + + "enabled" + "disabled" + + "enabled" means, the remote processor will be automatically + recovered whenever it crashes. Moreover, if the remote + processor crashes while recovery is disabled, it will + be automatically recovered too as soon as recovery is enabled. + + "disabled" means, a remote processor will remain in a crashed + state if it crashes. This is useful for debugging purposes; + without it, debugging a crash is substantially harder.
drivers/remoteproc/remoteproc_debugfs.c +0 -78
90 lines not on this page · raw message
drivers/remoteproc/remoteproc_sysfs.c +56 -0
68 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project