Re: [patch 1/2] tick/broadcast: Prevent deep idle states if no broadcast device available

From: Thomas Gleixner
Date: Mon Jul 06 2015 - 12:06:16 EST


On Mon, 6 Jul 2015, Sudeep Holla wrote:
> On 06/07/15 16:35, Thomas Gleixner wrote:
> > Well, we should figure out what happens while we are at it before
> > everything gets paged out again.
> >
>
> True. I just wanted to mention that this patch works for all the
> practical purposes.
>
> > In the case of CONFIG_NOHZ=n and CONFIG_HIGHRES=n the broadcast
> > hrtimer is not compiled as it depends on CONFIG_TICK_ONESHOT, so it
> > works via the bc.evtdev == NULL check.
> >
> > With either option enabled CONFIG_TICK_ONESHOT gets set, so the
> > broadcast timer gets installed but somehow does not work proper if
> > nohz and highres are disabled on the kernel command line.
> >
>
> Let me know if you want to test something to help debug this configuration.

Can you try the following delta patch?

Thanks,

tglx
---
Index: tip/kernel/time/tick-broadcast.c
===================================================================
--- tip.orig/kernel/time/tick-broadcast.c
+++ tip/kernel/time/tick-broadcast.c
@@ -360,14 +360,15 @@ void tick_broadcast_control(enum tick_br
cpumask_set_cpu(cpu, tick_broadcast_on);
if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_mask)) {
/*
- * Only shutdown the cpu local device, if the
- * broadcast device exists and is in periodic
- * mode. The latter check prevents a hickup
- * during the switch from periodic to oneshot
- * mode.
+ * Only shutdown the cpu local device, if:
+ *
+ * - the broadcast device exists
+ * - the broadcast device is not a hrtimer based one
+ * - the broadcast device is in periodic mode to
+ * avoid a hickup during switch to oneshot mode
*/
- if (bc != NULL && tick_broadcast_device.mode ==
- TICKDEV_MODE_PERIODIC)
+ if (bc && !(bc->features & CLOCK_EVT_FEAT_HRTIMER) &&
+ tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
clockevents_shutdown(dev);
}
break;
@@ -697,14 +698,18 @@ int __tick_broadcast_oneshot_control(enu
* shutdown.
*/
ret = broadcast_needs_cpu(bc, cpu);
+ if (ret)
+ goto out;

/*
- * If the hrtimer broadcast check tells us that the
- * cpu cannot go deep idle, or if the broadcast device
- * is in periodic mode, we just return.
+ * If the broadcast device is in periodic mode, we
+ * return.
*/
- if (ret || tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
- goto out;
+ if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
+ /* If it is a hrtimer based broadcast, return busy */
+ if (bc->features & CLOCK_EVT_FEAT_HRTIMER)
+ ret = -EBUSY;
+ }

if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) {
WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/