All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Xiang Xiao <xiaoxiang781216@gmail.com>
Cc: linux-remoteproc@vger.kernel.org, Xiang Xiao <xiaoxiang@xiaomi.com>
Subject: Re: [PATCH] remoteproc: debug: add crash debugfs node
Date: Wed, 7 Nov 2018 22:27:43 -0800	[thread overview]
Message-ID: <20181108062743.GA12063@builder> (raw)
In-Reply-To: <1541604361-1475-1-git-send-email-xiaoxiang@xiaomi.com>

On Wed 07 Nov 07:26 PST 2018, Xiang Xiao wrote:

> so we can trigger the crash manully which could:
> 1.test the crash handling code path more easily
> 2.update the firmware without reboot kernel

It's probably better to stop then start the remoteproc to update the
firmware, but I like the patch - applied for v4.21.

Regards,
Bjorn

> 
> Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
> ---
>  drivers/remoteproc/remoteproc_debugfs.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c
> index 0808466..fca4b2b 100644
> --- a/drivers/remoteproc/remoteproc_debugfs.c
> +++ b/drivers/remoteproc/remoteproc_debugfs.c
> @@ -154,6 +154,30 @@ static const struct file_operations rproc_recovery_ops = {
>  	.llseek = generic_file_llseek,
>  };
>  
> +/* expose the crash trigger via debugfs */
> +static ssize_t
> +rproc_crash_write(struct file *filp, const char __user *user_buf,
> +		  size_t count, loff_t *ppos)
> +{
> +	struct rproc *rproc = filp->private_data;
> +	unsigned int type;
> +	int ret;
> +
> +	ret = kstrtouint_from_user(user_buf, count, 0, &type);
> +	if (ret < 0)
> +		return ret;
> +
> +	rproc_report_crash(rproc, type);
> +
> +	return count;
> +}
> +
> +static const struct file_operations rproc_crash_ops = {
> +	.write = rproc_crash_write,
> +	.open = simple_open,
> +	.llseek = generic_file_llseek,
> +};
> +
>  /* Expose resource table content via debugfs */
>  static int rproc_rsc_table_show(struct seq_file *seq, void *p)
>  {
> @@ -324,6 +348,8 @@ void rproc_create_debug_dir(struct rproc *rproc)
>  			    rproc, &rproc_name_ops);
>  	debugfs_create_file("recovery", 0400, rproc->dbg_dir,
>  			    rproc, &rproc_recovery_ops);
> +	debugfs_create_file("crash", 0200, rproc->dbg_dir,
> +			    rproc, &rproc_crash_ops);
>  	debugfs_create_file("resource_table", 0400, rproc->dbg_dir,
>  			    rproc, &rproc_rsc_table_ops);
>  	debugfs_create_file("carveout_memories", 0400, rproc->dbg_dir,
> -- 
> 2.7.4
> 

      reply	other threads:[~2018-11-08  6:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 15:26 [PATCH] remoteproc: debug: add crash debugfs node Xiang Xiao
2018-11-08  6:27 ` Bjorn Andersson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181108062743.GA12063@builder \
    --to=bjorn.andersson@linaro.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=xiaoxiang781216@gmail.com \
    --cc=xiaoxiang@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.