[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABk29NsNvAs_GFpUEObMWHUw75jp5aBoK3RkPaUL_tDxwxDR=w@mail.gmail.com>
Date: Mon, 23 May 2022 14:20:29 -0700
From: Josh Don <joshdon@...gle.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: kbuild@...ts.01.org, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Tejun Heo <tj@...nel.org>, 0day robot <lkp@...el.com>,
kbuild-all@...ts.01.org,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Cruz Zhao <CruzZhao@...ux.alibaba.com>
Subject: Re: [PATCH v2] sched/core: add forced idle accounting for cgroups
On Mon, May 23, 2022 at 4:28 AM Dan Carpenter <dan.carpenter@...cle.com> wrote:
>
> Hi Josh,
>
> url: https://github.com/intel-lab-lkp/linux/commits/Josh-Don/sched-core-add-forced-idle-accounting-for-cgroups/20220521-075311
> base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
> config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220521/202205211525.XlF6P8dM-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
>
> smatch warnings:
> kernel/cgroup/rstat.c:489 cgroup_base_stat_cputime_show() error: uninitialized symbol 'forceidle_time'.
>
> vim +/forceidle_time +489 kernel/cgroup/rstat.c
>
> d4ff749b5e0f1e kernel/cgroup/rstat.c Tejun Heo 2018-04-26 460 void cgroup_base_stat_cputime_show(struct seq_file *seq)
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 461 {
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 462 struct cgroup *cgrp = seq_css(seq)->cgroup;
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 463 u64 usage, utime, stime;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 464 struct cgroup_base_stat bstat;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 465 u64 __maybe_unused forceidle_time;
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 466
> 936f2a70f2077f kernel/cgroup/rstat.c Boris Burkov 2020-05-27 467 if (cgroup_parent(cgrp)) {
> 6162cef0f741c7 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 468 cgroup_rstat_flush_hold(cgrp);
> d4ff749b5e0f1e kernel/cgroup/rstat.c Tejun Heo 2018-04-26 469 usage = cgrp->bstat.cputime.sum_exec_runtime;
> 936f2a70f2077f kernel/cgroup/rstat.c Boris Burkov 2020-05-27 470 cputime_adjust(&cgrp->bstat.cputime, &cgrp->prev_cputime,
> 936f2a70f2077f kernel/cgroup/rstat.c Boris Burkov 2020-05-27 471 &utime, &stime);
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 472 #ifdef CONFIG_SCHED_CORE
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 473 forceidle_time = cgrp->bstat.forceidle_sum;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 474 #endif
> 6162cef0f741c7 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 475 cgroup_rstat_flush_release();
> 936f2a70f2077f kernel/cgroup/rstat.c Boris Burkov 2020-05-27 476 } else {
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 477 root_cgroup_cputime(&bstat);
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 478 usage = bstat.cputime.sum_exec_runtime;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 479 utime = bstat.cputime.utime;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 480 stime = bstat.cputime.stime;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 481 #ifdef CONFIG_SCHED_CORE
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 482 forceidle_time = bstat.forceidle_sum;
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 483 #endif
> 936f2a70f2077f kernel/cgroup/rstat.c Boris Burkov 2020-05-27 484 }
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 485
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 486 do_div(usage, NSEC_PER_USEC);
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 487 do_div(utime, NSEC_PER_USEC);
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 488 do_div(stime, NSEC_PER_USEC);
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 @489 do_div(forceidle_time, NSEC_PER_USEC);
>
> I think this will cause MEMSan warnings at run time.
Whoops, I missed wrapping this usage with an #ifdef CONFIG_SCHED_CORE.
> 041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 490
> d41bf8c9deaed1 kernel/cgroup/stat.c Tejun Heo 2017-10-23 491 seq_printf(seq, "usage_usec %llu\n"
> d41bf8c9deaed1 kernel/cgroup/stat.c Tejun Heo 2017-10-23 492 "user_usec %llu\n"
> d41bf8c9deaed1 kernel/cgroup/stat.c Tejun Heo 2017-10-23 493 "system_usec %llu\n",
> d41bf8c9deaed1 kernel/cgroup/stat.c Tejun Heo 2017-10-23 494 usage, utime, stime);
> 0575a42c9f10cd kernel/cgroup/rstat.c Josh Don 2022-05-20 495
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
>
Powered by blists - more mailing lists