# git rev-parse -q --verify 3840cbe24cf060ea05a585ca497814609f5d47d1^{commit} # git fetch -q -n -f git://fs.ozlabs.ibm.com/kernel/linus master warning: The last gc run reported the following. Please correct the root cause and remove .git/gc.log. Automatic cleanup will not be performed until the file is removed. warning: There are too many unreachable loose objects; run 'git prune' to remove them. # git rev-parse -q --verify 3840cbe24cf060ea05a585ca497814609f5d47d1^{commit} 3840cbe24cf060ea05a585ca497814609f5d47d1 # git checkout -q -f -B kisskb 3840cbe24cf060ea05a585ca497814609f5d47d1 # git clean -qxdf # < git log -1 # commit 3840cbe24cf060ea05a585ca497814609f5d47d1 # Author: Johannes Weiner # Date: Thu Oct 3 07:29:05 2024 -0400 # # sched: psi: fix bogus pressure spikes from aggregation race # # Brandon reports sporadic, non-sensical spikes in cumulative pressure # time (total=) when reading cpu.pressure at a high rate. This is due to # a race condition between reader aggregation and tasks changing states. # # While it affects all states and all resources captured by PSI, in # practice it most likely triggers with CPU pressure, since scheduling # events are so frequent compared to other resource events. # # The race context is the live snooping of ongoing stalls during a # pressure read. The read aggregates per-cpu records for stalls that # have concluded, but will also incorporate ad-hoc the duration of any # active state that hasn't been recorded yet. This is important to get # timely measurements of ongoing stalls. Those ad-hoc samples are # calculated on-the-fly up to the current time on that CPU; since the # stall hasn't concluded, it's expected that this is the minimum amount # of stall time that will enter the per-cpu records once it does. # # The problem is that the path that concludes the state uses a CPU clock # read that is not synchronized against aggregators; the clock is read # outside of the seqlock protection. This allows aggregators to race and # snoop a stall with a longer duration than will actually be recorded. # # With the recorded stall time being less than the last snapshot # remembered by the aggregator, a subsequent sample will underflow and # observe a bogus delta value, resulting in an erratic jump in pressure. # # Fix this by moving the clock read of the state change into the seqlock # protection. This ensures no aggregation can snoop live stalls past the # time that's recorded when the state concludes. # # Reported-by: Brandon Duffany # Link: https://bugzilla.kernel.org/show_bug.cgi?id=219194 # Link: https://lore.kernel.org/lkml/20240827121851.GB438928@cmpxchg.org/ # Fixes: df77430639c9 ("psi: Reduce calls to sched_clock() in psi") # Cc: stable@vger.kernel.org # Signed-off-by: Johannes Weiner # Reviewed-by: Chengming Zhou # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux-ld --version # < git log --format=%s --max-count=1 3840cbe24cf060ea05a585ca497814609f5d47d1 # make -s -j 160 ARCH=sparc64 O=/kisskb/build/linus_allnoconfig_sparc64-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux- allnoconfig # < make -s -j 160 ARCH=sparc64 O=/kisskb/build/linus_allnoconfig_sparc64-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux- help # make -s -j 160 ARCH=sparc64 O=/kisskb/build/linus_allnoconfig_sparc64-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux- olddefconfig # make -s -j 160 ARCH=sparc64 O=/kisskb/build/linus_allnoconfig_sparc64-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux- :1519:2: warning: #warning syscall clone3 not implemented [-Wcpp] /kisskb/src/arch/sparc/vdso/vclock_gettime.c:254:1: warning: no previous prototype for '__vdso_clock_gettime' [-Wmissing-prototypes] 254 | __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) | ^~~~~~~~~~~~~~~~~~~~ /kisskb/src/arch/sparc/vdso/vclock_gettime.c:282:1: warning: no previous prototype for '__vdso_clock_gettime_stick' [-Wmissing-prototypes] 282 | __vdso_clock_gettime_stick(clockid_t clock, struct __kernel_old_timespec *ts) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/arch/sparc/vdso/vclock_gettime.c:307:1: warning: no previous prototype for '__vdso_gettimeofday' [-Wmissing-prototypes] 307 | __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) | ^~~~~~~~~~~~~~~~~~~ /kisskb/src/arch/sparc/vdso/vclock_gettime.c:343:1: warning: no previous prototype for '__vdso_gettimeofday_stick' [-Wmissing-prototypes] 343 | __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz) | ^~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/kernel/fork.c: In function '__do_sys_clone3': /kisskb/src/kernel/fork.c:3078:2: warning: #warning clone3() entry point is missing, please fix [-Wcpp] 3078 | #warning clone3() entry point is missing, please fix | ^~~~~~~ /opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: warning: arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack /opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker In file included from /kisskb/src/arch/sparc/vdso/vdso32/vclock_gettime.c:22: /kisskb/src/arch/sparc/vdso/vdso32/../vclock_gettime.c:254:1: warning: no previous prototype for '__vdso_clock_gettime' [-Wmissing-prototypes] 254 | __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts) | ^~~~~~~~~~~~~~~~~~~~ /kisskb/src/arch/sparc/vdso/vdso32/../vclock_gettime.c:282:1: warning: no previous prototype for '__vdso_clock_gettime_stick' [-Wmissing-prototypes] 282 | __vdso_clock_gettime_stick(clockid_t clock, struct __kernel_old_timespec *ts) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /kisskb/src/arch/sparc/vdso/vdso32/../vclock_gettime.c:307:1: warning: no previous prototype for '__vdso_gettimeofday' [-Wmissing-prototypes] 307 | __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz) | ^~~~~~~~~~~~~~~~~~~ /kisskb/src/arch/sparc/vdso/vdso32/../vclock_gettime.c:343:1: warning: no previous prototype for '__vdso_gettimeofday_stick' [-Wmissing-prototypes] 343 | __vdso_gettimeofday_stick(struct __kernel_old_timeval *tv, struct timezone *tz) | ^~~~~~~~~~~~~~~~~~~~~~~~~ /opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: warning: arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack /opt/cross/kisskb/korg/gcc-13.1.0-nolibc/sparc64-linux/bin/sparc64-linux-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker Completed OK # rm -rf /kisskb/build/linus_allnoconfig_sparc64-gcc13 # Build took: 0:00:21.646755