The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nick Hu <nickhu@andestech.com>
To: Christoph Hellwig <hch@lst.de>
Cc: <green.hu@gmail.com>, <deanbo422@gmail.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] nds32: remove dump_instr
Date: Tue, 21 Jul 2020 19:08:34 +0800	[thread overview]
Message-ID: <20200721110834.GB19721@atcfdc88> (raw)
In-Reply-To: <20200720114448.205876-1-hch@lst.de>

On Mon, Jul 20, 2020 at 01:44:47PM +0200, Christoph Hellwig wrote:
> dump_inst has a return before actually doing anything, so just drop the
> whole thing.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/kernel/traps.c | 35 -----------------------------------
>  1 file changed, 35 deletions(-)
> 
> diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c
> index 6a9772ba739276..b66f889bc6df9b 100644
> --- a/arch/nds32/kernel/traps.c
> +++ b/arch/nds32/kernel/traps.c
> @@ -62,40 +62,6 @@ void dump_mem(const char *lvl, unsigned long bottom, unsigned long top)
>  
>  EXPORT_SYMBOL(dump_mem);
>  
> -static void dump_instr(struct pt_regs *regs)
> -{
> -	unsigned long addr = instruction_pointer(regs);
> -	mm_segment_t fs;
> -	char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
> -	int i;
> -
> -	return;
> -	/*
> -	 * We need to switch to kernel mode so that we can use __get_user
> -	 * to safely read from kernel space.  Note that we now dump the
> -	 * code first, just in case the backtrace kills us.
> -	 */
> -	fs = get_fs();
> -	set_fs(KERNEL_DS);
> -
> -	pr_emerg("Code: ");
> -	for (i = -4; i < 1; i++) {
> -		unsigned int val, bad;
> -
> -		bad = __get_user(val, &((u32 *) addr)[i]);
> -
> -		if (!bad) {
> -			p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val);
> -		} else {
> -			p += sprintf(p, "bad PC value");
> -			break;
> -		}
> -	}
> -	pr_emerg("Code: %s\n", str);
> -
> -	set_fs(fs);
> -}
> -
>  #define LOOP_TIMES (100)
>  static void __dump(struct task_struct *tsk, unsigned long *base_reg,
>  		   const char *loglvl)
> @@ -179,7 +145,6 @@ void die(const char *str, struct pt_regs *regs, int err)
>  
>  	if (!user_mode(regs) || in_interrupt()) {
>  		dump_mem("Stack: ", regs->sp, (regs->sp + PAGE_SIZE) & PAGE_MASK);
> -		dump_instr(regs);
>  		dump_stack();
>  	}
>  
> -- 
> 2.27.0
>

Acked-by: Nick Hu <nickhu@andestech.com> 

      parent reply	other threads:[~2020-07-21 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 11:44 [PATCH 1/2] nds32: remove dump_instr Christoph Hellwig
2020-07-20 11:44 ` [PATCH 2/2] nds32: use get_kernel_nofault in dump_mem Christoph Hellwig
2020-07-21 11:07   ` Nick Hu
2020-07-21 11:28     ` Christoph Hellwig
2021-01-28 10:16       ` Christoph Hellwig
2021-02-24  7:47         ` Christoph Hellwig
2021-02-24  8:59           ` Greentime Hu
2021-02-24  9:02             ` Christoph Hellwig
2020-07-21 11:08 ` Nick Hu [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=20200721110834.GB19721@atcfdc88 \
    --to=nickhu@andestech.com \
    --cc=deanbo422@gmail.com \
    --cc=green.hu@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox