1. 10 Sep, 2020 2 commits
    • Ahmed S. Darwish's avatar
      mm/swap: Do not abuse the seqcount_t latching API · 6446a513
      Ahmed S. Darwish authored
      Commit eef1a429 ("mm/swap.c: piggyback lru_add_drain_all() calls")
      implemented an optimization mechanism to exit the to-be-started LRU
      drain operation (name it A) if another drain operation *started and
      finished* while (A) was blocked on the LRU draining mutex.
      
      This was done through a seqcount_t latch, which is an abuse of its
      semantics:
      
        1. seqcount_t latching should be used for the purpose of switching
           between two storage places with sequence protection to allow
           interruptible, preemptible, writer sections. The referenced
           optimization mechanism has absolutely nothing to do with that.
      
        2. The used raw_write_seqcount_latch() has two SMP write memory
           barriers to insure one consistent storage place out of the two
           storage places available. A full memory barrier is required
           instead: to guarantee that the pagevec counter stores visible by
           local CPU are visible to other CPUs -- before loading the current
           drain generation.
      
      Beside the seqcount_t API abuse, the semantics of a latch sequence
      counter was force-fitted into the referenced optimization. What was
      meant is to track "generations" of LRU draining operations, where
      "global lru draining generation = x" implies that all generations
      0 < n <= x are already *scheduled* for draining -- thus nothing needs
      to be done if the current generation number n <= x.
      
      Remove the conceptually-inappropriate seqcount_t latch usage. Manually
      implement the referenced optimization using a counter and SMP memory
      barriers.
      
      Note, while at it, use the non-atomic variant of cpumask_set_cpu(),
      __cpumask_set_cpu(), due to the already existing mutex protection.
      Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/87y2pg9erj.fsf@vostro.fn.ogness.net
      6446a513
    • Ahmed S. Darwish's avatar
      time/sched_clock: Use raw_read_seqcount_latch() during suspend · 58faf20a
      Ahmed S. Darwish authored
      sched_clock uses seqcount_t latching to switch between two storage
      places protected by the sequence counter. This allows it to have
      interruptible, NMI-safe, seqcount_t write side critical sections.
      
      Since 7fc26327 ("seqlock: Introduce raw_read_seqcount_latch()"),
      raw_read_seqcount_latch() became the standardized way for seqcount_t
      latch read paths. Due to the dependent load, it has one read memory
      barrier less than the currently used raw_read_seqcount() API.
      
      Use raw_read_seqcount_latch() for the suspend path.
      
      Commit aadd6e5c ("time/sched_clock: Use raw_read_seqcount_latch()")
      missed changing that instance of raw_read_seqcount().
      
      References: 1809bfa4 ("timers, sched/clock: Avoid deadlock during read from NMI")
      Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20200715092345.GA231464@debian-buster-darwi.lab.linutronix.de
      58faf20a
  2. 26 Aug, 2020 35 commits
  3. 23 Aug, 2020 3 commits
    • Linus Torvalds's avatar
      Linux 5.9-rc2 · d012a719
      Linus Torvalds authored
      d012a719
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · cb957121
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Add perf support for emitting extended registers for power10.
      
       - A fix for CPU hotplug on pseries, where on large/loaded systems we
         may not wait long enough for the CPU to be offlined, leading to
         crashes.
      
       - Addition of a raw cputable entry for Power10, which is not required
         to boot, but is required to make our PMU setup work correctly in
         guests.
      
       - Three fixes for the recent changes on 32-bit Book3S to move modules
         into their own segment for strict RWX.
      
       - A fix for a recent change in our powernv PCI code that could lead to
         crashes.
      
       - A change to our perf interrupt accounting to avoid soft lockups when
         using some events, found by syzkaller.
      
       - A change in the way we handle power loss events from the hypervisor
         on pseries. We no longer immediately shut down if we're told we're
         running on a UPS.
      
       - A few other minor fixes.
      
      Thanks to Alexey Kardashevskiy, Andreas Schwab, Aneesh Kumar K.V, Anju T
      Sudhakar, Athira Rajeev, Christophe Leroy, Frederic Barrat, Greg Kurz,
      Kajol Jain, Madhavan Srinivasan, Michael Neuling, Michael Roth,
      Nageswara R Sastry, Oliver O'Halloran, Thiago Jung Bauermann,
      Vaidyanathan Srinivasan, Vasant Hegde.
      
      * tag 'powerpc-5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/perf/hv-24x7: Move cpumask file to top folder of hv-24x7 driver
        powerpc/32s: Fix module loading failure when VMALLOC_END is over 0xf0000000
        powerpc/pseries: Do not initiate shutdown when system is running on UPS
        powerpc/perf: Fix soft lockups due to missed interrupt accounting
        powerpc/powernv/pci: Fix possible crash when releasing DMA resources
        powerpc/pseries/hotplug-cpu: wait indefinitely for vCPU death
        powerpc/32s: Fix is_module_segment() when MODULES_VADDR is defined
        powerpc/kasan: Fix KASAN_SHADOW_START on BOOK3S_32
        powerpc/fixmap: Fix the size of the early debug area
        powerpc/pkeys: Fix build error with PPC_MEM_KEYS disabled
        powerpc/kernel: Cleanup machine check function declarations
        powerpc: Add POWER10 raw mode cputable entry
        powerpc/perf: Add extended regs support for power10 platform
        powerpc/perf: Add support for outputting extended regs in perf intr_regs
        powerpc: Fix P10 PVR revision in /proc/cpuinfo for SMT4 cores
      cb957121
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-08-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 550c2129
      Linus Torvalds authored
      Pull x86 fix from Thomas Gleixner:
       "A single fix for x86 which removes the RDPID usage from the paranoid
        entry path and unconditionally uses LSL to retrieve the CPU number.
      
        RDPID depends on MSR_TSX_AUX. KVM has an optmization to avoid
        expensive MRS read/writes on VMENTER/EXIT. It caches the MSR values
        and restores them either when leaving the run loop, on preemption or
        when going out to user space. MSR_TSX_AUX is part of that lazy MSR
        set, so after writing the guest value and before the lazy restore any
        exception using the paranoid entry will read the guest value and use
        it as CPU number to retrieve the GSBASE value for the current CPU when
        FSGSBASE is enabled. As RDPID is only used in that particular entry
        path, there is no reason to burden VMENTER/EXIT with two extra MSR
        writes. Remove the RDPID optimization, which is not even backed by
        numbers from the paranoid entry path instead"
      
      * tag 'x86-urgent-2020-08-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/entry/64: Do not use RDPID in paranoid entry to accomodate KVM
      550c2129