All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Prasad Sodagudi <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com,
	mingo@kernel.org, psodagud@codeaurora.org
Subject: [tip:timers/core] clockevents: Update clockevents device next_event on stop
Date: Wed, 1 Nov 2017 10:25:07 -0700	[thread overview]
Message-ID: <tip-39c82caff8610d57ffe32157cb3130dfabe12fbe@git.kernel.org> (raw)
In-Reply-To: <1509043042-32486-1-git-send-email-psodagud@codeaurora.org>

Commit-ID:  39c82caff8610d57ffe32157cb3130dfabe12fbe
Gitweb:     https://git.kernel.org/tip/39c82caff8610d57ffe32157cb3130dfabe12fbe
Author:     Prasad Sodagudi <psodagud@codeaurora.org>
AuthorDate: Thu, 26 Oct 2017 11:37:22 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 1 Nov 2017 18:20:17 +0100

clockevents: Update clockevents device next_event on stop

clockevent_device::next_event holds the next timer event of a clock event
device. The value is updated in clockevents_program_event(), i.e. when the
hardware timer is armed for the next expiry.

When there are no software timers armed on a CPU, the corresponding per CPU
clockevent device is brought into ONESHOT_STOPPED state, but
clockevent_device::next_event is not updated, because
clockevents_program_event() is not called.

So the content of clockevent_device::next_event is stale, which is not an
issue when real hardware is used. But the hrtimer broadcast device relies
on that information and the stale value causes spurious wakeups.

Update clockevent_device::next_event to KTIME_MAX when it has been brought
into ONESHOT_STOPPED state to avoid spurious wakeups. This reflects the
proper expiry time of the stopped timer: infinity.

[ tglx: Massaged changelog ]

Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: viresh.kumar@linaro.org
Link: https://lkml.kernel.org/r/1509043042-32486-1-git-send-email-psodagud@codeaurora.org

---
 kernel/time/tick-oneshot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c
index 6b009c2..c1f518e 100644
--- a/kernel/time/tick-oneshot.c
+++ b/kernel/time/tick-oneshot.c
@@ -33,6 +33,7 @@ int tick_program_event(ktime_t expires, int force)
 		 * We don't need the clock event device any more, stop it.
 		 */
 		clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
+		dev->next_event = KTIME_MAX;
 		return 0;
 	}
 

      reply	other threads:[~2017-11-01 17:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  4:33 clock event device’s next_event Sodagudi Prasad
2017-10-24  7:23 ` Thomas Gleixner
2017-10-24  7:56   ` Sodagudi Prasad
2017-10-24  8:06     ` [PATCH] Clockevents: Always call clockevents_program_event Prasad Sodagudi
2017-10-24  8:37       ` Thomas Gleixner
2017-10-24  9:21         ` Sodagudi Prasad
2017-10-24 10:13           ` Thomas Gleixner
2017-10-26 18:37             ` [PATCH] clockevents: Update clockevents device next_event Prasad Sodagudi
2017-11-01 17:25               ` tip-bot for Prasad Sodagudi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-39c82caff8610d57ffe32157cb3130dfabe12fbe@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=psodagud@codeaurora.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.