From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: tglx@linutronix.de, linaro-kernel@lists.linaro.org,
linux-kernel@vger.kernel.org, fweisbec@gmail.com,
linaro-networking@linaro.org
Subject: Re: [PATCH 12/14] hrtimer: don't emulate notifier call to initialize timer base
Date: Wed, 26 Mar 2014 18:10:07 +0530 [thread overview]
Message-ID: <5332CAA7.8000901@linux.vnet.ibm.com> (raw)
In-Reply-To: <7eb4d1a03031b4d873ce08e8912900d7936a3ca8.1395832156.git.viresh.kumar@linaro.org>
On 03/26/2014 04:51 PM, Viresh Kumar wrote:
> In hrtimers_init() we need to call init_hrtimers_cpu() for boot CPU. For this,
> currently we are emulating a call to hotplug notifier. Probably this was done
> initially to get rid of code redundancy. But this sequence always called a
> single routine, i.e. init_hrtimers_cpu(), and so calling that routine directly
> would be better. This would get rid of emulating a notifier call, few typecasts
> and the extra steps we are doing in notifier callback.
>
> So, this patch calls init_hrtimers_cpu() directly from hrtimers_init().
>
I don't think this is such a good idea. Open-coding a part of that callback
in the init routine can lead to loop-holes down the road: what if someone
changes or adds something to the CPU_UP_PREPARE switch-case, and forgets to
do the same in the init-routine?
It is more comforting to know that there is just one single place where CPU
hotplug operations are handled (hrtimer_cpu_notify). That, in turn is good
for reliability because it makes it easier to write bug-free code.
Regards,
Srivatsa S. Bhat
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> kernel/hrtimer.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
> index f14d861..39dbdbd 100644
> --- a/kernel/hrtimer.c
> +++ b/kernel/hrtimer.c
> @@ -1756,8 +1756,7 @@ static struct notifier_block hrtimers_nb = {
>
> void __init hrtimers_init(void)
> {
> - hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE,
> - (void *)(long)smp_processor_id());
> + init_hrtimers_cpu(smp_processor_id());
> register_cpu_notifier(&hrtimers_nb);
> #ifdef CONFIG_HIGH_RES_TIMERS
> open_softirq(HRTIMER_SOFTIRQ, run_hrtimer_softirq);
>
next prev parent reply other threads:[~2014-03-26 12:40 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-26 11:21 [PATCH 00/14] timers/hrtimers: Minor cleanups Viresh Kumar
2014-03-26 11:21 ` [PATCH 01/14] hrtimer: replace 'tab' with 'space' after 'comma' Viresh Kumar
2014-03-26 11:21 ` [PATCH 02/14] hrtimer: Coalesce format fragments in printk() Viresh Kumar
2014-03-26 11:21 ` [PATCH 03/14] hrtimer: call hrtimer_set_expires_range() from hrtimer_set_expires_range_ns() Viresh Kumar
2014-03-26 11:21 ` [PATCH 04/14] hrtimer: use base->index instead of basenum in switch_hrtimer_base() Viresh Kumar
2014-03-26 11:43 ` Srivatsa S. Bhat
2014-03-26 14:08 ` [LNG] " Viresh Kumar
2014-03-26 17:31 ` Thomas Gleixner
2014-03-26 17:57 ` Srivatsa S. Bhat
2014-03-26 11:21 ` [PATCH 05/14] hrtimer: no need to rewrite '1' to hrtimer_hres_enabled Viresh Kumar
2014-03-26 11:21 ` [PATCH 06/14] hrtimer: don't rewrite same value to expires_next in hrtimer_force_reprogram() Viresh Kumar
2014-03-26 11:21 ` [PATCH 07/14] hrtimer: use base->hres_active directly instead of hrtimer_hres_active() Viresh Kumar
2014-03-26 11:21 ` [PATCH 08/14] hrtimer: remove dummy definition of hrtimer_force_reprogram() Viresh Kumar
2014-03-26 11:21 ` [PATCH 09/14] hrtimer: don't check state of base->hres_active in hrtimer_switch_to_hres() Viresh Kumar
2014-03-26 11:21 ` [PATCH 10/14] hrtimer: remove clock_was_set_delayed() from hrtimer.h Viresh Kumar
2014-03-26 11:21 ` [PATCH 11/14] hrtimer: remove active_bases field from struct hrtimer_cpu_base Viresh Kumar
2014-03-26 17:28 ` Thomas Gleixner
2014-03-27 4:30 ` Viresh Kumar
2014-03-26 11:21 ` [PATCH 12/14] hrtimer: don't emulate notifier call to initialize timer base Viresh Kumar
2014-03-26 12:40 ` Srivatsa S. Bhat [this message]
2014-03-26 14:17 ` [LNG] " Viresh Kumar
2014-03-26 11:21 ` [PATCH 13/14] timer: simplify CPU_UP_PREPARE notifier code path Viresh Kumar
2014-03-26 12:47 ` Srivatsa S. Bhat
2014-03-26 11:21 ` [PATCH 14/14] timer: don't emulate notifier call to initialize timer base Viresh Kumar
2014-03-26 12:43 ` Srivatsa S. Bhat
2014-03-27 5:23 ` [PATCH 1/2] hrtimer: don't add clock-base to active_bases if already present Viresh Kumar
2014-03-27 5:23 ` [PATCH V2 2/2] hrtimer: use __ffs() to iterate over valid bits from active_bases Viresh Kumar
2014-03-27 5:40 ` Thomas Gleixner
2014-03-27 5:46 ` Viresh Kumar
2014-03-27 5:49 ` [PATCH V3] " Viresh Kumar
2014-03-27 5:54 ` [PATCH V3 Resend] hrtimer: use ffs() " Viresh Kumar
2014-03-27 5:39 ` [PATCH 1/2] hrtimer: don't add clock-base to active_bases if already present Thomas Gleixner
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=5332CAA7.8000901@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linaro-networking@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).