2015-02-16 13:11:38

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 27/35] sched/idle: Use explicit broadcast oneshot control function

From: Thomas Gleixner <[email protected]>

Replace the clockevents_notify() call with an explicit function call.

Signed-off-by: Thomas Gleixner <[email protected]>
---
kernel/sched/idle.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux/kernel/sched/idle.c
===================================================================
--- linux.orig/kernel/sched/idle.c
+++ linux/kernel/sched/idle.c
@@ -143,8 +143,7 @@ use_default:
* is used from another cpu as a broadcast timer, this call may
* fail if it is not available
*/
- if (broadcast &&
- clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu))
+ if (broadcast && tick_broadcast_enter())
goto use_default;

/* Take note of the planned idle state. */
@@ -161,7 +160,7 @@ use_default:
idle_set_state(this_rq(), NULL);

if (broadcast)
- clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+ tick_broadcast_exit();

/*
* Give the governor an opportunity to reflect on the outcome


2015-02-21 01:11:28

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCH 27/35] sched/idle: Use explicit broadcast oneshot control function

On Mon, 16 Feb 2015, Peter Zijlstra wrote:

> From: Thomas Gleixner <[email protected]>
>
> Replace the clockevents_notify() call with an explicit function call.
>
> Signed-off-by: Thomas Gleixner <[email protected]>

This patch makes my test system hang solid after letting it sit idle for
5 to 15 minutes. Reverting it and this issue goes away.

The explicit function call is not an equivalent replacement. In
clockevents_notify() the clockevents_lock is held across the call to
tick_broadcast_enter() or tick_broadcast_exit(). This patch drops the
locking.

> ---
> kernel/sched/idle.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> Index: linux/kernel/sched/idle.c
> ===================================================================
> --- linux.orig/kernel/sched/idle.c
> +++ linux/kernel/sched/idle.c
> @@ -143,8 +143,7 @@ use_default:
> * is used from another cpu as a broadcast timer, this call may
> * fail if it is not available
> */
> - if (broadcast &&
> - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu))
> + if (broadcast && tick_broadcast_enter())
> goto use_default;
>
> /* Take note of the planned idle state. */
> @@ -161,7 +160,7 @@ use_default:
> idle_set_state(this_rq(), NULL);
>
> if (broadcast)
> - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
> + tick_broadcast_exit();
>
> /*
> * Give the governor an opportunity to reflect on the outcome
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>

2015-02-21 11:19:13

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 27/35] sched/idle: Use explicit broadcast oneshot control function

On Fri, Feb 20, 2015 at 07:56:17PM -0500, Nicolas Pitre wrote:
> On Mon, 16 Feb 2015, Peter Zijlstra wrote:
>
> > From: Thomas Gleixner <[email protected]>
> >
> > Replace the clockevents_notify() call with an explicit function call.
> >
> > Signed-off-by: Thomas Gleixner <[email protected]>
>
> This patch makes my test system hang solid after letting it sit idle for
> 5 to 15 minutes. Reverting it and this issue goes away.
>
> The explicit function call is not an equivalent replacement. In
> clockevents_notify() the clockevents_lock is held across the call to
> tick_broadcast_enter() or tick_broadcast_exit(). This patch drops the
> locking.

Yeah, the Changelog introducing the explicit call states as much. I'll
have to go figure out why that matters here.