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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YvoAk1pnU4gZcFJ1@worktop.programming.kicks-ass.net>
Date:   Mon, 15 Aug 2022 10:15:15 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Li Hua <hucool.lihua@...wei.com>
Cc:     mingo@...hat.com, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com, vschneid@...hat.com,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH -next] sched/cputime: Fix the bug of reading time
 backward from /proc/stat

On Sat, Aug 13, 2022 at 08:01:02AM +0800, Li Hua wrote:
> The problem that the statistical time goes backward, the value read first is 319, and the value read again is 318. As follows:
> first:
> cat /proc/stat |  grep cpu1
> cpu1    319    0    496    41665    0    0    0    0    0    0
> then:
> cat /proc/stat |  grep cpu1
> cpu1    318    0    497    41674    0    0    0    0    0    0
> 
> Time goes back, which is counterintuitive.
> 
> After debug this, The problem is caused by the implementation of kcpustat_cpu_fetch_vtime. As follows:
> 
>                               CPU0                                                                          CPU1
> First:
> show_stat():
>     ->kcpustat_cpu_fetch()
>         ->kcpustat_cpu_fetch_vtime()
>             ->cpustat[CPUTIME_USER] = kcpustat_cpu(cpu) + vtime->utime + delta;              rq->curr is in user mod
>              ---> When CPU1 rq->curr running on userspace, need add utime and delta
>                                                                                              --->  rq->curr->vtime->utime is less than 1 tick
> Then:
> show_stat():
>     ->kcpustat_cpu_fetch()
>         ->kcpustat_cpu_fetch_vtime()
>             ->cpustat[CPUTIME_USER] = kcpustat_cpu(cpu);                                     rq->curr is in kernel mod
>             ---> When CPU1 rq->curr running on kernel space, just got kcpustat

This is unreadable, what?!?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ