1. 27 8月, 2022 2 次提交
    • S
      perf/x86/intel/uncore: Fix broken read_counter() for SNB IMC PMU · 11745ecf
      Stephane Eranian 提交于
      Existing code was generating bogus counts for the SNB IMC bandwidth counters:
      
      $ perf stat -a -I 1000 -e uncore_imc/data_reads/,uncore_imc/data_writes/
           1.000327813           1,024.03 MiB  uncore_imc/data_reads/
           1.000327813              20.73 MiB  uncore_imc/data_writes/
           2.000580153         261,120.00 MiB  uncore_imc/data_reads/
           2.000580153              23.28 MiB  uncore_imc/data_writes/
      
      The problem was introduced by commit:
        07ce734d ("perf/x86/intel/uncore: Clean up client IMC")
      
      Where the read_counter callback was replace to point to the generic
      uncore_mmio_read_counter() function.
      
      The SNB IMC counters are freerunnig 32-bit counters laid out contiguously in
      MMIO. But uncore_mmio_read_counter() is using a readq() call to read from
      MMIO therefore reading 64-bit from MMIO. Although this is okay for the
      uncore_perf_event_update() function because it is shifting the value based
      on the actual counter width to compute a delta, it is not okay for the
      uncore_pmu_event_start() which is simply reading the counter  and therefore
      priming the event->prev_count with a bogus value which is responsible for
      causing bogus deltas in the perf stat command above.
      
      The fix is to reintroduce the custom callback for read_counter for the SNB
      IMC PMU and use readl() instead of readq(). With the change the output of
      perf stat is back to normal:
      $ perf stat -a -I 1000 -e uncore_imc/data_reads/,uncore_imc/data_writes/
           1.000120987             296.94 MiB  uncore_imc/data_reads/
           1.000120987             138.42 MiB  uncore_imc/data_writes/
           2.000403144             175.91 MiB  uncore_imc/data_reads/
           2.000403144              68.50 MiB  uncore_imc/data_writes/
      
      Fixes: 07ce734d ("perf/x86/intel/uncore: Clean up client IMC")
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NKan Liang <kan.liang@linux.intel.com>
      Link: https://lore.kernel.org/r/20220803160031.1379788-1-eranian@google.com
      11745ecf
    • M
      wait_on_bit: add an acquire memory barrier · 8238b457
      Mikulas Patocka 提交于
      There are several places in the kernel where wait_on_bit is not followed
      by a memory barrier (for example, in drivers/md/dm-bufio.c:new_read).
      
      On architectures with weak memory ordering, it may happen that memory
      accesses that follow wait_on_bit are reordered before wait_on_bit and
      they may return invalid data.
      
      Fix this class of bugs by introducing a new function "test_bit_acquire"
      that works like test_bit, but has acquire memory ordering semantics.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Acked-by: NWill Deacon <will@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8238b457
  2. 25 8月, 2022 2 次提交
  3. 24 8月, 2022 3 次提交
  4. 22 8月, 2022 1 次提交
  5. 21 8月, 2022 1 次提交
  6. 20 8月, 2022 4 次提交
  7. 19 8月, 2022 8 次提交
  8. 18 8月, 2022 1 次提交
  9. 17 8月, 2022 1 次提交
    • L
      x86: simplify load_unaligned_zeropad() implementation · c4e34dd9
      Linus Torvalds 提交于
      The exception for the "unaligned access at the end of the page, next
      page not mapped" never happens, but the fixup code ends up causing
      trouble for compilers to optimize well.
      
      clang in particular ends up seeing it being in the middle of a loop, and
      tries desperately to optimize the exception fixup code that is never
      really reached.
      
      The simple solution is to just move all the fixups into the exception
      handler itself, which moves it all out of the hot case code, and means
      that the compiler never sees it or needs to worry about it.
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c4e34dd9
  10. 16 8月, 2022 1 次提交
    • J
      x86/entry: Fix entry_INT80_compat for Xen PV guests · 5b9f0c4d
      Juergen Gross 提交于
      Commit
      
        c89191ce ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
      
      missed one use case of SWAPGS in entry_INT80_compat(). Removing of
      the SWAPGS macro led to asm just using "swapgs", as it is accepting
      instructions in capital letters, too.
      
      This in turn leads to splats in Xen PV guests like:
      
        [   36.145223] general protection fault, maybe for address 0x2d: 0000 [#1] PREEMPT SMP NOPTI
        [   36.145794] CPU: 2 PID: 1847 Comm: ld-linux.so.2 Not tainted 5.19.1-1-default #1 \
      	  openSUSE Tumbleweed f3b44bfb672cdb9f235aff53b57724eba8b9411b
        [   36.146608] Hardware name: HP ProLiant ML350p Gen8, BIOS P72 11/14/2013
        [   36.148126] RIP: e030:entry_INT80_compat+0x3/0xa3
      
      Fix that by open coding this single instance of the SWAPGS macro.
      
      Fixes: c89191ce ("x86/entry: Convert SWAPGS to swapgs and remove the definition of SWAPGS")
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NJan Beulich <jbeulich@suse.com>
      Cc: <stable@vger.kernel.org> # 5.19
      Link: https://lore.kernel.org/r/20220816071137.4893-1-jgross@suse.com
      5b9f0c4d
  11. 15 8月, 2022 1 次提交
    • J
      x86/PAT: Have pat_enabled() properly reflect state when running on Xen · 72cbc8f0
      Jan Beulich 提交于
      After commit ID in the Fixes: tag, pat_enabled() returns false (because
      of PAT initialization being suppressed in the absence of MTRRs being
      announced to be available).
      
      This has become a problem: the i915 driver now fails to initialize when
      running PV on Xen (i915_gem_object_pin_map() is where I located the
      induced failure), and its error handling is flaky enough to (at least
      sometimes) result in a hung system.
      
      Yet even beyond that problem the keying of the use of WC mappings to
      pat_enabled() (see arch_can_pci_mmap_wc()) means that in particular
      graphics frame buffer accesses would have been quite a bit less optimal
      than possible.
      
      Arrange for the function to return true in such environments, without
      undermining the rest of PAT MSR management logic considering PAT to be
      disabled: specifically, no writes to the PAT MSR should occur.
      
      For the new boolean to live in .init.data, init_cache_modes() also needs
      moving to .init.text (where it could/should have lived already before).
      
        [ bp: This is the "small fix" variant for stable. It'll get replaced
          with a proper PAT and MTRR detection split upstream but that is too
          involved for a stable backport.
          - additional touchups to commit msg. Use cpu_feature_enabled(). ]
      
      Fixes: bdd8b6c9 ("drm/i915: replace X86_FEATURE_PAT with pat_enabled()")
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: <stable@vger.kernel.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Link: https://lore.kernel.org/r/9385fa60-fa5d-f559-a137-6608408f88b0@suse.com
      72cbc8f0
  12. 14 8月, 2022 1 次提交
  13. 12 8月, 2022 1 次提交
  14. 11 8月, 2022 13 次提交