lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 2 Apr 2014 11:11:13 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Lists linaro-kernel <linaro-kernel@...ts.linaro.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Frédéric Weisbecker <fweisbec@...il.com>,
	Linaro Networking <linaro-networking@...aro.org>,
	Arvind Chauhan <Arvind.Chauhan@....com>,
	Viresh Kumar <viresh.kumar@...aro.org>
Subject: Re: [PATCH 02/16] hrtimer: reorder code in __remove_hrtimer()

On 28 March 2014 17:11, Viresh Kumar <viresh.kumar@...aro.org> wrote:

> diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c

> @@ -887,25 +887,22 @@ static void __remove_hrtimer(struct hrtimer *timer,
>                              struct hrtimer_clock_base *base,
>                              unsigned long newstate, int reprogram)
>  {
> -       struct timerqueue_node *next_timer;
>         if (!(timer->state & HRTIMER_STATE_ENQUEUED))
>                 goto out;
>
> -       next_timer = timerqueue_getnext(&base->active);
>         timerqueue_del(&base->active, &timer->node);
> -       if (&timer->node == next_timer) {
> +
>  #ifdef CONFIG_HIGH_RES_TIMERS
> -               /* Reprogram the clock event device. if enabled */
> -               if (reprogram && hrtimer_hres_active()) {
> -                       ktime_t expires;
> -
> -                       expires = ktime_sub(hrtimer_get_expires(timer),
> -                                           base->offset);
> -                       if (base->cpu_base->expires_next.tv64 == expires.tv64)
> -                               hrtimer_force_reprogram(base->cpu_base, 1);
> -               }
> -#endif
> +       /* Reprogram the clock event device. if enabled */
> +       if (reprogram && hrtimer_hres_active() &&
> +           &timer->node == timerqueue_getnext(&base->active)) {

Last comparison here would always fail as we have already removed the timer.
Here is a fixup for that, will include that in my V2:

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 516c67f..189c525 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -886,15 +886,16 @@ static void __remove_hrtimer(struct hrtimer *timer,
                             struct hrtimer_clock_base *base,
                             unsigned long newstate, int reprogram)
 {
+       struct timerqueue_node *next_timer;
        if (!(timer->state & HRTIMER_STATE_ENQUEUED))
                goto out;

+       next_timer = timerqueue_getnext(&base->active);
        timerqueue_del(&base->active, &timer->node);

 #ifdef CONFIG_HIGH_RES_TIMERS
        /* Reprogram the clock event device. if enabled */
-       if (reprogram && hrtimer_hres_active() &&
-           &timer->node == timerqueue_getnext(&base->active)) {
+       if (reprogram && hrtimer_hres_active() && &timer->node == next_timer) {
                ktime_t expires;

                expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists