mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Sodagudi Prasad <psodagud@codeaurora.org>
Cc: viresh.kumar@linaro.org, fweisbec@gmail.com, mingo@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: clock event device’s next_event
Date: Tue, 24 Oct 2017 09:23:08 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710240917020.2369@nanos> (raw)
In-Reply-To: <7c5ccef0fe45286324f5bf80eb3635c3@codeaurora.org>

[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]

On Mon, 23 Oct 2017, Sodagudi Prasad wrote:

> Hi Viresh and Thomas,
> 
> In the functions tick_nohz_stop_sched_tick(), when expires = KTIME_MAX we are
> canceling the tick_sched_timer timer but we are not updating the clock event
> device’s next_event to KTIME_MAX.
> Due to that broadcast device’s next_event is not programmed properly and
> resulting unnecessary wakeups for this cpu.
> 
>         /*
>          * If the expiration time == KTIME_MAX, then we simply stop
>          * the tick timer.
>          */
>         if (unlikely(expires == KTIME_MAX)) {
>                 if (ts->nohz_mode == NOHZ_MODE_HIGHRES)
>                         hrtimer_cancel(&ts->sched_timer);
>                 goto out;
>         }

Right, because this code does not have access to the broadcast device at
all. It doesn't even know and care about it.

> After digging further, I see that following call flow is updating
> tick_cpu_device state to shutdown state but clock event device  next_event is
> not updated to KTIME_MAX.
> hrtimer_cancel -> __remove_hrtimer -> hrtimer_force_reprogram ->
> tick_program_event.
> 
> int tick_program_event(ktime_t expires, int force)
> {
>         struct clock_event_device *dev =
> __this_cpu_read(tick_cpu_device.evtdev);
> 
>         if (unlikely(expires == KTIME_MAX)) {
>                 /*
>                  * We don't need the clock event device any more, stop it.
>                  */
>                 clockevents_switch_state(dev,
> CLOCK_EVT_STATE_ONESHOT_STOPPED);
>                 return 0;
>         }
> In the above tick_program_event() function clock event device’s next_event is
> not getting updated as clockevents_program_event() function not called after
> state update.

If the device is shutdown, then next_event does not matter. But yes, for
consistency reasons we could set it to KTIME_MAX.

Thanks,

	tglx

  reply	other threads:[~2017-10-24  7:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  4:33 Sodagudi Prasad
2017-10-24  7:23 ` Thomas Gleixner [this message]
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:timers/core] clockevents: Update clockevents device next_event on stop tip-bot for Prasad Sodagudi

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=alpine.DEB.2.20.1710240917020.2369@nanos \
    --to=tglx@linutronix.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=psodagud@codeaurora.org \
    --cc=viresh.kumar@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®