Thread (6 messages) 6 messages, 3 authors, 2012-01-26

Re: timerfd functions hang on both x86 and ARM with RT patch and RT scheduling policies

From: Sankara Muthukrishnan <hidden>
Date: 2012-01-26 00:22:57

I tested it on ARM Cortex-A9 dual core with different priorities and
with and without CPU affinities and it works like a charm. Thanks a
bunch, Thomas and Mike.
I wonder why my test worked for priority 1 alone before (without this
fix) and I did not see any other threads using RT scheduler in the
system with priority 1 or 2.

On Wed, Jan 25, 2012 at 4:11 AM, Thomas Gleixner [off-list ref] wrote:
quoted hunk ↗ jump to hunk
On Wed, 25 Jan 2012, Mike Galbraith wrote:
quoted
On Tue, 2012-01-24 at 10:04 -0600, Sankara Muthukrishnan wrote:
              spin_unlock_irq(&ctx->wqh.lock);
+#ifndef CONFIG_PREEMPT_RT_BASE
Bah.
quoted
              cpu_relax();
+#else
+             /*
+              * Current may be an RT task with priority high enough
+              * to prevent the thread currently _wanting_ to execute
+              * the timer callback function from receiving the CPU.
+              */
+             usleep_range(1, 10);
Even more bah.
quoted
+#endif
      }
Index: linux-3.2/fs/timerfd.c
===================================================================
--- linux-3.2.orig/fs/timerfd.c
+++ linux-3.2/fs/timerfd.c
@@ -313,7 +313,7 @@ SYSCALL_DEFINE4(timerfd_settime, int, uf
               if (hrtimer_try_to_cancel(&ctx->tmr) >= 0)
                       break;
               spin_unlock_irq(&ctx->wqh.lock);
-               cpu_relax();
+               hrtimer_wait_for_timer(&ctx->tmr);
       }

       /*
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help