1. 26 May, 2021 14 commits
    • Mark Rutland's avatar
      locking/atomic: arc: move to ARCH_ATOMIC · 6db5d993
      Mark Rutland authored
      We'd like all architectures to convert to ARCH_ATOMIC, as once all
      architectures are converted it will be possible to make significant
      cleanups to the atomics headers, and this will make it much easier to
      generically enable atomic functionality (e.g. debug logic in the
      instrumented wrappers).
      
      As a step towards that, this patch migrates alpha to ARCH_ATOMIC. The
      arch code provides arch_{atomic,atomic64,xchg,cmpxchg}*(), and common
      code wraps these with optional instrumentation to provide the regular
      functions.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-15-mark.rutland@arm.com
      6db5d993
    • Mark Rutland's avatar
      locking/atomic: alpha: move to ARCH_ATOMIC · 96d330af
      Mark Rutland authored
      We'd like all architectures to convert to ARCH_ATOMIC, as once all
      architectures are converted it will be possible to make significant
      cleanups to the atomics headers, and this will make it much easier to
      generically enable atomic functionality (e.g. debug logic in the
      instrumented wrappers).
      
      As a step towards that, this patch migrates alpha to ARCH_ATOMIC. The
      arch code provides arch_{atomic,atomic64,xchg,cmpxchg}*(), and common
      code wraps these with optional instrumentation to provide the regular
      functions.
      
      Note: xchg_local() is NOT currently part of the generic atomic
      arch_atomic API, and is not instrumented.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-14-mark.rutland@arm.com
      96d330af
    • Mark Rutland's avatar
      locking/atomic: cmpxchg: support ARCH_ATOMIC · 82b993e8
      Mark Rutland authored
      We'd like all architectures to convert to ARCH_ATOMIC, as this will
      enable functionality, and once all architectures are converted it will
      be possible to make significant cleanups to the atomic headers.
      
      A number of architectures use asm-generic/cmpxchg.h or
      asm-generic/cmpxhg-local.h, and it's impractical to convert the headers
      and all these architectures in one go. To make it possible to convert
      them one-by-one, let's make the asm-generic implementation function as
      either cmpxchg*() or arch_cmpxchg*() depending on whether ARCH_ATOMIC is
      selected. To do this, the generic implementations are prefixed as
      generic_cmpxchg_*(), and preprocessor definitions map
      cmpxchg_*()/arch_cmpxchg_*() onto these as appropriate.
      
      Once all users are moved over to ARCH_ATOMIC the ifdeffery in the header
      can be simplified and/or removed entirely.
      
      For existing users (none of which select ARCH_ATOMIC), there should be
      no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-13-mark.rutland@arm.com
      82b993e8
    • Mark Rutland's avatar
      locking/atomic: cmpxchg: make `generic` a prefix · 6988631b
      Mark Rutland authored
      The asm-generic implementations of cmpxchg_local() and cmpxchg64_local()
      use a `_generic` suffix to distinguish themselves from arch code or
      wrappers used elsewhere.
      
      Subsequent patches will add ARCH_ATOMIC support to these
      implementations, and will distinguish more functions with a `generic`
      portion. To align with how ARCH_ATOMIC uses an `arch_` prefix, it would
      be helpful to use a `generic_` prefix rather than a `_generic` suffix.
      
      In preparation for this, this patch renames the existing functions to
      make `generic` a prefix rather than a suffix. There should be no
      functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-12-mark.rutland@arm.com
      6988631b
    • Mark Rutland's avatar
      locking/atomic: atomic64: support ARCH_ATOMIC · 1bdadf46
      Mark Rutland authored
      We'd like all architectures to convert to ARCH_ATOMIC, as this will
      enable functionality, and once all architectures are converted it will
      be possible to make significant cleanups to the atomic headers.
      
      A number of architectures use asm-generic/atomic64.h, and it's
      impractical to convert the header and all these architectures in one go.
      To make it possible to convert them one-by-one, let's make the
      asm-generic implementation function as either atomic64_*() or
      arch_atomic64_*() depending on whether ARCH_ATOMIC is selected. To do
      this, the generic implementations are prefixed as generic_atomic64_*(),
      and preprocessor definitions map atomic64_*()/arch_atomic64_*() onto
      these as appropriate.
      
      Once all users are moved over to ARCH_ATOMIC the ifdeffery in the header
      can be simplified and/or removed entirely.
      
      For existing users (none of which select ARCH_ATOMIC), there should be
      no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-11-mark.rutland@arm.com
      1bdadf46
    • Mark Rutland's avatar
      locking/atomic: atomic: support ARCH_ATOMIC · f8b6455a
      Mark Rutland authored
      We'd like all architectures to convert to ARCH_ATOMIC, as this will
      enable functionality, and once all architectures are converted it will
      be possible to make significant cleanups to the atomic headers.
      
      A number of architectures use asm-generic/atomic.h, and it's impractical
      to convert the header and all these architectures in one go. To make it
      possible to convert them one-by-one, let's make the asm-generic
      implementation function as either atomic_*() or arch_atomic_*()
      depending on whether ARCH_ATOMIC is selected. To do this, the C
      implementations are prefixed as generic_atomic_*(), and preprocessor
      definitions map atomic_*()/arch_atomic_*() onto these as
      appropriate.
      
      Once all users are moved over to ARCH_ATOMIC the ifdeffery in the header
      can be simplified and/or removed entirely.
      
      For existing users (none of which select ARCH_ATOMIC), there should be
      no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-10-mark.rutland@arm.com
      f8b6455a
    • Mark Rutland's avatar
      locking/atomic: atomic: simplify ifdeffery · d0e03218
      Mark Rutland authored
      Now that asm-generic/atomic.h is only used by architectures without any
      architecture-specific atomic definitions, we know that there will be no
      architecture-specific implementations to override, and can remove the
      ifdeffery this has previously required, bringing it into line with
      asm-generic/atomic64.h.
      
      At the same time, we can implement atomic_add() and atomic_sub()
      directly using ATOMIC_OP(), since we know architectures won't provide
      atomic_add_return() or atomic_sub_return().
      
      There should be no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-9-mark.rutland@arm.com
      d0e03218
    • Mark Rutland's avatar
      locking/atomic: atomic: remove redundant include · 89eb78d5
      Mark Rutland authored
      Since commit:
      
        560cb12a ("locking,arch: Rewrite generic atomic support")
      
      ... we conditionally include <linux/irqflags.h> before defining atomics
      using locking, and hence do not need to do so unconditionally later in
      the header.
      
      This patch removes the redundant include.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-8-mark.rutland@arm.com
      89eb78d5
    • Mark Rutland's avatar
      locking/atomic: atomic: remove stale comments · 2609a195
      Mark Rutland authored
      The commentary in asm-generic/atomic.h is stale; let's bring it up-to
      date:
      
      * The block comment at the start of the file mentions this is only
        usable on UP systems, but is immediately followed by an SMP
        implementation using cmpxchg. Let's delete the misleading statement.
      
      * A comment near the end of the file was originally at the top of the
        file, but over time rework has shuffled it near the end, and it's long
        been superceded by the block comment at the top of the file. Let's
        remove it.
      
      * Since asm-generic/atomic.h isn't the canonical documentation for the
        atomic ops, and since the existing comments are not in kerneldoc
        format, we don't need to document the semantics of each operation here
        (and this would be better done in a centralised document). Let's
        remove these comments.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-7-mark.rutland@arm.com
      2609a195
    • Mark Rutland's avatar
      locking/atomic: openrisc: avoid asm-generic/atomic.h · f0c7bf1b
      Mark Rutland authored
      OpenRISC is the only architecture which uses asm-generic/atomic.h and
      also provides its own implementation of some functions, requiring
      ifdeferry in the asm-generic header. As OpenRISC provides the vast
      majority of functions itself, it would be simpler overall if it also
      provided the few functions it cribs from asm-generic.
      
      This patch decouples OpenRISC from asm-generic/atomic.h. Subsequent
      patches will simplify the asm-generic implementation and remove the now
      unnecessary ifdeferry.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarStafford Horne <shorne@gmail.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-6-mark.rutland@arm.com
      f0c7bf1b
    • Mark Rutland's avatar
      locking/atomic: microblaze: use asm-generic exclusively · b68622a8
      Mark Rutland authored
      Microblaze provides its own implementation of atomic_dec_if_positive(),
      but nothing else. For a while now, the conditional inc/dec ops have been
      optional, and the core code will provide generic implementations using
      the code templates in scripts/atomic/fallbacks/.
      
      For simplicity, and for consistency with the other conditional atomic
      ops, let's drop the microblaze implementation of
      atomic_dec_if_positive(), and use the generic implementation.
      
      With that, we can also drop the local asm/atomic.h and asm/cmpxchg.h
      headers, as asm-generic/atomic.h is mandatory-y, and we can pull in
      asm-generic/cmpxchg.h via generic-y. This matches what nios2 and nds32
      do today.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-5-mark.rutland@arm.com
      b68622a8
    • Mark Rutland's avatar
      locking/atomic: h8300: use asm-generic exclusively · c7178cde
      Mark Rutland authored
      As h8300's implementation of the atomics isn't using any arch-specific
      functionality, and its implementation of cmpxchg only uses assembly to
      non-atomically swap two elements in memory, we may as well use the
      asm-generic atomic.h and cmpxchg.h, and avoid the duplicate code.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-4-mark.rutland@arm.com
      c7178cde
    • Mark Rutland's avatar
      locking/atomic: net: use linux/atomic.h for xchg & cmpxchg · 201e2c1b
      Mark Rutland authored
      As xchg*() and cmpxchg*() may be instrumented by atomic-instrumented.h,
      it's necessary to include <linux/atomic.h> to use these, rather than
      <asm/cmpxchg.h>, which is effectively an arch-internal header.
      
      In a couple of places we include <asm/cmpxchg.h>, but get away with this
      as <linux/atomic.h> gets pulled in inidrectly by another include. Before
      we convert more architectures to use atomic-instrumented.h, let's fix
      these up to use <linux/atomic.h> so that we don't make things more
      fragile.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-3-mark.rutland@arm.com
      201e2c1b
    • Mark Rutland's avatar
      locking/atomic: make ARCH_ATOMIC a Kconfig symbol · 9be85de9
      Mark Rutland authored
      Subsequent patches will move architectures over to the ARCH_ATOMIC API,
      after preparing the asm-generic atomic implementations to function with
      or without ARCH_ATOMIC.
      
      As some architectures use the asm-generic implementations exclusively
      (and don't have a local atomic.h), and to avoid the risk that
      ARCH_ATOMIC isn't defined in some cases we expect, let's make the
      ARCH_ATOMIC macro a Kconfig symbol instead, so that we can guarantee it
      is consistently available where needed.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20210525140232.53872-2-mark.rutland@arm.com
      9be85de9
  2. 25 May, 2021 1 commit
  3. 12 May, 2021 3 commits
  4. 11 May, 2021 2 commits
  5. 10 May, 2021 19 commits
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.13-2021-05-10' of... · 1140ab59
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.13-2021-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix swapping of cpu_map and stat_config records.
      
       - Fix dynamic libbpf linking.
      
       - Disallow -c and -F option at the same time in 'perf record'.
      
       - Update headers with the kernel originals.
      
       - Silence warning for JSON ArchStd files.
      
       - Fix a build error on arm64 with clang.
      
      * tag 'perf-tools-fixes-for-v5.13-2021-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        tools headers UAPI: Sync perf_event.h with the kernel sources
        tools headers cpufeatures: Sync with the kernel sources
        tools include UAPI powerpc: Sync errno.h with the kernel headers
        tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy'
        tools headers UAPI: Sync linux/prctl.h with the kernel sources
        tools headers UAPI: Sync files changed by landlock, quotactl_path and mount_settattr new syscalls
        perf tools: Fix a build error on arm64 with clang
        tools headers kvm: Sync kvm headers with the kernel sources
        tools headers UAPI: Sync linux/kvm.h with the kernel sources
        perf tools: Fix dynamic libbpf link
        perf session: Fix swapping of cpu_map and stat_config records
        perf jevents: Silence warning for ArchStd files
        perf record: Disallow -c and -F option at the same time
        tools arch x86: Sync the msr-index.h copy with the kernel sources
        tools headers UAPI: Sync drm/i915_drm.h with the kernel sources
        tools headers UAPI: Update tools's copy of drm.h headers
      1140ab59
    • Linus Torvalds's avatar
      Merge tag 'for-5.13-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 142b507f
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "First batch of various fixes, here's a list of notable ones:
      
         - fix unmountable seed device after fstrim
      
         - fix silent data loss in zoned mode due to ordered extent splitting
      
         - fix race leading to unpersisted data and metadata on fsync
      
         - fix deadlock when cloning inline extents and using qgroups"
      
      * tag 'for-5.13-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: initialize return variable in cleanup_free_space_cache_v1
        btrfs: zoned: sanity check zone type
        btrfs: fix unmountable seed device after fstrim
        btrfs: fix deadlock when cloning inline extents and using qgroups
        btrfs: fix race leading to unpersisted data and metadata on fsync
        btrfs: do not consider send context as valid when trying to flush qgroups
        btrfs: zoned: fix silent data loss after failure splitting ordered extent
      142b507f
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 0aa099a3
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
      
       - Lots of bug fixes.
      
       - Fix virtualization of RDPID
      
       - Virtualization of DR6_BUS_LOCK, which on bare metal is new to this
         release
      
       - More nested virtualization migration fixes (nSVM and eVMCS)
      
       - Fix for KVM guest hibernation
      
       - Fix for warning in SEV-ES SRCU usage
      
       - Block KVM from loading on AMD machines with 5-level page tables, due
         to the APM not mentioning how host CR4.LA57 exactly impacts the
         guest.
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (48 commits)
        KVM: SVM: Move GHCB unmapping to fix RCU warning
        KVM: SVM: Invert user pointer casting in SEV {en,de}crypt helpers
        kvm: Cap halt polling at kvm->max_halt_poll_ns
        tools/kvm_stat: Fix documentation typo
        KVM: x86: Prevent deadlock against tk_core.seq
        KVM: x86: Cancel pvclock_gtod_work on module removal
        KVM: x86: Prevent KVM SVM from loading on kernels with 5-level paging
        KVM: X86: Expose bus lock debug exception to guest
        KVM: X86: Add support for the emulation of DR6_BUS_LOCK bit
        KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks
        KVM: x86: Hide RDTSCP and RDPID if MSR_TSC_AUX probing failed
        KVM: x86: Tie Intel and AMD behavior for MSR_TSC_AUX to guest CPU model
        KVM: x86: Move uret MSR slot management to common x86
        KVM: x86: Export the number of uret MSRs to vendor modules
        KVM: VMX: Disable loading of TSX_CTRL MSR the more conventional way
        KVM: VMX: Use common x86's uret MSR list as the one true list
        KVM: VMX: Use flag to indicate "active" uret MSRs instead of sorting list
        KVM: VMX: Configure list of user return MSRs at module init
        KVM: x86: Add support for RDPID without RDTSCP
        KVM: SVM: Probe and load MSR_TSC_AUX regardless of RDTSCP support in host
        ...
      0aa099a3
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync perf_event.h with the kernel sources · 71d7924b
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        2b26f0aa ("perf: Support only inheriting events if cloned with CLONE_THREAD")
        2e498d0a ("perf: Add support for event removal on exec")
        547b6098 ("perf: aux: Add flags for the buffer format")
        55bcf6ef ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE")
        7dde5176 ("perf: aux: Add CoreSight PMU buffer formats")
        97ba62b2 ("perf: Add support for SIGTRAP on perf events")
        d0d1dd62 ("perf core: Add PERF_COUNT_SW_CGROUP_SWITCHES event")
      
      Also change the expected sizeof(struct perf_event_attr) from 120 to 128 due to
      fields being added for the SIGTRAP changes.
      
      Addressing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/perf_event.h' differs from latest version at 'include/uapi/linux/perf_event.h'
        diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
      
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Marco Elver <elver@google.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      71d7924b
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · 6faf64f5
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        4e629211 ("x86/paravirt: Add new features for paravirt patching")
        a161545a ("x86/cpufeatures: Enumerate Intel Hybrid Technology feature bit")
        a89dfde3 ("x86: Remove dynamic NOP selection")
        b8921dcc ("x86/cpufeatures: Add SGX1 and SGX2 sub-features")
        f21d4d3b ("x86/cpufeatures: Enumerate #DB for bus lock detection")
        f333374e ("x86/cpufeatures: Add the Virtual SPEC_CTRL feature")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Babu Moger <babu.moger@amd.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6faf64f5
    • Arnaldo Carvalho de Melo's avatar
      tools include UAPI powerpc: Sync errno.h with the kernel headers · 39163293
      Arnaldo Carvalho de Melo authored
      To pick the change in:
      
        7de21e67 ("powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h")
      
      That will make the errno number -> string tables to pick this change on powerpc.
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/errno.h' differs from latest version at 'arch/powerpc/include/uapi/asm/errno.h'
        diff -u tools/arch/powerpc/include/uapi/asm/errno.h arch/powerpc/include/uapi/asm/errno.h
      
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Tony Ambardar <tony.ambardar@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      39163293
    • Arnaldo Carvalho de Melo's avatar
      tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' · fb24e308
      Arnaldo Carvalho de Melo authored
      To bring in the change made in this cset:
      
       5e21a3ec ("x86/alternative: Merge include files")
      
      This just silences these perf tools build warnings, no change in the tools:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
        diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
      
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Juergen Gross <jgross@suse.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fb24e308
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/prctl.h with the kernel sources · 5a80ee42
      Arnaldo Carvalho de Melo authored
      To pick a new prctl introduced in:
      
        20169862 ("arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)")
      
      That results in
      
        $ grep prctl tools/perf/trace/beauty/*.sh
        tools/perf/trace/beauty/prctl_option.sh:printf "static const char *prctl_options[] = {\n"
        tools/perf/trace/beauty/prctl_option.sh:egrep $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \
        tools/perf/trace/beauty/prctl_option.sh:printf "static const char *prctl_set_mm_options[] = {\n"
        tools/perf/trace/beauty/prctl_option.sh:egrep $regex ${header_dir}/prctl.h | \
        tools/perf/trace/beauty/x86_arch_prctl.sh:prctl_arch_header=${x86_header_dir}/prctl.h
        tools/perf/trace/beauty/x86_arch_prctl.sh:	printf "#define x86_arch_prctl_codes_%d_offset %s\n" $idx $first_entry
        tools/perf/trace/beauty/x86_arch_prctl.sh:	printf "static const char *x86_arch_prctl_codes_%d[] = {\n" $idx
        tools/perf/trace/beauty/x86_arch_prctl.sh:	egrep -q $regex ${prctl_arch_header} && \
        tools/perf/trace/beauty/x86_arch_prctl.sh:	(egrep $regex ${prctl_arch_header} | \
        $ tools/perf/trace/beauty/prctl_option.sh > before
        $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
        $ tools/perf/trace/beauty/prctl_option.sh > after
        $ diff -u before after
        --- before	2021-05-09 10:06:10.064559675 -0300
        +++ after	2021-05-09 10:06:21.319791396 -0300
        @@ -54,6 +54,8 @@
         	[57] = "SET_IO_FLUSHER",
         	[58] = "GET_IO_FLUSHER",
         	[59] = "SET_SYSCALL_USER_DISPATCH",
        +	[60] = "PAC_SET_ENABLED_KEYS",
        +	[61] = "PAC_GET_ENABLED_KEYS",
         };
         static const char *prctl_set_mm_options[] = {
         	[1] = "START_CODE",
        $
      
      Now users can do:
      
        # perf trace -e syscalls:sys_enter_prctl --filter "option==PAC_GET_ENABLED_KEYS"
      ^C#
        # trace -v -e syscalls:sys_enter_prctl --filter "option==PAC_GET_ENABLED_KEYS"
        New filter for syscalls:sys_enter_prctl: (option==0x3d) && (common_pid != 5519 && common_pid != 3404)
      ^C#
      
      And also when prctl appears in a session, its options will be
      translated to the string.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Peter Collingbourne <pcc@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5a80ee42
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync files changed by landlock, quotactl_path and mount_settattr new syscalls · f8bcb061
      Arnaldo Carvalho de Melo authored
      To pick the changes in these csets:
      
        a49f4f81 ("arch: Wire up Landlock syscalls")
        2a186721 ("fs: add mount_setattr()")
        fa8b9007 ("quota: wire up quotactl_path")
      
      That silences these perf build warnings and add support for those new
      syscalls in tools such as 'perf trace'.
      
      For instance, this is now possible:
      
        # ~acme/bin/perf trace -v -e landlock*
        event qualifier tracepoint filter: (common_pid != 129365 && common_pid != 3502) && (id == 444 || id == 445 || id == 446)
        ^C#
      
      That is tha filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ grep landlock tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        444	common	landlock_create_ruleset	sys_landlock_create_ruleset
        445	common	landlock_add_rule	sys_landlock_add_rule
        446	common	landlock_restrict_self	sys_landlock_restrict_self
        $
      
      This addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/powerpc/entry/syscalls/syscall.tbl' differs from latest version at 'arch/powerpc/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/s390/entry/syscalls/syscall.tbl' differs from latest version at 'arch/s390/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl' differs from latest version at 'arch/mips/kernel/syscalls/syscall_n64.tbl'
        diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
      
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: James Morris <jamorris@linux.microsoft.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Mickaël Salaün <mic@linux.microsoft.com>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f8bcb061
    • Masami Hiramatsu's avatar
      perf tools: Fix a build error on arm64 with clang · a00b7e39
      Masami Hiramatsu authored
      Since clang's -Wmissing-field-initializers warns if a data
      structure is initialized with a signle NULL as below,
      
       ----
       tools/perf $ make CC=clang LLVM=1
       ...
       arch/arm64/util/kvm-stat.c:74:9: error: missing field 'ops' initializer [-Werror,-Wmissing-field-initializers]
               { NULL },
                      ^
       1 error generated.
       ----
      
      add another field initializer expressly as same as other
      arch's kvm-stat.c code.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Anders Roxell <anders.roxell@linaro.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Link: http://lore.kernel.org/lkml/162037767540.94840.15758657049033010518.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a00b7e39
    • Arnaldo Carvalho de Melo's avatar
      tools headers kvm: Sync kvm headers with the kernel sources · b35629bc
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        3c0c2ad1 ("KVM: VMX: Add basic handling of VM-Exit from SGX enclave")
      
      None of them trigger any changes in tooling, this time this is just to silence
      these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/vmx.h' differs from latest version at 'arch/x86/include/uapi/asm/vmx.h'
        diff -u tools/arch/x86/include/uapi/asm/vmx.h arch/x86/include/uapi/asm/vmx.h
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b35629bc
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · 0d943d5f
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        15fb7de1 ("KVM: SVM: Add KVM_SEV_RECEIVE_UPDATE_DATA command")
        3bf72569 ("KVM: arm64: Add support for the KVM PTP service")
        4cfdd47d ("KVM: SVM: Add KVM_SEV SEND_START command")
        54526d1f ("KVM: x86: Support KVM VMs sharing SEV context")
        5569e2e7 ("KVM: SVM: Add support for KVM_SEV_SEND_CANCEL command")
        8b13c364 ("KVM: introduce KVM_CAP_SET_GUEST_DEBUG2")
        af43cbbf ("KVM: SVM: Add support for KVM_SEV_RECEIVE_START command")
        d3d1af85 ("KVM: SVM: Add KVM_SEND_UPDATE_DATA command")
        fe7e9488 ("KVM: x86: Add capability to grant VM access to privileged SGX attribute")
      
      That don't cause any change in tooling as it doesn't introduce any new
      ioctl.
      
        $ grep kvm tools/perf/trace/beauty/*.sh
        tools/perf/trace/beauty/kvm_ioctl.sh:printf "static const char *kvm_ioctl_cmds[] = {\n"
        tools/perf/trace/beauty/kvm_ioctl.sh:egrep $regex ${header_dir}/kvm.h	| \
        $
        $ tools/perf/trace/beauty/kvm_ioctl.sh > before
        $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h
        $ tools/perf/trace/beauty/kvm_ioctl.sh > after
        $ diff -u before after
        $
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Brijesh Singh <brijesh.singh@amd.com>
      Cc: Jianyong Wu <jianyong.wu@arm.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Nathan Tempelman <natet@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steve Rutherford <srutherford@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0d943d5f
    • Jiri Olsa's avatar
      perf tools: Fix dynamic libbpf link · ad1237c3
      Jiri Olsa authored
      Justin reported broken build with LIBBPF_DYNAMIC=1.
      
      When linking libbpf dynamically we need to use perf's
      hashmap object, because it's not exported in libbpf.so
      (only in libbpf.a).
      
      Following build is now passing:
      
        $ make LIBBPF_DYNAMIC=1
          BUILD:   Doing 'make -j8' parallel build
          ...
        $ ldd perf | grep libbpf
              libbpf.so.0 => /lib64/libbpf.so.0 (0x00007fa7630db000)
      
      Fixes: eee19501 ("perf tools: Grab a copy of libbpf's hashmap")
      Reported-by: default avatarJustin M. Forbes <jforbes@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210508205020.617984-1-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ad1237c3
    • Dmitry Koshelev's avatar
      perf session: Fix swapping of cpu_map and stat_config records · a11c9a6e
      Dmitry Koshelev authored
      'data' field in perf_record_cpu_map_data struct is 16-bit
      wide and so should be swapped using bswap_16().
      
      'nr' field in perf_record_stat_config struct should be
      swapped before being used for size calculation.
      Signed-off-by: default avatarDmitry Koshelev <karaghiozis@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210506131244.13328-1-karaghiozis@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a11c9a6e
    • Ian Rogers's avatar
      perf jevents: Silence warning for ArchStd files · 7aa3c9ea
      Ian Rogers authored
      JSON files in the level 1 directory are used for ArchStd events (see
      preprocess_arch_std_files), as such they shouldn't be warned about.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210506225640.1461000-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7aa3c9ea
    • Namhyung Kim's avatar
      perf record: Disallow -c and -F option at the same time · e8c11676
      Namhyung Kim authored
      It's confusing which one is effective when the both options are given.
      The current code happens to use -c in this case but users might not be
      aware of it.  We can change it to complain about that instead of relying
      on the implicit priority.
      
      Before:
      
        $ perf record -c 111111 -F 99 true
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.031 MB perf.data (8 samples) ]
      
        $ perf evlist -F
        cycles: sample_period=111111
        $
      
      After:
        $ perf record -c 111111 -F 99 true
        cannot set frequency and period at the same time
        $
      
      So this change can break existing usages, but I think it's rare to have
      both options and it'd be better changing them.
      Suggested-by: default avatarAlexey Alexandrov <aalexand@google.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210402094020.28164-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e8c11676
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · b3172585
      Arnaldo Carvalho de Melo authored
      To pick up the changes from these csets:
      
        d0946a88 ("perf/x86/intel: Hybrid PMU support for perf capabilities")
      
      That cause no changes to tooling as it isn't adding any new MSR, just
      some capabilities for a pre-existing one:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        $
      
      Just silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
        diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
      
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3172585
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · 0fdee797
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        b5b6f6a6 ("drm/i915/gem: Drop legacy execbuffer support (v2)")
      
      That don't result in any change in tooling as this is just adding a
      comment.
      
      Only silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Jason Ekstrand <jason@jlekstrand.net>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0fdee797
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Update tools's copy of drm.h headers · a3bc4ffe
      Arnaldo Carvalho de Melo authored
      Picking the changes from:
      
        b603e810 ("drm/uapi: document kernel capabilities")
      
      Doesn't result in any tooling changes:
      
        $ tools/perf/trace/beauty/drm_ioctl.sh  > before
        $ cp include/uapi/drm/drm.h tools/include/uapi/drm/drm.h
        $ tools/perf/trace/beauty/drm_ioctl.sh  > after
        $ diff -u before after
      
      Silencing these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/drm.h' differs from latest version at 'include/uapi/drm/drm.h'
        diff -u tools/include/uapi/drm/drm.h include/uapi/drm/drm.h
      
      Cc: Simon Ser <contact@emersion.fr>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a3bc4ffe
  6. 09 May, 2021 1 commit