[Skiboot] [PATCH] Ensure we run pollers in cpu_wait_job()

Stewart Smith stewart at linux.vnet.ibm.com
Wed Oct 7 10:48:42 AEDT 2015

In root causing a bug on AST BMC Alistair found that pollers weren't
being run for around 3800ms.

This was due to a wonderful accident that's probably about a year or more
old where:

In cpu_wait_job we have:
        unsigned long ticks = usecs_to_tb(5);

While in time_wait(), deciding on if to run pollers:
        unsigned long period = msecs_to_tb(5);
	if (remaining >= period) {

Obviously, this means we never run pollers. Not ideal.

This patch ensures we run pollers every 5ms in cpu_wait_job() as well
as displaying how long we waited for a job if that wait was >1second.

Reported-by: Alistair Popple <alistair at popple.id.au>
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
 core/cpu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/core/cpu.c b/core/cpu.c
index 8b0f861..d905ebe 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -129,17 +129,26 @@ bool cpu_poll_job(struct cpu_job *job)
 void cpu_wait_job(struct cpu_job *job, bool free_it)
 	unsigned long ticks = usecs_to_tb(5);
+	unsigned long period = msecs_to_tb(5);
+	unsigned long time_waited = 0;
 	if (!job)
 	while(!job->complete) {
+		time_waited+=ticks;
+		if (time_waited % period == 0)
+			opal_run_pollers();
+	if (time_waited > msecs_to_tb(1000))
+		prlog(PR_DEBUG, "cpu_wait_job(%s) for %d\n",
+		      job->name, tb_to_msecs(time_waited));
 	if (free_it)

More information about the Skiboot mailing list