Bug 185609

Summary: kernel returned wrong value in /proc/stat when value is greater than 2^32
Product: Red Hat Enterprise Linux 3 Reporter: Petr Sretr <sretr>
Component: kernelAssignee: Brian Maly <bmaly>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: petrides
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-04-27 19:32:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Sretr 2006-03-16 08:17:46 UTC
kernel returned wrong value in /proc/stat
when value is greater than 2^32

there is /proc/stat from my server ( HP rx4640 )

cat /proc/stat
cpu  2341684997 60902 286835084   67683455 21342783 9442787 53367290
cpu0 1133888982 25744 143027669 2238305424 10544857 0       11899664
cpu1 1207796015 35158 143807415 2124345327 10797926 9442787 41467626


as you can see in Idle CPU column is wrong value there is number
67683455 but should be 2238305424+2124345327=4362650751

How reproducible:

cat /proc/stat on server which run enough time 

Steps to Reproduce:
1. cat /proc/stat
2.
3.
  
Actual results:

cat /proc/stat
cpu  2341684997 60902 286835084   67683455 21342783 9442787 53367290
cpu0 1133888982 25744 143027669 2238305424 10544857 0       11899664
cpu1 1207796015 35158 143807415 2124345327 10797926 9442787 41467626


Expected results:

cat /proc/stat
cpu  2341684997 60902 286835084 4362650751 21342783 9442787 53367290
cpu0 1133888982 25744 143027669 2238305424 10544857 0       11899664
cpu1 1207796015 35158 143807415 2124345327 10797926 9442787 41467626


Additional info:

Comment 1 Ernie Petrides 2006-03-16 21:03:47 UTC
The problem is in kstat_read_proc() - the associated statistics totals
are kept in "unsigned int" variables.  This has been addressed in RHEL4
by making the values u64's in show_stat().  Obviously, the printk()
formats would need to be changed as well.  Note that the per-cpu values
should use %lu, because kernel_timeval_to_clock_t() returns an "unsigned
long".