Skip to content
Permalink
Zhang-Yi/ext4-…
Switch branches/tags

Commits on Jun 16, 2021

  1. fs: remove bdev_try_to_free_page callback

    After remove the unique user of sop->bdev_try_to_free_page() callback,
    we could remove the callback and the corresponding blkdev_releasepage()
    at all.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  2. ext4: remove bdev_try_to_free_page() callback

    After we introduce a jbd2 shrinker to release checkpointed buffer's
    journal head, we could free buffer without bdev_try_to_free_page()
    under memory pressure. So this patch remove the whole
    bdev_try_to_free_page() callback directly. It also remove many
    use-after-free issues relate to it together.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  3. jbd2: simplify journal_clean_one_cp_list()

    Now that __try_to_free_cp_buf() remove checkpointed buffer or transaction
    when the buffer is not 'busy', which is only called by
    journal_clean_one_cp_list(). This patch simplify this function by remove
    __try_to_free_cp_buf() and invoke __cp_buffer_busy() directly.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  4. jbd2,ext4: add a shrinker to release checkpointed buffers

    Current metadata buffer release logic in bdev_try_to_free_page() have
    a lot of use-after-free issues when umount filesystem concurrently, and
    it is difficult to fix directly because ext4 is the only user of
    s_op->bdev_try_to_free_page callback and we may have to add more special
    refcount or lock that is only used by ext4 into the common vfs layer,
    which is unacceptable.
    
    One better solution is remove the bdev_try_to_free_page callback, but
    the real problem is we cannot easily release journal_head on the
    checkpointed buffer, so try_to_free_buffers() cannot release buffers and
    page under memory pressure, which is more likely to trigger
    out-of-memory. So we cannot remove the callback directly before we find
    another way to release journal_head.
    
    This patch introduce a shrinker to free journal_head on the checkpointed
    transaction. After the journal_head got freed, try_to_free_buffers()
    could free buffer properly.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Suggested-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  5. jbd2: remove redundant buffer io error checks

    Now that __jbd2_journal_remove_checkpoint() can detect buffer io error
    and mark journal checkpoint error, then we abort the journal later
    before updating log tail to ensure the filesystem works consistently.
    So we could remove other redundant buffer io error checkes.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  6. jbd2: don't abort the journal when freeing buffers

    Now that we can be sure the journal is aborted once a buffer has failed
    to be written back to disk, we can remove the journal abort logic in
    jbd2_journal_try_to_free_buffers() which was introduced in
    commit c044f3d ("jbd2: abort journal if free a async write error
    metadata buffer"), because it may cost and propably is not safe.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  7. jbd2: ensure abort the journal if detect IO error when writing origin…

    …al buffer back
    
    Although we merged c044f3d ("jbd2: abort journal if free a async
    write error metadata buffer"), there is a race between
    jbd2_journal_try_to_free_buffers() and jbd2_journal_destroy(), so the
    jbd2_log_do_checkpoint() may still fail to detect the buffer write
    io error flag which may lead to filesystem inconsistency.
    
    jbd2_journal_try_to_free_buffers()     ext4_put_super()
                                            jbd2_journal_destroy()
      __jbd2_journal_remove_checkpoint()
      detect buffer write error              jbd2_log_do_checkpoint()
                                             jbd2_cleanup_journal_tail()
                                               <--- lead to inconsistency
      jbd2_journal_abort()
    
    Fix this issue by introducing a new atomic flag which only have one
    JBD2_CHECKPOINT_IO_ERROR bit now, and set it in
    __jbd2_journal_remove_checkpoint() when freeing a checkpoint buffer
    which has write_io_error flag. Then jbd2_journal_destroy() will detect
    this mark and abort the journal to prevent updating log tail.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021
  8. jbd2: remove the out label in __jbd2_journal_remove_checkpoint()

    The 'out' lable just return the 'ret' value and seems not required, so
    remove this label and switch to return appropriate value immediately.
    This patch also do some minor cleanup, no logical change.
    
    Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    zhangyi089 authored and intel-lab-lkp committed Jun 16, 2021

Commits on Jun 3, 2021

  1. kprobes: Do not increment probe miss count in the fault handler

    Kprobes has a counter 'nmissed', that is used to count the number of
    times a probe handler was not called. This generally happens when we hit
    a kprobe while handling another kprobe.
    
    However, if one of the probe handlers causes a fault, we are currently
    incrementing 'nmissed'. The comment in fault handler indicates that this
    can be used to account faults taken by the probe handlers. But, this has
    never been the intention as is evident from the comment above 'nmissed'
    in 'struct kprobe':
    
    	/*count the number of times this probe was temporarily disarmed */
    	unsigned long nmissed;
    
    Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Link: https://lkml.kernel.org/r/20210601120150.672652-1-naveen.n.rao@linux.vnet.ibm.com
    rnav authored and Peter Zijlstra committed Jun 3, 2021

Commits on Jun 1, 2021

  1. x86,kprobes: WARN if kprobes tries to handle a fault

    With the removal of kprobe::handle_fault there is no reason left that
    kprobe_page_fault() would ever return true on x86, make sure it
    doesn't happen by accident.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Link: https://lore.kernel.org/r/20210525073213.660594073@infradead.org
    Peter Zijlstra committed Jun 1, 2021
  2. kprobes: Remove kprobe::fault_handler

    The reason for kprobe::fault_handler(), as given by their comment:
    
     * We come here because instructions in the pre/post
     * handler caused the page_fault, this could happen
     * if handler tries to access user space by
     * copy_from_user(), get_user() etc. Let the
     * user-specified handler try to fix it first.
    
    Is just plain bad. Those other handlers are ran from non-preemptible
    context and had better use _nofault() functions. Also, there is no
    upstream usage of this.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Link: https://lore.kernel.org/r/20210525073213.561116662@infradead.org
    Peter Zijlstra committed Jun 1, 2021
  3. uprobes: Update uprobe_write_opcode() kernel-doc comment

    commit 6d43743 ("Uprobe: Additional argument arch_uprobe to
    uprobe_write_opcode()") added the parameter @auprobe.
    
    Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lkml.kernel.org/r/20210524041411.157027-1-hqjagain@gmail.com
    Qiujun Huang authored and Peter Zijlstra committed Jun 1, 2021

Commits on May 27, 2021

  1. perf/hw_breakpoint: Fix DocBook warnings in perf hw_breakpoint

    Fix the following W=1 kernel build warning(s):
    
      kernel/events/hw_breakpoint.c:461: warning: Function parameter or member 'context' not described in 'register_user_hw_breakpoint'
      kernel/events/hw_breakpoint.c:560: warning: Function parameter or member 'context' not described in 'register_wide_hw_breakpoint'
    
    Signed-off-by: Haocheng Xie <xiehaocheng.cn@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20210527031947.1801-4-xiehaocheng.cn@gmail.com
    Haocheng Xie authored and Ingo Molnar committed May 27, 2021
  2. perf/core: Fix DocBook warnings

    Fix the following W=1 kernel build warning(s):
    
      kernel/events/core.c:143: warning: Function parameter or member 'cpu' not described in 'cpu_function_call'
      kernel/events/core.c:11924: warning: Function parameter or member 'flags' not described in 'sys_perf_event_open'
      kernel/events/core.c:12382: warning: Function parameter or member 'overflow_handler' not described in 'perf_event_create_kernel_counter'
      kernel/events/core.c:12382: warning: Function parameter or member 'context' not described in 'perf_event_create_kernel_counter'
    
    Signed-off-by: Haocheng Xie <xiehaocheng.cn@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20210527031947.1801-3-xiehaocheng.cn@gmail.com
    Haocheng Xie authored and Ingo Molnar committed May 27, 2021
  3. perf/core: Make local function perf_pmu_snapshot_aux() static

    Fixes the following W=1 kernel build warning:
    
      kernel/events/core.c:6670:6: warning: no previous prototype for 'perf_pmu_snapshot_aux' [-Wmissing-prototypes]
    
    Signed-off-by: Haocheng Xie <xiehaocheng.cn@gmail.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20210527031947.1801-2-xiehaocheng.cn@gmail.com
    Haocheng Xie authored and Ingo Molnar committed May 27, 2021

Commits on May 18, 2021

  1. perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on ICX

    This patch enables I/O stacks to IIO PMON mapping on Icelake server.
    
    Mapping of IDs in SAD_CONTROL_CFG notation to IDs in PMON notation for
    Icelake server:
    
    Stack Name         | CBDMA/DMI | PCIe_1 | PCIe_2 | PCIe_3 | PCIe_4 | PCIe_5
    SAD_CONTROL_CFG ID |     0     |    1   |    2   |    3   |    4   |    5
    PMON ID            |     5     |    0   |    1   |    2   |    3   |    4
    
    I/O stacks to IIO PMON mapping is exposed through attributes
    /sys/devices/uncore_iio_<pmu_idx>/dieX, where dieX is file which holds
    "Segment:Root Bus" for PCIe root port which can be monitored by that
    IIO PMON block. Example for 2-S Icelake server:
    
    ==> /sys/devices/uncore_iio_0/die0 <==
    0000:16
    ==> /sys/devices/uncore_iio_0/die1 <==
    0000:97
    ==> /sys/devices/uncore_iio_1/die0 <==
    0000:30
    ==> /sys/devices/uncore_iio_1/die1 <==
    0000:b0
    ==> /sys/devices/uncore_iio_3/die0 <==
    0000:4a
    ==> /sys/devices/uncore_iio_3/die1 <==
    0000:c9
    ==> /sys/devices/uncore_iio_4/die0 <==
    0000:64
    ==> /sys/devices/uncore_iio_4/die1 <==
    0000:e2
    ==> /sys/devices/uncore_iio_5/die0 <==
    0000:00
    ==> /sys/devices/uncore_iio_5/die1 <==
    0000:80
    
    Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
    Link: https://lkml.kernel.org/r/20210426131614.16205-4-alexander.antonov@linux.intel.com
    Alexander Antonov authored and Peter Zijlstra committed May 18, 2021
  2. perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on SNR

    I/O stacks to PMON mapping on Skylake server relies on topology information
    from CPU_BUS_NO MSR but this approach is not applicable for SNR and ICX.
    Mapping on these platforms can be gotten by reading SAD_CONTROL_CFG CSR
    from Mesh2IIO device with 0x09a2 DID.
    SAD_CONTROL_CFG CSR contains stack IDs in its own notation which are
    statically mapped on IDs in PMON notation.
    
    The map for Snowridge:
    
    Stack Name         | CBDMA/DMI | PCIe Gen 3 | DLB | NIS | QAT
    SAD_CONTROL_CFG ID |     0     |      1     |  2  |  3  |  4
    PMON ID            |     1     |      4     |  3  |  2  |  0
    
    This patch enables I/O stacks to IIO PMON mapping on Snowridge.
    Mapping is exposed through attributes /sys/devices/uncore_iio_<pmu_idx>/dieX,
    where dieX is file which holds "Segment:Root Bus" for PCIe root port which
    can be monitored by that IIO PMON block. Example for Snowridge:
    
    ==> /sys/devices/uncore_iio_0/die0 <==
    0000:f3
    ==> /sys/devices/uncore_iio_1/die0 <==
    0000:00
    ==> /sys/devices/uncore_iio_2/die0 <==
    0000:eb
    ==> /sys/devices/uncore_iio_3/die0 <==
    0000:e3
    ==> /sys/devices/uncore_iio_4/die0 <==
    0000:14
    
    Mapping for Icelake server will be enabled in the follow-up patch.
    
    Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
    Link: https://lkml.kernel.org/r/20210426131614.16205-3-alexander.antonov@linux.intel.com
    Alexander Antonov authored and Peter Zijlstra committed May 18, 2021
  3. perf/x86/intel/uncore: Generalize I/O stacks to PMON mapping procedure

    Currently I/O stacks to IIO PMON mapping is available on Skylake servers
    only and need to make code more general to easily enable further platforms.
    So, introduce get_topology() callback in struct intel_uncore_type which
    allows to move common code to separate function and make mapping procedure
    more general.
    
    Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
    Link: https://lkml.kernel.org/r/20210426131614.16205-2-alexander.antonov@linux.intel.com
    Alexander Antonov authored and Peter Zijlstra committed May 18, 2021

Commits on May 12, 2021

  1. perf/x86/intel/uncore: Drop unnecessary NULL checks after container_of()

    The parameter passed to the pmu_enable() and pmu_disable() functions can not be
    NULL because it is dereferenced by the caller.
    
    That means the result of container_of() on that parameter can also never be NULL.
    The existing NULL checks are therefore unnecessary and misleading. Remove them.
    
    This change was made automatically with the following Coccinelle script.
    
      @@
      type t;
      identifier v;
      statement s;
      @@
    
      <+...
      (
        t v = container_of(...);
      |
        v = container_of(...);
      )
        ...
        when != v
      - if (\( !v \| v == NULL \) ) s
      ...+>
    
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20210510224849.2349861-1-linux@roeck-us.net
    groeck authored and Ingo Molnar committed May 12, 2021

Commits on May 11, 2021

  1. Merge tag 'for-5.13-rc1-part2-tag' of git://git.kernel.org/pub/scm/li…

    …nux/kernel/git/kdave/linux
    
    Pull btrfs fix from David Sterba:
     "Handle transaction start error in btrfs_fileattr_set()
    
      This is fix for code introduced by the new fileattr merge"
    
    * tag 'for-5.13-rc1-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
      btrfs: handle transaction start error in btrfs_fileattr_set
    torvalds committed May 11, 2021
  2. btrfs: handle transaction start error in btrfs_fileattr_set

    Add error handling in btrfs_fileattr_set in case of an error while
    starting a transaction. This fixes btrfs/232 which otherwise used to
    fail with below signature on Power.
    
      btrfs/232 [ 1119.474650] run fstests btrfs/232 at 2021-04-21 02:21:22
      <...>
      [ 1366.638585] BUG: Unable to handle kernel data access on read at 0xffffffffffffff86
      [ 1366.638768] Faulting instruction address: 0xc0000000009a5c88
      cpu 0x0: Vector: 380 (Data SLB Access) at [c000000014f177b0]
          pc: c0000000009a5c88: btrfs_update_root_times+0x58/0xc0
          lr: c0000000009a5c84: btrfs_update_root_times+0x54/0xc0
          <...>
          pid   = 24881, comm = fsstress
    	   btrfs_update_inode+0xa0/0x140
    	   btrfs_fileattr_set+0x5d0/0x6f0
    	   vfs_fileattr_set+0x2a8/0x390
    	   do_vfs_ioctl+0x1290/0x1ac0
    	   sys_ioctl+0x6c/0x120
    	   system_call_exception+0x3d4/0x410
    	   system_call_common+0xec/0x278
    
    Fixes: 97fc297 ("btrfs: convert to fileattr")
    Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    riteshharjani authored and kdave committed May 11, 2021

Commits on May 10, 2021

  1. 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
    torvalds committed May 10, 2021
  2. Merge tag 'for-5.13-rc1-tag' of git://git.kernel.org/pub/scm/linux/ke…

    …rnel/git/kdave/linux
    
    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
    torvalds committed May 10, 2021
  3. Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

    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
      ...
    torvalds committed May 10, 2021
  4. tools headers UAPI: Sync perf_event.h with the kernel sources

    To pick up the changes in:
    
      2b26f0a ("perf: Support only inheriting events if cloned with CLONE_THREAD")
      2e498d0 ("perf: Add support for event removal on exec")
      547b609 ("perf: aux: Add flags for the buffer format")
      55bcf6e ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE")
      7dde517 ("perf: aux: Add CoreSight PMU buffer formats")
      97ba62b ("perf: Add support for SIGTRAP on perf events")
      d0d1dd6 ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  5. tools headers cpufeatures: Sync with the kernel sources

    To pick the changes from:
    
      4e62921 ("x86/paravirt: Add new features for paravirt patching")
      a161545 ("x86/cpufeatures: Enumerate Intel Hybrid Technology feature bit")
      a89dfde ("x86: Remove dynamic NOP selection")
      b8921dc ("x86/cpufeatures: Add SGX1 and SGX2 sub-features")
      f21d4d3 ("x86/cpufeatures: Enumerate #DB for bus lock detection")
      f333374 ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  6. tools include UAPI powerpc: Sync errno.h with the kernel headers

    To pick the change in:
    
      7de21e6 ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  7. tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'per…

    …f bench mem memcpy'
    
    To bring in the change made in this cset:
    
     5e21a3e ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  8. tools headers UAPI: Sync linux/prctl.h with the kernel sources

    To pick a new prctl introduced in:
    
      2016986 ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  9. tools headers UAPI: Sync files changed by landlock, quotactl_path and…

    … mount_settattr new syscalls
    
    To pick the changes in these csets:
    
      a49f4f8 ("arch: Wire up Landlock syscalls")
      2a18672 ("fs: add mount_setattr()")
      fa8b900 ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  10. perf tools: Fix a build error on arm64 with clang

    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: Masami 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@devnote2
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    mhiramat authored and Arnaldo Carvalho de Melo committed May 10, 2021
  11. tools headers kvm: Sync kvm headers with the kernel sources

    To pick the changes in:
    
      3c0c2ad ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  12. tools headers UAPI: Sync linux/kvm.h with the kernel sources

    To pick the changes in:
    
      15fb7de ("KVM: SVM: Add KVM_SEV_RECEIVE_UPDATE_DATA command")
      3bf7256 ("KVM: arm64: Add support for the KVM PTP service")
      4cfdd47 ("KVM: SVM: Add KVM_SEV SEND_START command")
      54526d1 ("KVM: x86: Support KVM VMs sharing SEV context")
      5569e2e ("KVM: SVM: Add support for KVM_SEV_SEND_CANCEL command")
      8b13c36 ("KVM: introduce KVM_CAP_SET_GUEST_DEBUG2")
      af43cbb ("KVM: SVM: Add support for KVM_SEV_RECEIVE_START command")
      d3d1af8 ("KVM: SVM: Add KVM_SEND_UPDATE_DATA command")
      fe7e948 ("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: Arnaldo Carvalho de Melo <acme@redhat.com>
    Arnaldo Carvalho de Melo committed May 10, 2021
  13. perf tools: Fix dynamic libbpf link

    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: eee1950 ("perf tools: Grab a copy of libbpf's hashmap")
    Reported-by: Justin M. Forbes <jforbes@redhat.com>
    Signed-off-by: Jiri 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.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    olsajiri authored and Arnaldo Carvalho de Melo committed May 10, 2021
  14. perf session: Fix swapping of cpu_map and stat_config records

    '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: Dmitry Koshelev <karaghiozis@gmail.com>
    Acked-by: Jiri 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.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    dmitry-koshelev authored and Arnaldo Carvalho de Melo committed May 10, 2021
Older