Skip to content

Commit

Permalink
core/opal: Allow poller re-entry if OPAL was re-entered
Browse files Browse the repository at this point in the history
If an NMI interrupts the middle of running pollers and the OS
invokes pollers again (e.g., for console output), the poller
re-entrancy check will prevent it from running and spam the
console.

That check was designed to catch a poller calling opal_run_pollers,
OPAL re-entrancy is something different and is detected elsewhere.
Avoid the poller recursion check if OPAL has been re-entered. This
is a best-effort attempt to cope with errors.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
npiggin authored and stewartsmith committed Apr 19, 2018
1 parent 3fdd262 commit 87f5550
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,25 +546,29 @@ void opal_del_poller(void (*poller)(void *data))

void opal_run_pollers(void)
{
struct opal_poll_entry *poll_ent;
static int pollers_with_lock_warnings = 0;
static int poller_recursion = 0;
struct opal_poll_entry *poll_ent;
bool was_in_poller;

/* Don't re-enter on this CPU */
if (this_cpu()->in_poller && poller_recursion < 16) {
/* Don't re-enter on this CPU, unless it was an OPAL re-entry */
if (this_cpu()->in_opal_call == 1 &&
this_cpu()->in_poller && poller_recursion < 16) {
/**
* @fwts-label OPALPollerRecursion
* @fwts-advice Recursion detected in opal_run_pollers(). This
* indicates a bug in OPAL where a poller ended up running
* pollers, which doesn't lead anywhere good.
*/
disable_fast_reboot("Poller recursion detected.");
prlog(PR_ERR, "OPAL: Poller recursion detected.\n");
backtrace();
poller_recursion++;
if (poller_recursion == 16)
prlog(PR_ERR, "OPAL: Squashing future poller recursion warnings (>16).\n");
return;
}
was_in_poller = this_cpu()->in_poller;
this_cpu()->in_poller = true;

if (!list_empty(&this_cpu()->locks_held) && pollers_with_lock_warnings < 64) {
Expand Down Expand Up @@ -598,7 +602,7 @@ void opal_run_pollers(void)
poll_ent->poller(poll_ent->data);

/* Disable poller flag */
this_cpu()->in_poller = false;
this_cpu()->in_poller = was_in_poller;

/* On debug builds, print max stack usage */
check_stacks();
Expand Down

0 comments on commit 87f5550

Please sign in to comment.