[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f17f5330-9b8f-81a2-508f-8cc25c355590@linuxfoundation.org>
Date: Thu, 13 Jul 2023 13:33:48 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: John Stultz <jstultz@...gle.com>, Minjie Du <duminjie@...o.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>, Shuah Khan <shuah@...nel.org>,
"open list:TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER"
<linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>, opensource.kernel@...o.com,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH v1] tools: timers: fix freq average calculation
On 7/5/23 21:46, John Stultz wrote:
> On Wed, Jul 5, 2023 at 8:23 PM Minjie Du <duminjie@...o.com> wrote:
>>
>> Delete a duplicate assignment from this function implementation.
>> The note means ppm is average of the two actual freq samples.
>> But ppm have a duplicate assignment.
>>
>> Signed-off-by: Minjie Du <duminjie@...o.com>
>> ---
>> tools/testing/selftests/timers/raw_skew.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c
>> index 5beceeed0..6eba203f9 100644
>> --- a/tools/testing/selftests/timers/raw_skew.c
>> +++ b/tools/testing/selftests/timers/raw_skew.c
>> @@ -129,8 +129,7 @@ int main(int argc, char **argv)
>> printf("%lld.%i(est)", eppm/1000, abs((int)(eppm%1000)));
>>
>> /* Avg the two actual freq samples adjtimex gave us */
>> - ppm = (tx1.freq + tx2.freq) * 1000 / 2;
>> - ppm = (long long)tx1.freq * 1000;
>> + ppm = (long long)(tx1.freq + tx2.freq) * 1000 / 2;
>
> Huh. So yeah, I looked back in my own history and this has been there
> forever. I'm guessing I was intending to average the two samples and
> then due to reasons I can't remember decided to just use the first in
> the short-term for some debugging (with the second assignment) and
> committed both.
>
> I think it should be safe, because if the freq values are not the same
> the test will return SKIP, so it's unlikely changing this would cause
> new test failures.
>
> Acked-by: John Stultz <jstultz@...gle.com>
>
> Thanks for noticing this and sending this out!
> -john
Applied to linux-kselftest fixes branch for next rc2 or rc3
thanks,
-- Shuah
Powered by blists - more mailing lists