1. 20 7月, 2022 1 次提交
    • F
      tools: Fixed MIPS builds due to struct flock re-definition · 9b31e608
      Florian Fainelli 提交于
      Building perf for MIPS failed after 9f79b8b7 ("uapi: simplify
      __ARCH_FLOCK{,64}_PAD a little") with the following error:
      
        CC
      /home/fainelli/work/buildroot/output/bmips/build/linux-custom/tools/perf/trace/beauty/fcntl.o
      In file included from
      ../../../../host/mipsel-buildroot-linux-gnu/sysroot/usr/include/asm/fcntl.h:77,
                       from ../include/uapi/linux/fcntl.h:5,
                       from trace/beauty/fcntl.c:10:
      ../include/uapi/asm-generic/fcntl.h:188:8: error: redefinition of
      'struct flock'
       struct flock {
              ^~~~~
      In file included from ../include/uapi/linux/fcntl.h:5,
                       from trace/beauty/fcntl.c:10:
      ../../../../host/mipsel-buildroot-linux-gnu/sysroot/usr/include/asm/fcntl.h:63:8:
      note: originally defined here
       struct flock {
              ^~~~~
      
      This is due to the local copy under
      tools/include/uapi/asm-generic/fcntl.h including the toolchain's kernel
      headers which already define 'struct flock' and define
      HAVE_ARCH_STRUCT_FLOCK to future inclusions make a decision as to
      whether re-defining 'struct flock' is appropriate or not.
      
      Make sure what do not re-define 'struct flock'
      when HAVE_ARCH_STRUCT_FLOCK is already defined.
      
      Fixes: 9f79b8b7 ("uapi: simplify __ARCH_FLOCK{,64}_PAD a little")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      [arnd: sync with include/uapi/asm-generic/fcntl.h as well]
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      9b31e608
  2. 19 7月, 2022 1 次提交
  3. 17 7月, 2022 1 次提交
    • A
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · eee51fe3
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        1b870fa5 ("kvm: stats: tell userspace which values are boolean")
      
      That just rebuilds perf, as these patches don't add any new KVM ioctl to
      be harvested for the the 'perf trace' ioctl syscall argument
      beautifiers.
      
      This is also by now used by tools/testing/selftests/kvm/, a simple test
      build succeeded.
      
      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: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/YtQLDvQrBhJNl3n5@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      eee51fe3
  4. 08 7月, 2022 2 次提交
  5. 29 6月, 2022 2 次提交
    • G
      treewide: uapi: Replace zero-length arrays with flexible-array members · 94dfc73e
      Gustavo A. R. Silva 提交于
      There is a regular need in the kernel to provide a way to declare
      having a dynamically sized set of trailing elements in a structure.
      Kernel code should always use “flexible array members”[1] for these
      cases. The older style of one-element or zero-length arrays should
      no longer be used[2].
      
      This code was transformed with the help of Coccinelle:
      (linux-5.19-rc2$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch)
      
      @@
      identifier S, member, array;
      type T1, T2;
      @@
      
      struct S {
        ...
        T1 member;
        T2 array[
      - 0
        ];
      };
      
      -fstrict-flex-arrays=3 is coming and we need to land these changes
      to prevent issues like these in the short future:
      
      ../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,
      but the source string has length 2 (including NUL byte) [-Wfortify-source]
      		strcpy(de3->name, ".");
      		^
      
      Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If
      this breaks anything, we can use a union with a new member name.
      
      [1] https://en.wikipedia.org/wiki/Flexible_array_member
      [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
      
      Link: https://github.com/KSPP/linux/issues/78Build-tested-by: Nkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/lkml/62b675ec.wKX6AOZ6cbE71vtF%25lkp@intel.com/
      Acked-by: Dan Williams <dan.j.williams@intel.com> # For ndctl.h
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      94dfc73e
    • A
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · 7fe718fb
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        bfbab445 ("KVM: arm64: Implement PSCI SYSTEM_SUSPEND")
        7b33a09d ("KVM: arm64: Add support for userspace to suspend a vCPU")
        ffbb61d0 ("KVM: x86: Accept KVM_[GS]ET_TSC_KHZ as a VM ioctl.")
        661a20fa ("KVM: x86/xen: Advertise and document KVM_XEN_HVM_CONFIG_EVTCHN_SEND")
        fde0451b ("KVM: x86/xen: Support per-vCPU event channel upcall via local APIC")
        28d1629f ("KVM: x86/xen: Kernel acceleration for XENVER_version")
        53639526 ("KVM: x86/xen: handle PV timers oneshot mode")
        942c2490 ("KVM: x86/xen: Add KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID")
        2fd6df2f ("KVM: x86/xen: intercept EVTCHNOP_send from guests")
        35025735 ("KVM: x86/xen: Support direct injection of event channel events")
      
      That automatically adds support for this new ioctl:
      
        $ 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
        --- before	2022-06-28 12:13:07.281150509 -0300
        +++ after	2022-06-28 12:13:16.423392896 -0300
        @@ -98,6 +98,7 @@
         	[0xcc] = "GET_SREGS2",
         	[0xcd] = "SET_SREGS2",
         	[0xce] = "GET_STATS_FD",
        +	[0xd0] = "XEN_HVM_EVTCHN_SEND",
         	[0xe0] = "CREATE_DEVICE",
         	[0xe1] = "SET_DEVICE_ATTR",
         	[0xe2] = "GET_DEVICE_ATTR",
        $
      
      This silences these 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: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Woodhouse <dwmw@amazon.co.uk>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joao Martins <joao.m.martins@oracle.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/Yrs4RE+qfgTaWdAt@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7fe718fb
  6. 27 6月, 2022 2 次提交
  7. 26 6月, 2022 2 次提交
    • A
      tools include UAPI: Sync linux/vhost.h with the kernel sources · e2213a2d
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        84d7c8fd ("vhost-vdpa: introduce uAPI to set group ASID")
        2d1fcb77 ("vhost-vdpa: uAPI to get virtqueue group id")
        a0c95f20 ("vhost-vdpa: introduce uAPI to get the number of address spaces")
        3ace88bd ("vhost-vdpa: introduce uAPI to get the number of virtqueue groups")
        175d493c ("vhost: move the backend feature bits to vhost_types.h")
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
        diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
      
      To pick up these changes and support them:
      
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before
        $ cp include/uapi/linux/vhost.h tools/include/uapi/linux/vhost.h
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after
        $ diff -u before after
        --- before	2022-06-26 12:04:35.982003781 -0300
        +++ after	2022-06-26 12:04:43.819972476 -0300
        @@ -28,6 +28,7 @@
         	[0x74] = "VDPA_SET_CONFIG",
         	[0x75] = "VDPA_SET_VRING_ENABLE",
         	[0x77] = "VDPA_SET_CONFIG_CALL",
        +	[0x7C] = "VDPA_SET_GROUP_ASID",
         };
         static const char *vhost_virtio_ioctl_read_cmds[] = {
         	[0x00] = "GET_FEATURES",
        @@ -39,5 +40,8 @@
         	[0x76] = "VDPA_GET_VRING_NUM",
         	[0x78] = "VDPA_GET_IOVA_RANGE",
         	[0x79] = "VDPA_GET_CONFIG_SIZE",
        +	[0x7A] = "VDPA_GET_AS_NUM",
        +	[0x7B] = "VDPA_GET_VRING_GROUP",
         	[0x80] = "VDPA_GET_VQS_COUNT",
        +	[0x81] = "VDPA_GET_GROUP_NUM",
         };
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Gautam Dawar <gautam.dawar@xilinx.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/Yrh3xMYbfeAD0MFL@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e2213a2d
    • A
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · 0fdd435c
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        ecf8eca5 ("drm/i915/xehp: Add compute engine ABI")
        991b4de3 ("drm/i915/uapi: Add kerneldoc for engine class enum")
        c94fde8f ("drm/i915/uapi: Add DRM_I915_QUERY_GEOMETRY_SUBSLICES")
        1c671ad7 ("drm/i915/doc: Link query items to their uapi structs")
        a2e54026 ("drm/i915/doc: Convert perf UAPI comments to kerneldoc")
        462ac1cd ("drm/i915/doc: Convert drm_i915_query_topology_info comment to kerneldoc")
        034d47b2 ("drm/i915/uapi: Document DRM_I915_QUERY_HWCONFIG_BLOB")
        78e1fb31 ("drm/i915/uapi: Add query for hwconfig blob")
      
      That don't add any new ioctl, so no changes in tooling.
      
      This 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: John Harrison <John.C.Harrison@intel.com>
      Cc: Matt Atwood <matthew.s.atwood@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
      Link: http://lore.kernel.org/lkml/YrDi4ALYjv9Mdocq@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0fdd435c
  8. 21 6月, 2022 5 次提交
  9. 19 6月, 2022 1 次提交
  10. 07 6月, 2022 1 次提交
    • J
      x86/ftrace: Remove OBJECT_FILES_NON_STANDARD usage · 7b6c7a87
      Josh Poimboeuf 提交于
      The file-wide OBJECT_FILES_NON_STANDARD annotation is used with
      CONFIG_FRAME_POINTER to tell objtool to skip the entire file when frame
      pointers are enabled.  However that annotation is now deprecated because
      it doesn't work with IBT, where objtool runs on vmlinux.o instead of
      individual translation units.
      
      Instead, use more fine-grained function-specific annotations:
      
      - The 'save_mcount_regs' macro does funny things with the frame pointer.
        Use STACK_FRAME_NON_STANDARD_FP to tell objtool to ignore the
        functions using it.
      
      - The return_to_handler() "function" isn't actually a callable function.
        Instead of being called, it's returned to.  The real return address
        isn't on the stack, so unwinding is already doomed no matter which
        unwinder is used.  So just remove the STT_FUNC annotation, telling
        objtool to ignore it.  That also removes the implicit
        ANNOTATE_NOENDBR, which now needs to be made explicit.
      
      Fixes the following warning:
      
        vmlinux.o: warning: objtool: __fentry__+0x16: return with modified stack frame
      
      Fixes: ed53a0d9 ("x86/alternative: Use .ibt_endbr_seal to seal indirect calls")
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@kernel.org>
      Link: https://lore.kernel.org/r/b7a7a42fe306aca37826043dac89e113a1acdbac.1654268610.git.jpoimboe@kernel.org
      7b6c7a87
  11. 03 6月, 2022 2 次提交
  12. 24 5月, 2022 5 次提交
  13. 21 5月, 2022 1 次提交
  14. 16 5月, 2022 1 次提交
  15. 12 5月, 2022 1 次提交
  16. 11 5月, 2022 3 次提交
  17. 09 5月, 2022 1 次提交
    • A
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · 474e76c4
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        d495f942 ("KVM: fix bad user ABI for KVM_EXIT_SYSTEM_EVENT")
      
      That just rebuilds perf, as these patches don't add any new KVM ioctl to
      be harvested for the the 'perf trace' ioctl syscall argument
      beautifiers.
      
      This is also by now used by tools/testing/selftests/kvm/, a simple test
      build succeeded.
      
      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: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/YnE5BIweGmCkpOTN@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      474e76c4
  18. 07 5月, 2022 1 次提交
  19. 04 5月, 2022 1 次提交
  20. 29 4月, 2022 1 次提交
  21. 27 4月, 2022 3 次提交
  22. 26 4月, 2022 1 次提交
    • K
      bpf: Allow storing referenced kptr in map · c0a5a21c
      Kumar Kartikeya Dwivedi 提交于
      Extending the code in previous commits, introduce referenced kptr
      support, which needs to be tagged using 'kptr_ref' tag instead. Unlike
      unreferenced kptr, referenced kptr have a lot more restrictions. In
      addition to the type matching, only a newly introduced bpf_kptr_xchg
      helper is allowed to modify the map value at that offset. This transfers
      the referenced pointer being stored into the map, releasing the
      references state for the program, and returning the old value and
      creating new reference state for the returned pointer.
      
      Similar to unreferenced pointer case, return value for this case will
      also be PTR_TO_BTF_ID_OR_NULL. The reference for the returned pointer
      must either be eventually released by calling the corresponding release
      function, otherwise it must be transferred into another map.
      
      It is also allowed to call bpf_kptr_xchg with a NULL pointer, to clear
      the value, and obtain the old value if any.
      
      BPF_LDX, BPF_STX, and BPF_ST cannot access referenced kptr. A future
      commit will permit using BPF_LDX for such pointers, but attempt at
      making it safe, since the lifetime of object won't be guaranteed.
      
      There are valid reasons to enforce the restriction of permitting only
      bpf_kptr_xchg to operate on referenced kptr. The pointer value must be
      consistent in face of concurrent modification, and any prior values
      contained in the map must also be released before a new one is moved
      into the map. To ensure proper transfer of this ownership, bpf_kptr_xchg
      returns the old value, which the verifier would require the user to
      either free or move into another map, and releases the reference held
      for the pointer being moved in.
      
      In the future, direct BPF_XCHG instruction may also be permitted to work
      like bpf_kptr_xchg helper.
      
      Note that process_kptr_func doesn't have to call
      check_helper_mem_access, since we already disallow rdonly/wronly flags
      for map, which is what check_map_access_type checks, and we already
      ensure the PTR_TO_MAP_VALUE refers to kptr by obtaining its off_desc,
      so check_map_access is also not required.
      Signed-off-by: NKumar Kartikeya Dwivedi <memxor@gmail.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220424214901.2743946-4-memxor@gmail.com
      c0a5a21c
  23. 23 4月, 2022 1 次提交