All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <cminyard@mvista.com>
To: minyard@acm.org, linux-mips@linux-mips.org
Cc: David Daney <ddaney@caviumnetworks.com>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>
Subject: Re: [PATCH] mips: Fix crash registers on non-crashing CPUs
Date: Wed, 20 Apr 2016 08:24:54 -0500	[thread overview]
Message-ID: <57178326.1090801@mvista.com> (raw)
In-Reply-To: <1460383819-5213-1-git-send-email-minyard@acm.org>

Anything on this?

-corey

On 04/11/2016 09:10 AM, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> As part of handling a crash on an SMP system, an IPI is send to
> all other CPUs to save their current registers and stop.  It was
> using task_pt_regs(current) to get the registers, but that will
> only be accurate if the CPU was interrupted running in userland.
> Instead allow the architecture to pass in the registers (all
> pass NULL now, but allow for the future) and then use get_irq_regs()
> which should be accurate as we are in an interrupt.  Fall back to
> task_pt_regs(current) if nothing else is available.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> ---
>   arch/mips/kernel/crash.c | 16 +++++++++++++---
>   1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c
> index d434d5d..610f0f3 100644
> --- a/arch/mips/kernel/crash.c
> +++ b/arch/mips/kernel/crash.c
> @@ -14,12 +14,22 @@ static int crashing_cpu = -1;
>   static cpumask_t cpus_in_crash = CPU_MASK_NONE;
>   
>   #ifdef CONFIG_SMP
> -static void crash_shutdown_secondary(void *ignore)
> +static void crash_shutdown_secondary(void *passed_regs)
>   {
> -	struct pt_regs *regs;
> +	struct pt_regs *regs = passed_regs;
>   	int cpu = smp_processor_id();
>   
> -	regs = task_pt_regs(current);
> +	/*
> +	 * If we are passed registers, use those.  Otherwise get the
> +	 * regs from the last interrupt, which should be correct, as
> +	 * we are in an interrupt.  But if the regs are not there,
> +	 * pull them from the top of the stack.  They are probably
> +	 * wrong, but we need something to keep from crashing again.
> +	 */
> +	if (!regs)
> +		regs = get_irq_regs();
> +	if (!regs)
> +		regs = task_pt_regs(current);
>   
>   	if (!cpu_online(cpu))
>   		return;

  reply	other threads:[~2016-04-20 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11 14:10 [PATCH] mips: Fix crash registers on non-crashing CPUs minyard
2016-04-20 13:24 ` Corey Minyard [this message]
2016-04-20 13:33   ` Ralf Baechle
2016-04-20 13:43     ` Corey Minyard

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=57178326.1090801@mvista.com \
    --to=cminyard@mvista.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=minyard@acm.org \
    --cc=ralf@linux-mips.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 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.