[Skiboot] [PATCH 1/2] OPAL: Detect recursive poller entry from same CPU

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Mar 12 07:18:34 AEDT 2015


On Wed, 2015-03-11 at 18:06 +0530, Vasant Hegde wrote:
> Detect recursive opal poller call from same CPU. if it happens
> then abort().

This is a bit brutal, just print a warning + backtrace and return, like
we do for the poll_with_locks
 
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> ---
>  core/opal.c   |   10 ++++++++++
>  include/cpu.h |    1 +
>  2 files changed, 11 insertions(+)
> 
> diff --git a/core/opal.c b/core/opal.c
> index 6fbbdde..fc0e7a5 100644
> --- a/core/opal.c
> +++ b/core/opal.c
> @@ -285,6 +285,13 @@ void opal_run_pollers(void)
>  	struct opal_poll_entry *poll_ent;
>  	static int pollers_with_lock_warnings = 0;
>  
> +	/* Don't re-enter on this CPU */
> +	if (this_cpu()->in_poller) {
> +		prlog(PR_ERR, "OPAL: Poller recursion detected.\n");
> +		abort();
> +	}
> +	this_cpu()->in_poller = true;
> +
>  	if (this_cpu()->lock_depth && pollers_with_lock_warnings < 64) {
>  		prlog(PR_ERR, "Running pollers with lock held !\n");
>  		backtrace();
> @@ -301,6 +308,9 @@ void opal_run_pollers(void)
>  	list_for_each(&opal_pollers, poll_ent, link)
>  		poll_ent->poller(poll_ent->data);
>  
> +	/* Disable poller flag */
> +	this_cpu()->in_poller = false;
> +
>  	/* On debug builds, print max stack usage */
>  	check_stacks();
>  }
> diff --git a/include/cpu.h b/include/cpu.h
> index 54e1b37..bb516f2 100644
> --- a/include/cpu.h
> +++ b/include/cpu.h
> @@ -58,6 +58,7 @@ struct cpu_thread {
>  	uint32_t			con_suspend;
>  	bool				con_need_flush;
>  	bool				in_mcount;
> +	bool				in_poller;
>  	uint32_t			hbrt_spec_wakeup; /* primary only */
>  	uint64_t			save_l2_fir_action1;
>  	uint64_t			current_token;




More information about the Skiboot mailing list