Message ID | 20150312063127.7253.57615.stgit@localhost.localdomain |
---|---|
State | Superseded |
Headers | show |
On Thu, 2015-03-12 at 12:01 +0530, Vasant Hegde wrote: > Detect recursive opal poller call from same CPU. If it happens > then abort(). And fix your cset comment :-) > Signed-off-by: Vasant Hegde <hegdevasant@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;
On 03/12/2015 12:31 PM, Benjamin Herrenschmidt wrote: > On Thu, 2015-03-12 at 12:01 +0530, Vasant Hegde wrote: >> Detect recursive opal poller call from same CPU. If it happens >> then abort(). > > And fix your cset comment :-) Oops. will resend patchset with updated comment. Thanks! -Vasant
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;
Detect recursive opal poller call from same CPU. If it happens then abort(). Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> --- core/opal.c | 11 +++++++++++ include/cpu.h | 1 + 2 files changed, 12 insertions(+)