All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: OCTEON: Improve _machine_halt implementation.
@ 2013-05-24 17:23 David Daney
  2013-05-29  6:09 ` Wladislav Wiebe
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2013-05-24 17:23 UTC (permalink / raw)
  To: linux-mips, ralf; +Cc: David Daney, Maxim Uvarov, Wladislav Wiebe

From: David Daney <david.daney@cavium.com>

As noted by Wladislav Wiebe:
   $ halt
   ..
   Sent SIGKILL to all processes
   Requesting system halt
   [66.729373] System halted.
   [66.733244]
   [66.734761] =====================================
   [66.739473] [ BUG: lock held at task exit time! ]
   [66.744188] 3.8.7-0-sampleversion-fct #49 Tainted: G           O
   [66.750202] -------------------------------------
   [66.754913] init/21479 is exiting with locks still held!
   [66.760234] 1 lock held by init/21479:
   [66.763990]  #0:  (reboot_mutex){+.+...}, at: [<ffffffff801776c8>] SyS_reboot+0xe0/0x218
   [66.772165]
   [66.772165] stack backtrace:
   [66.776532] Call Trace:
   [66.778992] [<ffffffff805780a8>] dump_stack+0x8/0x34
   [66.783972] [<ffffffff801618b0>] do_exit+0x610/0xa70
   [66.788948] [<ffffffff801777a8>] SyS_reboot+0x1c0/0x218
   [66.794186] [<ffffffff8013d6a4>] handle_sys64+0x44/0x64

This is an alternative fix to the one sent by Wladislav.  We kill the
watchdog for each CPU and then spin in WAIT with interrupts disabled.
This is the lowest power mode for the OCTEON.  If we were to spin with
interrupts enabled, we would get a continual stream of warning messages
and backtraces from the lockup detector, so I chose to disable
interrupts.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Maxim Uvarov <muvarov@gmail.com>
Cc: Wladislav Wiebe <wladislav.kw@gmail.com>
---
 arch/mips/cavium-octeon/setup.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index b0baa29..01b1b3f 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -428,13 +428,16 @@ static void octeon_restart(char *command)
  */
 static void octeon_kill_core(void *arg)
 {
-	mb();
-	if (octeon_is_simulation()) {
-		/* The simulator needs the watchdog to stop for dead cores */
-		cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
+	if (octeon_is_simulation())
 		/* A break instruction causes the simulator stop a core */
-		asm volatile ("sync\nbreak");
-	}
+		asm volatile ("break" ::: "memory");
+
+	local_irq_disable();
+	/* Disable watchdog on this core. */
+	cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
+	/* Spin in a low power mode. */
+	while (true)
+		asm volatile ("wait" ::: "memory");
 }
 
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: OCTEON: Improve _machine_halt implementation.
  2013-05-24 17:23 [PATCH] MIPS: OCTEON: Improve _machine_halt implementation David Daney
@ 2013-05-29  6:09 ` Wladislav Wiebe
  0 siblings, 0 replies; 2+ messages in thread
From: Wladislav Wiebe @ 2013-05-29  6:09 UTC (permalink / raw)
  To: David Daney; +Cc: linux-mips, ralf, David Daney, Maxim Uvarov

Hi,

On 24/05/13 19:23, David Daney wrote:
> From: David Daney <david.daney@cavium.com>
> 
> As noted by Wladislav Wiebe:
>    $ halt
>    ..
>    Sent SIGKILL to all processes
>    Requesting system halt
>    [66.729373] System halted.
>    [66.733244]
>    [66.734761] =====================================
>    [66.739473] [ BUG: lock held at task exit time! ]
>    [66.744188] 3.8.7-0-sampleversion-fct #49 Tainted: G           O
>    [66.750202] -------------------------------------
>    [66.754913] init/21479 is exiting with locks still held!
>    [66.760234] 1 lock held by init/21479:
>    [66.763990]  #0:  (reboot_mutex){+.+...}, at: [<ffffffff801776c8>] SyS_reboot+0xe0/0x218
>    [66.772165]
>    [66.772165] stack backtrace:
>    [66.776532] Call Trace:
>    [66.778992] [<ffffffff805780a8>] dump_stack+0x8/0x34
>    [66.783972] [<ffffffff801618b0>] do_exit+0x610/0xa70
>    [66.788948] [<ffffffff801777a8>] SyS_reboot+0x1c0/0x218
>    [66.794186] [<ffffffff8013d6a4>] handle_sys64+0x44/0x64
> 
> This is an alternative fix to the one sent by Wladislav.  We kill the
> watchdog for each CPU and then spin in WAIT with interrupts disabled.
> This is the lowest power mode for the OCTEON.  If we were to spin with
> interrupts enabled, we would get a continual stream of warning messages
> and backtraces from the lockup detector, so I chose to disable
> interrupts.
> 

good alternative!

Thanks.
--
Wladislav Wiebe


> Signed-off-by: David Daney <david.daney@cavium.com>
> Cc: Maxim Uvarov <muvarov@gmail.com>
> Cc: Wladislav Wiebe <wladislav.kw@gmail.com>
> ---
>  arch/mips/cavium-octeon/setup.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
> index b0baa29..01b1b3f 100644
> --- a/arch/mips/cavium-octeon/setup.c
> +++ b/arch/mips/cavium-octeon/setup.c
> @@ -428,13 +428,16 @@ static void octeon_restart(char *command)
>   */
>  static void octeon_kill_core(void *arg)
>  {
> -	mb();
> -	if (octeon_is_simulation()) {
> -		/* The simulator needs the watchdog to stop for dead cores */
> -		cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
> +	if (octeon_is_simulation())
>  		/* A break instruction causes the simulator stop a core */
> -		asm volatile ("sync\nbreak");
> -	}
> +		asm volatile ("break" ::: "memory");
> +
> +	local_irq_disable();
> +	/* Disable watchdog on this core. */
> +	cvmx_write_csr(CVMX_CIU_WDOGX(cvmx_get_core_num()), 0);
> +	/* Spin in a low power mode. */
> +	while (true)
> +		asm volatile ("wait" ::: "memory");
>  }
>  
>  
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-29  6:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24 17:23 [PATCH] MIPS: OCTEON: Improve _machine_halt implementation David Daney
2013-05-29  6:09 ` Wladislav Wiebe

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.