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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Mar 12 19:21:42 AEDT 2015


Detect recursive opal poller call from same CPU.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/opal.c   |   11 +++++++++++
 include/cpu.h |    1 +
 2 files changed, 12 insertions(+)

diff --git a/core/opal.c b/core/opal.c
index 6fbbdde..5e96e0a 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -285,6 +285,14 @@ 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");
+		backtrace();
+		return;
+	}
+	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 +309,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