Hi "Ahmed,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on a9232dc5607dbada801f2fe83ea307cda762969a]
url:
https://github.com/0day-ci/linux/commits/Ahmed-S-Darwish/seqlock-Extend-s...
base: a9232dc5607dbada801f2fe83ea307cda762969a
config: s390-randconfig-s032-20200719 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-49-g707c5017-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> kernel/time/timekeeping.c:458:23: sparse: sparse: trying to copy
expression type 31
kernel/time/timekeeping.c:467:18: sparse: sparse: trying to
copy expression type 31
include/linux/seqlock.h:340:16: sparse: sparse: unreplaced symbol 's'
include/linux/seqlock.h:340:9: sparse: sparse: unreplaced symbol 'return'
> kernel/time/timekeeping.c:458:23: sparse: sparse: unreplaced
symbol 's'
> kernel/time/timekeeping.c:458:23: sparse: sparse: unreplaced symbol 'return'
include/linux/seqlock.h:340:16: sparse: sparse: unreplaced symbol 's'
include/linux/seqlock.h:340:9: sparse: sparse: unreplaced symbol 'return'
kernel/time/timekeeping.c:467:18: sparse: sparse: unreplaced symbol 's'
kernel/time/timekeeping.c:467:18: sparse: sparse: unreplaced symbol 'return'
/bin/bash: line 1: 27836 Segmentation fault sparse -D__linux__ -Dlinux -D__STDC__
-Dunix -D__unix__ -Wbitwise -Wno-return-void -Wno-unknown-attribute -fdiagnostic-prefix
-D__CHECK_ENDIAN__ -D__s390__ -D__s390x__ --arch=s390 -mbig-endian -m64
-Wp,-MMD,kernel/time/.timekeeping.o.d -nostdinc -isystem
/opt/cross/gcc-9.3.0-nolibc/s390-linux/bin/../lib/gcc/s390-linux/9.3.0/include
-Iarch/s390/include -I./arch/s390/include/generated -Iinclude -I./include
-Iarch/s390/include/uapi -I./arch/s390/include/generated/uapi -Iinclude/uapi
-I./include/generated/uapi -include include/linux/kconfig.h -include
include/linux/compiler_types.h -D__KERNEL__ -DKBUILD_EXTRA_WARN1 -Wall -Wundef
-Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar
-fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security
-std=gnu89 -m64 -fPIE -mbackchain -msoft-float -march=z15 -mtune=z196
-Wa,-Iarch/s390/include -mindirect-branch=thunk -mfunction-return=thunk
-mindirect-branch-table -DCC_USING_EXPOLINE -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -DCONFIG_AS_CFI_VAL_OFFSET=1
-fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation
-Wno-format-overflow -Wno-address-of-packed-member -Os --param=allow-store-data-races=0
-fplugin=./scripts/gcc-plugins/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN
-fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -Wframe-larger-than=8192
-fno-stack-protector -Wno-unused-but-set-variable -Wimplicit-fallthrough
-Wno-unused-const-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -gdwarf-4
-femit-struct-debug-baseonly -fno-var-tracking -gz=zlib -fno-inline-functions-called-once
-Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation
-Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized
-fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check
-fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -fmacro-prefix-map== -Wno-packed-not-aligned -Wextra -Wunused
-Wno-unused-parameter -Wmissing-declarations -Wmissing-format-attribute
-Wmissing-prototypes -Wold-style-definition -Wmissing-include-dirs
-Wunused-but-set-variable -Wunused-const-variable -Wpacked-not-aligned
-Wstringop-truncation -Wno-missing-field-initializers -Wno-sign-compare
-fsanitize=kernel-address -fasan-shadow-offset=0x30000000000 --param asan-globals=1
--param asan-instrumentation-with-call-threshold=0 --param asan-stack=1 --param
asan-instrument-allocas=1 -I kernel/time -I ./kernel/time
-DKBUILD_MODFILE='"kernel/time/timekeeping"'
-DKBUILD_BASENAME='"timekeeping"'
-DKBUILD_MODNAME='"timekeeping"' kernel/time/timekeeping.c
vim +458 kernel/time/timekeeping.c
4396e058c52e16 Thomas Gleixner 2014-07-16 418
4396e058c52e16 Thomas Gleixner 2014-07-16 419 /**
4396e058c52e16 Thomas Gleixner 2014-07-16 420 * ktime_get_mono_fast_ns - Fast NMI safe
access to clock monotonic
4396e058c52e16 Thomas Gleixner 2014-07-16 421 *
4396e058c52e16 Thomas Gleixner 2014-07-16 422 * This timestamp is not guaranteed to be
monotonic across an update.
4396e058c52e16 Thomas Gleixner 2014-07-16 423 * The timestamp is calculated by:
4396e058c52e16 Thomas Gleixner 2014-07-16 424 *
4396e058c52e16 Thomas Gleixner 2014-07-16 425 * now = base_mono + clock_delta * slope
4396e058c52e16 Thomas Gleixner 2014-07-16 426 *
4396e058c52e16 Thomas Gleixner 2014-07-16 427 * So if the update lowers the slope,
readers who are forced to the
4396e058c52e16 Thomas Gleixner 2014-07-16 428 * not yet updated second array are still
using the old steeper slope.
4396e058c52e16 Thomas Gleixner 2014-07-16 429 *
4396e058c52e16 Thomas Gleixner 2014-07-16 430 * tmono
4396e058c52e16 Thomas Gleixner 2014-07-16 431 * ^
4396e058c52e16 Thomas Gleixner 2014-07-16 432 * | o n
4396e058c52e16 Thomas Gleixner 2014-07-16 433 * | o n
4396e058c52e16 Thomas Gleixner 2014-07-16 434 * | u
4396e058c52e16 Thomas Gleixner 2014-07-16 435 * | o
4396e058c52e16 Thomas Gleixner 2014-07-16 436 * |o
4396e058c52e16 Thomas Gleixner 2014-07-16 437 * |12345678---> reader order
4396e058c52e16 Thomas Gleixner 2014-07-16 438 *
4396e058c52e16 Thomas Gleixner 2014-07-16 439 * o = old slope
4396e058c52e16 Thomas Gleixner 2014-07-16 440 * u = update
4396e058c52e16 Thomas Gleixner 2014-07-16 441 * n = new slope
4396e058c52e16 Thomas Gleixner 2014-07-16 442 *
4396e058c52e16 Thomas Gleixner 2014-07-16 443 * So reader 6 will observe time going
backwards versus reader 5.
4396e058c52e16 Thomas Gleixner 2014-07-16 444 *
4396e058c52e16 Thomas Gleixner 2014-07-16 445 * While other CPUs are likely to be able
observe that, the only way
4396e058c52e16 Thomas Gleixner 2014-07-16 446 * for a CPU local observation is when an
NMI hits in the middle of
4396e058c52e16 Thomas Gleixner 2014-07-16 447 * the update. Timestamps taken from that
NMI context might be ahead
4396e058c52e16 Thomas Gleixner 2014-07-16 448 * of the following timestamps. Callers
need to be aware of that and
4396e058c52e16 Thomas Gleixner 2014-07-16 449 * deal with it.
4396e058c52e16 Thomas Gleixner 2014-07-16 450 */
4498e7467e9e44 Peter Zijlstra 2015-03-19 451 static __always_inline u64
__ktime_get_fast_ns(struct tk_fast *tkf)
4396e058c52e16 Thomas Gleixner 2014-07-16 452 {
4396e058c52e16 Thomas Gleixner 2014-07-16 453 struct tk_read_base *tkr;
4396e058c52e16 Thomas Gleixner 2014-07-16 454 unsigned int seq;
4396e058c52e16 Thomas Gleixner 2014-07-16 455 u64 now;
4396e058c52e16 Thomas Gleixner 2014-07-16 456
4396e058c52e16 Thomas Gleixner 2014-07-16 457 do {
7fc26327b75685 Peter Zijlstra 2015-05-27 @458 seq =
raw_read_seqcount_latch(&tkf->seq);
4498e7467e9e44 Peter Zijlstra 2015-03-19 459 tkr = tkf->base + (seq & 0x01);
27727df240c7cc John Stultz 2016-08-23 460 now = ktime_to_ns(tkr->base);
27727df240c7cc John Stultz 2016-08-23 461
58bfea9532552d John Stultz 2016-10-04 462 now += timekeeping_delta_to_ns(tkr,
58bfea9532552d John Stultz 2016-10-04 463 clocksource_delta(
ceea5e3771ed23 John Stultz 2017-06-08 464 tk_clock_read(tkr),
58bfea9532552d John Stultz 2016-10-04 465 tkr->cycle_last,
58bfea9532552d John Stultz 2016-10-04 466 tkr->mask));
4498e7467e9e44 Peter Zijlstra 2015-03-19 467 } while
(read_seqcount_retry(&tkf->seq, seq));
4396e058c52e16 Thomas Gleixner 2014-07-16 468
4396e058c52e16 Thomas Gleixner 2014-07-16 469 return now;
4396e058c52e16 Thomas Gleixner 2014-07-16 470 }
4498e7467e9e44 Peter Zijlstra 2015-03-19 471
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org