1. 24 Jun, 2021 1 commit
  2. 22 Jun, 2021 8 commits
    • Baokun Li's avatar
    • Feng Tang's avatar
      clocksource: Print deviation in nanoseconds when a clocksource becomes unstable · 22a22383
      Feng Tang authored
      Currently when an unstable clocksource is detected, the raw counters of
      that clocksource and watchdog will be printed, which can only be understood
      after some math calculation.
      
      So print the delta in nanoseconds as well to make it easier for humans to
      check the results.
      
      [ paulmck: Fix typo. ]
      Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lore.kernel.org/r/20210527190124.440372-6-paulmck@kernel.org
      22a22383
    • Paul E. McKenney's avatar
      clocksource: Provide kernel module to test clocksource watchdog · 1253b9b8
      Paul E. McKenney authored
      When the clocksource watchdog marks a clock as unstable, this might
      be due to that clock being unstable or it might be due to delays that
      happen to occur between the reads of the two clocks.  It would be good
      to have a way of testing the clocksource watchdog's ability to
      distinguish between these two causes of clock skew and instability.
      
      Therefore, provide a new clocksource-wdtest module selected by a new
      TEST_CLOCKSOURCE_WATCHDOG Kconfig option.  This module has a single module
      parameter named "holdoff" that provides the number of seconds of delay
      before testing should start, which defaults to zero when built as a module
      and to 10 seconds when built directly into the kernel.  Very large systems
      that boot slowly may need to increase the value of this module parameter.
      
      This module uses hand-crafted clocksource structures to do its testing,
      thus avoiding messing up timing for the rest of the kernel and for user
      applications.  This module first verifies that the ->uncertainty_margin
      field of the clocksource structures are set sanely.  It then tests the
      delay-detection capability of the clocksource watchdog, increasing the
      number of consecutive delays injected, first provoking console messages
      complaining about the delays and finally forcing a clock-skew event.
      Unexpected test results cause at least one WARN_ON_ONCE() console splat.
      If there are no splats, the test has passed.  Finally, it fuzzes the
      value returned from a clocksource to test the clocksource watchdog's
      ability to detect time skew.
      
      This module checks the state of its clocksource after each test, and
      uses WARN_ON_ONCE() to emit a console splat if there are any failures.
      This should enable all types of test frameworks to detect any such
      failures.
      
      This facility is intended for diagnostic use only, and should be avoided
      on production systems.
      Reported-by: default avatarChris Mason <clm@fb.com>
      Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarFeng Tang <feng.tang@intel.com>
      Link: https://lore.kernel.org/r/20210527190124.440372-5-paulmck@kernel.org
      1253b9b8
    • Paul E. McKenney's avatar
      clocksource: Reduce clocksource-skew threshold · 2e27e793
      Paul E. McKenney authored
      Currently, WATCHDOG_THRESHOLD is set to detect a 62.5-millisecond skew in
      a 500-millisecond WATCHDOG_INTERVAL.  This requires that clocks be skewed
      by more than 12.5% in order to be marked unstable.  Except that a clock
      that is skewed by that much is probably destroying unsuspecting software
      right and left.  And given that there are now checks for false-positive
      skews due to delays between reading the two clocks, it should be possible
      to greatly decrease WATCHDOG_THRESHOLD, at least for fine-grained clocks
      such as TSC.
      
      Therefore, add a new uncertainty_margin field to the clocksource structure
      that contains the maximum uncertainty in nanoseconds for the corresponding
      clock.  This field may be initialized manually, as it is for
      clocksource_tsc_early and clocksource_jiffies, which is copied to
      refined_jiffies.  If the field is not initialized manually, it will be
      computed at clock-registry time as the period of the clock in question
      based on the scale and freq parameters to __clocksource_update_freq_scale()
      function.  If either of those two parameters are zero, the
      tens-of-milliseconds WATCHDOG_THRESHOLD is used as a cowardly alternative
      to dividing by zero.  No matter how the uncertainty_margin field is
      calculated, it is bounded below by twice WATCHDOG_MAX_SKEW, that is, by 100
      microseconds.
      
      Note that manually initialized uncertainty_margin fields are not adjusted,
      but there is a WARN_ON_ONCE() that triggers if any such field is less than
      twice WATCHDOG_MAX_SKEW.  This WARN_ON_ONCE() is intended to discourage
      production use of the one-nanosecond uncertainty_margin values that are
      used to test the clock-skew code itself.
      
      The actual clock-skew check uses the sum of the uncertainty_margin fields
      of the two clocksource structures being compared.  Integer overflow is
      avoided because the largest computed value of the uncertainty_margin
      fields is one billion (10^9), and double that value fits into an
      unsigned int.  However, if someone manually specifies (say) UINT_MAX,
      they will get what they deserve.
      
      Note that the refined_jiffies uncertainty_margin field is initialized to
      TICK_NSEC, which means that skew checks involving this clocksource will
      be sufficently forgiving.  In a similar vein, the clocksource_tsc_early
      uncertainty_margin field is initialized to 32*NSEC_PER_MSEC, which
      replicates the current behavior and allows custom setting if needed
      in order to address the rare skews detected for this clocksource in
      current mainline.
      Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarFeng Tang <feng.tang@intel.com>
      Link: https://lore.kernel.org/r/20210527190124.440372-4-paulmck@kernel.org
      2e27e793
    • Paul E. McKenney's avatar
      clocksource: Limit number of CPUs checked for clock synchronization · fa218f1c
      Paul E. McKenney authored
      Currently, if skew is detected on a clock marked CLOCK_SOURCE_VERIFY_PERCPU,
      that clock is checked on all CPUs.  This is thorough, but might not be
      what you want on a system with a few tens of CPUs, let alone a few hundred
      of them.
      
      Therefore, by default check only up to eight randomly chosen CPUs.  Also
      provide a new clocksource.verify_n_cpus kernel boot parameter.  A value of
      -1 says to check all of the CPUs, and a non-negative value says to randomly
      select that number of CPUs, without concern about selecting the same CPU
      multiple times.  However, make use of a cpumask so that a given CPU will be
      checked at most once.
      
      Suggested-by: Thomas Gleixner <tglx@linutronix.de> # For verify_n_cpus=1.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarFeng Tang <feng.tang@intel.com>
      Link: https://lore.kernel.org/r/20210527190124.440372-3-paulmck@kernel.org
      fa218f1c
    • Paul E. McKenney's avatar
      clocksource: Check per-CPU clock synchronization when marked unstable · 7560c02b
      Paul E. McKenney authored
      Some sorts of per-CPU clock sources have a history of going out of
      synchronization with each other.  However, this problem has purportedy been
      solved in the past ten years.  Except that it is all too possible that the
      problem has instead simply been made less likely, which might mean that
      some of the occasional "Marking clocksource 'tsc' as unstable" messages
      might be due to desynchronization.  How would anyone know?
      
      Therefore apply CPU-to-CPU synchronization checking to newly unstable
      clocksource that are marked with the new CLOCK_SOURCE_VERIFY_PERCPU flag.
      Lists of desynchronized CPUs are printed, with the caveat that if it
      is the reporting CPU that is itself desynchronized, it will appear that
      all the other clocks are wrong.  Just like in real life.
      Reported-by: default avatarChris Mason <clm@fb.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarFeng Tang <feng.tang@intel.com>
      Link: https://lore.kernel.org/r/20210527190124.440372-2-paulmck@kernel.org
      7560c02b
    • Paul E. McKenney's avatar
      clocksource: Retry clock read if long delays detected · db3a34e1
      Paul E. McKenney authored
      When the clocksource watchdog marks a clock as unstable, this might be due
      to that clock being unstable or it might be due to delays that happen to
      occur between the reads of the two clocks.  Yes, interrupts are disabled
      across those two reads, but there are no shortage of things that can delay
      interrupts-disabled regions of code ranging from SMI handlers to vCPU
      preemption.  It would be good to have some indication as to why the clock
      was marked unstable.
      
      Therefore, re-read the watchdog clock on either side of the read from the
      clock under test.  If the watchdog clock shows an excessive time delta
      between its pair of reads, the reads are retried.
      
      The maximum number of retries is specified by a new kernel boot parameter
      clocksource.max_cswd_read_retries, which defaults to three, that is, up to
      four reads, one initial and up to three retries.  If more than one retry
      was required, a message is printed on the console (the occasional single
      retry is expected behavior, especially in guest OSes).  If the maximum
      number of retries is exceeded, the clock under test will be marked
      unstable.  However, the probability of this happening due to various sorts
      of delays is quite small.  In addition, the reason (clock-read delays) for
      the unstable marking will be apparent.
      Reported-by: default avatarChris Mason <clm@fb.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarFeng Tang <feng.tang@intel.com>
      Link: https://lore.kernel.org/r/20210527190124.440372-1-paulmck@kernel.org
      db3a34e1
    • Baokun Li's avatar
      clockevents: Add missing parameter documentation · 64ab7071
      Baokun Li authored
      Add the missing documentation for the @cpu parameter of
      tick_cleanup_dead_cpu().
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lore.kernel.org/r/20210608024305.2750999-1-libaokun1@huawei.com
      64ab7071
  3. 18 Jun, 2021 1 commit
    • Thomas Gleixner's avatar
      Merge tag 'timers-v5.14' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core · f6b6a803
      Thomas Gleixner authored
      Pull clockevent/source updates from Daniel Lezcano:
      
       - Remove arch_timer_rate1 variable as it is unused in the architected
         ARM timer (Jisheng Zhang)
      
       - Minor cleanups (whitespace, constification, ...) for the Samsung pwm
         timer (Krzysztof Kozlowski)
      
       - Acknowledge and disable the timer interrupt at suspend time to
         prevent the suspend to be aborted by the ATF if there is a pending
         one on the Mediatek timer (Evan Benn)
      
       - Save and restore the configuration register at suspend/resume time
         for TI dm timer (Tony Lindgren)
      
       - Set the scene for the next timers support by renaming the array
         variables on the Ingenic time (Zhou Yanjie)
      
       - Add the clock rate change notification to adjust the prescalar value
         and compensate the clock source on the ARM global timer (Andrea
         Merello)
      
       - Add missing variable static annotation on the ARM global timer (Zou
         Wei)
      
       - Remove a duplicate argument when building the bits field on the ARM
         global timer (Wan Jiabing)
      
       - Improve the timer workaround function by reducing the loop on the
         Allwinner A64 timer (Samuel Holland)
      
       - Do no restore the register context in case of error on the TI dm
         timer (Tony Lindgren)
      
      Link: https://lore.kernel.org/r/65ed5f60-d7a5-b4ae-ff78-0382d4671cc5@linaro.org
      f6b6a803
  4. 16 Jun, 2021 6 commits
  5. 15 Jun, 2021 3 commits
  6. 04 Jun, 2021 4 commits
  7. 03 Jun, 2021 1 commit
  8. 31 May, 2021 6 commits
  9. 30 May, 2021 5 commits
    • Linus Torvalds's avatar
      Linux 5.13-rc4 · 8124c8a6
      Linus Torvalds authored
      8124c8a6
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · b90e90f4
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "This is a bit larger than usual at rc4 time. The reason is due to
        Lee's work of fixing newly reported build warnings.
      
        The rest is fixes as usual"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (22 commits)
        MAINTAINERS: adjust to removing i2c designware platform data
        i2c: s3c2410: fix possible NULL pointer deref on read message after write
        i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset
        i2c: i801: Don't generate an interrupt on bus reset
        i2c: mpc: implement erratum A-004447 workaround
        powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 i2c controllers
        powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers
        dt-bindings: i2c: mpc: Add fsl,i2c-erratum-a004447 flag
        i2c: busses: i2c-stm32f4: Remove incorrectly placed ' ' from function name
        i2c: busses: i2c-st: Fix copy/paste function misnaming issues
        i2c: busses: i2c-pnx: Provide descriptions for 'alg_data' data structure
        i2c: busses: i2c-ocores: Place the expected function names into the documentation headers
        i2c: busses: i2c-eg20t: Fix 'bad line' issue and provide description for 'msgs' param
        i2c: busses: i2c-designware-master: Fix misnaming of 'i2c_dw_init_master()'
        i2c: busses: i2c-cadence: Fix incorrectly documented 'enum cdns_i2c_slave_mode'
        i2c: busses: i2c-ali1563: File headers are not good candidates for kernel-doc
        i2c: muxes: i2c-arb-gpio-challenge: Demote non-conformant kernel-doc headers
        i2c: busses: i2c-nomadik: Fix formatting issue pertaining to 'timeout'
        i2c: sh_mobile: Use new clock calculation formulas for RZ/G2E
        i2c: I2C_HISI should depend on ACPI
        ...
      b90e90f4
    • Linus Torvalds's avatar
      Merge tag 'seccomp-fixes-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 9a76c0ee
      Linus Torvalds authored
      Pull seccomp fixes from Kees Cook:
       "This fixes a hard-to-hit race condition in the addfd user_notif
        feature of seccomp, visible since v5.9.
      
        And a small documentation fix"
      
      * tag 'seccomp-fixes-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        seccomp: Refactor notification handler to prepare for new semantics
        Documentation: seccomp: Fix user notification documentation
      9a76c0ee
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 9d68fe84
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
       "A handful of RISC-V related fixes:
      
         - avoid errors when the stack tracing code is tracing itself.
      
         - resurrect the memtest= kernel command line argument on RISC-V,
           which was briefly enabled during the merge window before a
           refactoring disabled it.
      
         - build fix and some warning cleanups"
      
      * tag 'riscv-for-linus-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: kexec: Fix W=1 build warnings
        riscv: kprobes: Fix build error when MMU=n
        riscv: Select ARCH_USE_MEMTEST
        riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled
      9d68fe84
    • Linus Torvalds's avatar
      Merge tag 'xfs-5.13-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 75b9c727
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
       "This week's pile mitigates some decades-old problems in how extent
        size hints interact with realtime volumes, fixes some failures in
        online shrink, and fixes a problem where directory and symlink
        shrinking on extremely fragmented filesystems could fail.
      
        The most user-notable change here is to point users at our (new) IRC
        channel on OFTC. Freedom isn't free, it costs folks like you and me;
        and if you don't kowtow, they'll expel everyone and take over your
        channel. (Ok, ok, that didn't fit the song lyrics...)
      
        Summary:
      
         - Fix a bug where unmapping operations end earlier than expected,
           which can cause chaos on multi-block directory and symlink shrink
           operations.
      
         - Fix an erroneous assert that can trigger if we try to transition a
           bmap structure from btree format to extents format with zero
           extents. This was exposed by xfs/538"
      
      * tag 'xfs-5.13-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: bunmapi has unnecessary AG lock ordering issues
        xfs: btree format inode forks can have zero extents
        xfs: add new IRC channel to MAINTAINERS
        xfs: validate extsz hints against rt extent size when rtinherit is set
        xfs: standardize extent size hint validation
        xfs: check free AG space when making per-AG reservations
      75b9c727
  10. 29 May, 2021 5 commits