remoteproc: Add inline coredump functionality

The current coredump implementation uses vmalloc area to copy
all the segments. But this might put strain on low memory targets
as the firmware size sometimes is in tens of MBs. The situation
becomes worse if there are multiple remote processors undergoing
recovery at the same time. This patch adds inline coredump
functionality that avoids extra memory usage. This requires
recovery to be halted until data is read by userspace and free
function is called.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Sibi Sankar <sibis@codeaurora.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Tested-by: Sibi Sankar <sibis@codeaurora.org>
Link: https://lore.kernel.org/r/1594938035-7327-5-git-send-email-rishabhb@codeaurora.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Rishabh Bhatnagar
2020-07-16 15:20:34 -07:00
committed by Bjorn Andersson
parent 76abf9cea6
commit c97319881c
2 changed files with 154 additions and 18 deletions

View File

@@ -439,6 +439,20 @@ enum rproc_crash_type {
RPROC_FATAL_ERROR,
};
/**
* enum rproc_dump_mechanism - Coredump options for core
* @RPROC_COREDUMP_DEFAULT: Copy dump to separate buffer and carry on with
recovery
* @RPROC_COREDUMP_INLINE: Read segments directly from device memory. Stall
recovery until all segments are read
* @RPROC_COREDUMP_DISABLED: Don't perform any dump
*/
enum rproc_dump_mechanism {
RPROC_COREDUMP_DEFAULT,
RPROC_COREDUMP_INLINE,
RPROC_COREDUMP_DISABLED,
};
/**
* struct rproc_dump_segment - segment info from ELF header
* @node: list node related to the rproc segment list
@@ -471,6 +485,7 @@ struct rproc_dump_segment {
* @dev: virtual device for refcounting and common remoteproc behavior
* @power: refcount of users who need this rproc powered up
* @state: state of the device
* @dump_conf: Currently selected coredump configuration
* @lock: lock which protects concurrent manipulations of the rproc
* @dbg_dir: debugfs directory of this rproc device
* @traces: list of trace buffers
@@ -505,6 +520,7 @@ struct rproc {
struct device dev;
atomic_t power;
unsigned int state;
enum rproc_dump_mechanism dump_conf;
struct mutex lock;
struct dentry *dbg_dir;
struct list_head traces;