[Skiboot] [PATCH] opal/hmi: Fix the soft lockup issue on HMI for certain TB errors.

Benjamin Herrenschmidt benh at au1.ibm.com
Tue Oct 6 07:34:12 AEDT 2015


On Mon, 2015-10-05 at 15:40 +0530, Mahesh J Salgaonkar wrote:
> From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
> 
> Introduce volatile specifier in wait_for_subcore_threads() to force
> re-read the fresh value from the memory. Without this, the compiler
> optimizes the while loop not to re-fetch the data from memory pointed
> by
> this_cpu()->core_hmi_state_ptr. This cause CPU to spin infinitely
> even though the other CPUs have modified the data causing soft lockup
> in
> kernel.

That should have a timeout, what if the other threads are stuck for
some other reason ?

Also, I would much prefer if cpu_relax() had a memory clobber.

Cheers,
Ben.

> Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
> ---
>  core/hmi.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/core/hmi.c b/core/hmi.c
> index ee556fc..2d1ac6f 100644
> --- a/core/hmi.c
> +++ b/core/hmi.c
> @@ -448,7 +448,9 @@ static int decode_malfunction(struct OpalHMIEvent
> *hmi_evt)
>  
>  static void wait_for_subcore_threads(void)
>  {
> -	while (!(*(this_cpu()->core_hmi_state_ptr) &
> HMI_STATE_CLEANUP_DONE))
> +	volatile uint32_t *core_hmi_state_ptr = this_cpu()
> ->core_hmi_state_ptr;
> +
> +	while (!(*(core_hmi_state_ptr) & HMI_STATE_CLEANUP_DONE))
>  		cpu_relax();
>  }
>  
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot



More information about the Skiboot mailing list