[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c22ff02d1af74ccca59e3a2927da8e67@baidu.com>
Date: Tue, 8 Jul 2025 01:17:50 +0000
From: "Li,Rongqing" <lirongqing@...du.com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: Oleg Nesterov <oleg@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
David Laight <david.laight.linux@...il.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "vschneid@...hat.com" <vschneid@...hat.com>,
"mgorman@...e.de" <mgorman@...e.de>, "bsegall@...gle.com"
<bsegall@...gle.com>, "dietmar.eggemann@....com" <dietmar.eggemann@....com>,
"vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
"juri.lelli@...hat.com" <juri.lelli@...hat.com>, "mingo@...hat.com"
<mingo@...hat.com>
Subject: 答复: [????] Re: [????] Re: [????] Re: divide error in x86 and cputime
> Have you tried it? Or are you just making an assumption?
>
> How can you be so sure? Did you even *look* at the commit?
>
> sched/cputime: Fix mul_u64_u64_div_u64() precision for cputime
>
> In extreme test scenarios:
> the 14th field utime in /proc/xx/stat is greater than sum_exec_runtime,
> utime = 18446744073709518790 ns, rtime = 135989749728000 ns
>
> In cputime_adjust() process, stime is greater than rtime due to
> mul_u64_u64_div_u64() precision problem.
> before call mul_u64_u64_div_u64(),
> stime = 175136586720000, rtime = 135989749728000, utime =
> 1416780000.
> after call mul_u64_u64_div_u64(),
> stime = 135989949653530
>
> unsigned reversion occurs because rtime is less than stime.
> utime = rtime - stime = 135989749728000 - 135989949653530
> = -199925530
> = (u64)18446744073709518790
>
I will try to tested this patch, But I think it is different case;
Stime is not greater than rtime in my case, (stime= 0x69f98da9ba980c00, rtime= 0xfffd213aabd74626, stime+utime= 0x9e00900. So utime should be 0x960672564f47fd00 ), and this overflow process with 236 busy poll threads running about 904 day, so I think these times are correct
Thanks
-Li
> Trigger condition:
> 1). User task run in kernel mode most of time
> 2). ARM64 architecture
> 3). TICK_CPU_ACCOUNTING=y
> CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set
>
> Fix mul_u64_u64_div_u64() conversion precision by reset stime to rtime
>
>
> When stime ends up greater than rtime, it causes utime to go NEGATIVE!
>
> That means *YES* it can overflow a u64 number. That's your bug.
>
> Next time, look to see if there's fixes in the code that is triggering issues for you
> and test them out, before bothering upstream.
>
> Goodbye.
>
> -- Steve
Powered by blists - more mailing lists