LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linaro Kernel Mailman List <linaro-kernel@lists.linaro.org>,
	Linux Kernel Mailing List <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 2/3] clockevents: Restart clockevent device before using it again
Date: Thu, 2 Apr 2015 19:20:50 +0530	[thread overview]
Message-ID: <CAKohpok=HEL4H22-OggBqokgdJvMcK2kBeccpfFk9+aacRX2Mw@mail.gmail.com> (raw)
In-Reply-To: <20150402133403.GY23123@twins.programming.kicks-ass.net>

On 2 April 2015 at 19:04, Peter Zijlstra <peterz@infradead.org> wrote:
> On Fri, Mar 27, 2015 at 10:44:28PM +0530, Viresh Kumar wrote:

>> +++ b/kernel/time/hrtimer.c
>> @@ -566,6 +566,7 @@ static int hrtimer_reprogram(struct hrtimer *timer,
>>  {

>> +     /* Switchback to ONESHOT state */
>> +     if (unlikely(dev->state == CLOCK_EVT_STATE_ONESHOT_STOPPED))
>> +             clockevents_set_state(dev, CLOCK_EVT_STATE_ONESHOT);
>> +
>>       /*
>>        * Clockevents returns -ETIME, when the event was in the past.
>>        */
>
> Should we not do this in tick_program_event() instead? Note that there
> are a few more places that call that, the two in the hrtimer_interrupt()
> should be safe because if we're handling the interrupt its cannot be
> stopped anyhow.
>
> hrtimer_force_reprogram() seems to need the annotation regardless.

Do you mean that we need the same modification here as well? In order
to save myself against any bugs, I have added following to
clockevents_program_event():

+       /* We must be in ONESHOT state here */
+       WARN_ONCE(dev->state != CLOCK_EVT_STATE_ONESHOT, "Current state: %d\n",
+                 dev->state);

And I never faced this WARN, or any such reports from Fengguang. So
probably after all the hrtimers are gone, we will always call
hrtimer_reprogram().

> Furthermore, by putting it in tick_program_event() you also don't need
> to fixup tick_nohz_restart().
>
> Or am I completely missing something?

So yes, if we would have done that in tick_program_event(), it would have
been a single place for doing this change..

But, when Thomas ranted [1] at me on this earlier, he said:

"
No, we are not doing a state change behind the scene and a magic
restore.

2B) Implement the ONESHOT_STOPPED logic and make sure all of the core
    code is aware of it.
"

And so I did it explicitly, wherever it is required.

--
viresh

[1] https://lkml.org/lkml/2014/5/9/508

  reply	other threads:[~2015-04-02 13:50 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 [this message]
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
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='CAKohpok=HEL4H22-OggBqokgdJvMcK2kBeccpfFk9+aacRX2Mw@mail.gmail.com' \
    --to=viresh.kumar@linaro.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=peterz@infradead.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH 2/3] clockevents: Restart clockevent device before using it again' \
    /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).