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:   Mon, 18 Jun 2018 20:29:13 +0200
From:   Willy Tarreau <w@....eu>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Pavel Machek <pavel@....cz>,
        Jacek Anaszewski <jacek.anaszewski@...il.com>,
        y2038 Mailman List <y2038@...ts.linaro.org>,
        Kees Cook <keescook@...omium.org>, linux-leds@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] leds: ledtrig-activity: use ktime_get_boot_ns()

Hi Arnd,

On Mon, Jun 18, 2018 at 05:47:28PM +0200, Arnd Bergmann wrote:
> On Mon, Jun 18, 2018 at 5:07 PM, Pavel Machek <pavel@....cz> wrote:
> >> diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
> >> index 5081894082bd..589c1bc4d0b9 100644
> >> --- a/drivers/leds/trigger/ledtrig-activity.c
> >> +++ b/drivers/leds/trigger/ledtrig-activity.c
> >> @@ -37,7 +37,6 @@ static void led_activity_function(struct timer_list *t)
> >>       struct activity_data *activity_data = from_timer(activity_data, t,
> >>                                                        timer);
> >>       struct led_classdev *led_cdev = activity_data->led_cdev;
> >> -     struct timespec boot_time;
> >>       unsigned int target;
> >>       unsigned int usage;
> >>       int delay;
> >> @@ -57,7 +56,7 @@ static void led_activity_function(struct timer_list *t)
> >>               return;
> >>       }
> >>
> >> -     get_monotonic_boottime(&boot_time);
> >> +     curr_boot = ktime_get_boot_ns();
> >>
> >>       cpus = 0;
> >>       curr_used = 0;
> >> @@ -76,7 +75,6 @@ static void led_activity_function(struct timer_list *t)
> >>        * down to 16us, ensuring we won't overflow 32-bit computations below
> >>        * even up to 3k CPUs, while keeping divides cheap on smaller systems.
> >>        */
> >> -     curr_boot = timespec_to_ns(&boot_time) * cpus;
> >
> > Original code is pretty weird (notice the * cpus), so I'm
> > double-checking.
> 
> Ok, dropping the *cpus was not intentional, I'll repost a version that puts
> it that back. Thanks for pointing this out!

Pavel is right, the *cpus is intentional. curr_boot contains the cumulated
time for all CPUs in order to measure an average usage over all of them.
By keeping it scaled by #cpus we avoid useless divides.

Cheers,
Willy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ