Guest User

linux-rt 3.14 rever changes that broke AMD Phenom from boot

a guest
Apr 13th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. From 35b6173e6176fc978c635f9e07f1778eff7b76e7 Mon Sep 17 00:00:00 2001
  2. From: Thomas Gleixner <[email protected]>
  3. Date: Thu, 7 Nov 2013 12:21:11 +0100
  4. Subject: [PATCH] timers: do not raise softirq unconditionally
  5.  
  6. Mike,
  7.  
  8. On Thu, 7 Nov 2013, Mike Galbraith wrote:
  9.  
  10. > On Thu, 2013-11-07 at 04:26 +0100, Mike Galbraith wrote:
  11. > > On Wed, 2013-11-06 at 18:49 +0100, Thomas Gleixner wrote:
  12. >
  13. > > > I bet you are trying to work around some of the side effects of the
  14. > > > occasional tick which is still necessary despite of full nohz, right?
  15. > >
  16. > > Nope, I wanted to check out cost of nohz_full for rt, and found that it
  17. > > doesn't work at all instead, looked, and found that the sole running
  18. > > task has just awakened ksoftirqd when it wants to shut the tick down, so
  19. > > that shutdown never happens.
  20. >
  21. > Like so in virgin 3.10-rt. Box is x3550 M3 booted nowatchdog
  22. > rcu_nocbs=1-3 nohz_full=1-3, and CPUs1-3 are completely isolated via
  23. > cpusets as well.
  24.  
  25. well, that very same problem is in mainline if you add "threadirqs" to
  26. the command line. But we can be smart about this. The untested patch
  27. below should address that issue. If that works on mainline we can
  28. adapt it for RT (needs a trylock(&base->lock) there).
  29.  
  30. Though it's not a full solution. It needs some thought versus the
  31. softirq code of timers. Assume we have only one timer queued 1000
  32. ticks into the future. So this change will cause the timer softirq not
  33. to be called until that timer expires and then the timer softirq is
  34. going to do 1000 loops until it catches up with jiffies. That's
  35. anything but pretty ...
  36.  
  37. What worries me more is this one:
  38.  
  39. pert-5229 [003] d..h1.. 684.482618: softirq_raise: vec=9 [action=RCU]
  40.  
  41. The CPU has no callbacks as you shoved them over to cpu 0, so why is
  42. the RCU softirq raised?
  43.  
  44. Thanks,
  45.  
  46. tglx
  47. ------------------
  48. Message-id: <[email protected]>
  49. |CONFIG_NO_HZ_FULL + CONFIG_PREEMPT_RT_FULL = nogo
  50. Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
  51. ---
  52. include/linux/hrtimer.h | 3 +--
  53. kernel/hrtimer.c | 31 +++++++------------------------
  54. kernel/timer.c | 28 +++++++++++++++++++++++++---
  55. 3 files changed, 33 insertions(+), 29 deletions(-)
  56.  
  57. --- a/include/linux/hrtimer.h
  58. +++ b/include/linux/hrtimer.h
  59. @@ -461,9 +461,8 @@ extern int schedule_hrtimeout_range_cloc
  60. unsigned long delta, const enum hrtimer_mode mode, int clock);
  61. extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
  62.  
  63. -/* Soft interrupt function to run the hrtimer queues: */
  64. +/* Called from the periodic timer tick */
  65. extern void hrtimer_run_queues(void);
  66. -extern void hrtimer_run_pending(void);
  67.  
  68. /* Bootup initialization: */
  69. extern void __init hrtimers_init(void);
  70. --- a/kernel/hrtimer.c
  71. +++ b/kernel/hrtimer.c
  72. @@ -1695,30 +1695,6 @@ static void run_hrtimer_softirq(struct s
  73. }
  74.  
  75. /*
  76. - * Called from timer softirq every jiffy, expire hrtimers:
  77. - *
  78. - * For HRT its the fall back code to run the softirq in the timer
  79. - * softirq context in case the hrtimer initialization failed or has
  80. - * not been done yet.
  81. - */
  82. -void hrtimer_run_pending(void)
  83. -{
  84. - if (hrtimer_hres_active())
  85. - return;
  86. -
  87. - /*
  88. - * This _is_ ugly: We have to check in the softirq context,
  89. - * whether we can switch to highres and / or nohz mode. The
  90. - * clocksource switch happens in the timer interrupt with
  91. - * xtime_lock held. Notification from there only sets the
  92. - * check bit in the tick_oneshot code, otherwise we might
  93. - * deadlock vs. xtime_lock.
  94. - */
  95. - if (tick_check_oneshot_change(!hrtimer_is_hres_enabled()))
  96. - hrtimer_switch_to_hres();
  97. -}
  98. -
  99. -/*
  100. * Called from hardirq context every jiffy
  101. */
  102. void hrtimer_run_queues(void)
  103. @@ -1731,6 +1707,13 @@ void hrtimer_run_queues(void)
  104. if (hrtimer_hres_active())
  105. return;
  106.  
  107. + /*
  108. + * Check whether we can switch to highres mode.
  109. + */
  110. + if (tick_check_oneshot_change(!hrtimer_is_hres_enabled())
  111. + && hrtimer_switch_to_hres())
  112. + return;
  113. +
  114. for (index = 0; index < HRTIMER_MAX_CLOCK_BASES; index++) {
  115. base = &cpu_base->clock_base[index];
  116. if (!timerqueue_getnext(&base->active))
  117. --- a/kernel/timer.c
  118. +++ b/kernel/timer.c
  119. @@ -1443,8 +1443,6 @@
  120. irq_work_run();
  121. #endif
  122.  
  123. - hrtimer_run_pending();
  124. -
  125. if (time_after_eq(jiffies, base->timer_jiffies))
  126. __run_timers(base);
  127. }
  128. @@ -1454,8 +1452,39 @@
  129. */
  130. void run_local_timers(void)
  131. {
  132. + struct tvec_base *base = __this_cpu_read(tvec_bases);
  133. +
  134. hrtimer_run_queues();
  135. - raise_softirq(TIMER_SOFTIRQ);
  136. + /*
  137. + * We can access this lockless as we are in the timer
  138. + * interrupt. If there are no timers queued, nothing to do in
  139. + * the timer softirq.
  140. + */
  141. +#ifdef CONFIG_PREEMPT_RT_FULL
  142. + /* On RT, irq work runs from softirq */
  143. + if (irq_work_needs_cpu()) {
  144. + raise_softirq(TIMER_SOFTIRQ);
  145. + return;
  146. + }
  147. +
  148. + if (!spin_do_trylock(&base->lock)) {
  149. + raise_softirq(TIMER_SOFTIRQ);
  150. + return;
  151. + }
  152. +#endif
  153. +
  154. + if (!base->active_timers)
  155. + goto out;
  156. +
  157. + /* Check whether the next pending timer has expired */
  158. + if (time_before_eq(base->next_timer, jiffies))
  159. + raise_softirq(TIMER_SOFTIRQ);
  160. +out:
  161. +#ifdef CONFIG_PREEMPT_RT_FULL
  162. + rt_spin_unlock_after_trylock_in_irq(&base->lock);
  163. +#endif
  164. + /* The ; ensures that gcc won't complain in the !RT case */
  165. + ;
  166. }
  167.  
  168. #ifdef __ARCH_WANT_SYS_ALARM
Advertisement
Add Comment
Please, Sign In to add comment