LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
	Kevin Hilman <khilman@linaro.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH 3/3] clockevents: Switch state to ONESHOT_STOPPED for unused clockevent devices
Date: Thu, 2 Apr 2015 15:37:15 +0200	[thread overview]
Message-ID: <20150402133715.GZ23123@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <98b55223ab29cd5fb9b1f4a384cb7edd86578ea5.1427475606.git.viresh.kumar@linaro.org>

On Fri, Mar 27, 2015 at 10:44:29PM +0530, Viresh Kumar wrote:
>  kernel/time/hrtimer.c    | 46 ++++++++++++++++++++++++++++++++++++++++++----
>  kernel/time/tick-sched.c |  3 +++
>  2 files changed, 45 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
> index 045ba7e2be6c..89d4b593dfc0 100644
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -543,8 +543,19 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal)
>  	if (cpu_base->hang_detected)
>  		return;
>  
> -	if (cpu_base->expires_next.tv64 != KTIME_MAX)
> +	if (cpu_base->expires_next.tv64 != KTIME_MAX) {
>  		tick_program_event(cpu_base->expires_next, 1);
> +	} else {
> +		struct clock_event_device *dev =
> +			__this_cpu_read(tick_cpu_device.evtdev);

> +		clockevents_set_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
> +	}
>  }
>  
>  /*
> @@ -1312,9 +1323,36 @@ void hrtimer_interrupt(struct clock_event_device *dev)
>  	cpu_base->in_hrtirq = 0;
>  	raw_spin_unlock(&cpu_base->lock);
>  
> -	/* Reprogramming necessary ? */
> -	if (expires_next.tv64 == KTIME_MAX ||
> -	    !tick_program_event(expires_next, 0)) {
> +	if (expires_next.tv64 == KTIME_MAX) {
> +		struct clock_event_device *dev =
> +			__this_cpu_read(tick_cpu_device.evtdev);
> +
> +		cpu_base->hang_detected = 0;
> +
> +		clockevents_set_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
> +		return;
> +	}
> +
> +	if (!tick_program_event(expires_next, 0)) {
>  		cpu_base->hang_detected = 0;
>  		return;
>  	}
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 47c04edd07df..ff271a26fa4d 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -685,6 +685,9 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
>  		 if (unlikely(expires.tv64 == KTIME_MAX)) {
>  			if (ts->nohz_mode == NOHZ_MODE_HIGHRES)
>  				hrtimer_cancel(&ts->sched_timer);
> +			else
> +				clockevents_set_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
>  			goto out;
>  		}

Should we teach tick_program_event() about KTIME_MAX instead of adding
it to its callers?


  parent reply	other threads:[~2015-04-02 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 17:14 [PATCH 0/3] clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED Viresh Kumar
2015-03-27 17:14 ` [PATCH 1/3] clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state Viresh Kumar
2015-03-30  5:49   ` Preeti U Murthy
2015-04-06 21:26   ` Kevin Hilman
2015-03-27 17:14 ` [PATCH 2/3] clockevents: Restart clockevent device before using it again Viresh Kumar
2015-03-30  5:52   ` Preeti U Murthy
2015-04-02 13:34   ` Peter Zijlstra
2015-04-02 13:50     ` Viresh Kumar
2015-04-02 15:06       ` Peter Zijlstra
2015-04-02 16:04         ` Ingo Molnar
2015-03-27 17:14 ` [PATCH 3/3] clockevents: Switch state to ONESHOT_STOPPED for unused clockevent devices Viresh Kumar
2015-03-30  5:50   ` Preeti U Murthy
2015-04-02 13:37   ` Peter Zijlstra [this message]
2015-04-02 13:51     ` Viresh Kumar

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=20150402133715.GZ23123@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=fweisbec@gmail.com \
    --cc=khilman@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.org \
    --subject='Re: [PATCH 3/3] clockevents: Switch state to ONESHOT_STOPPED for unused clockevent devices' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).