1. 10 1月, 2020 1 次提交
  2. 20 12月, 2019 1 次提交
    • A
      bpf: Support replacing cgroup-bpf program in MULTI mode · 7dd68b32
      Andrey Ignatov 提交于
      The common use-case in production is to have multiple cgroup-bpf
      programs per attach type that cover multiple use-cases. Such programs
      are attached with BPF_F_ALLOW_MULTI and can be maintained by different
      people.
      
      Order of programs usually matters, for example imagine two egress
      programs: the first one drops packets and the second one counts packets.
      If they're swapped the result of counting program will be different.
      
      It brings operational challenges with updating cgroup-bpf program(s)
      attached with BPF_F_ALLOW_MULTI since there is no way to replace a
      program:
      
      * One way to update is to detach all programs first and then attach the
        new version(s) again in the right order. This introduces an
        interruption in the work a program is doing and may not be acceptable
        (e.g. if it's egress firewall);
      
      * Another way is attach the new version of a program first and only then
        detach the old version. This introduces the time interval when two
        versions of same program are working, what may not be acceptable if a
        program is not idempotent. It also imposes additional burden on
        program developers to make sure that two versions of their program can
        co-exist.
      
      Solve the problem by introducing a "replace" mode in BPF_PROG_ATTACH
      command for cgroup-bpf programs being attached with BPF_F_ALLOW_MULTI
      flag. This mode is enabled by newly introduced BPF_F_REPLACE attach flag
      and bpf_attr.replace_bpf_fd attribute to pass fd of the old program to
      replace
      
      That way user can replace any program among those attached with
      BPF_F_ALLOW_MULTI flag without the problems described above.
      
      Details of the new API:
      
      * If BPF_F_REPLACE is set but replace_bpf_fd doesn't have valid
        descriptor of BPF program, BPF_PROG_ATTACH will return corresponding
        error (EINVAL or EBADF).
      
      * If replace_bpf_fd has valid descriptor of BPF program but such a
        program is not attached to specified cgroup, BPF_PROG_ATTACH will
        return ENOENT.
      
      BPF_F_REPLACE is introduced to make the user intent clear, since
      replace_bpf_fd alone can't be used for this (its default value, 0, is a
      valid fd). BPF_F_REPLACE also makes it possible to extend the API in the
      future (e.g. add BPF_F_BEFORE and BPF_F_AFTER if needed).
      Signed-off-by: NAndrey Ignatov <rdna@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Acked-by: NAndrii Narkyiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/30cd850044a0057bdfcaaf154b7d2f39850ba813.1576741281.git.rdna@fb.com
      7dd68b32
  3. 16 12月, 2019 1 次提交
    • A
      libbpf: Support libbpf-provided extern variables · 166750bc
      Andrii Nakryiko 提交于
      Add support for extern variables, provided to BPF program by libbpf. Currently
      the following extern variables are supported:
        - LINUX_KERNEL_VERSION; version of a kernel in which BPF program is
          executing, follows KERNEL_VERSION() macro convention, can be 4- and 8-byte
          long;
        - CONFIG_xxx values; a set of values of actual kernel config. Tristate,
          boolean, strings, and integer values are supported.
      
      Set of possible values is determined by declared type of extern variable.
      Supported types of variables are:
      - Tristate values. Are represented as `enum libbpf_tristate`. Accepted values
        are **strictly** 'y', 'n', or 'm', which are represented as TRI_YES, TRI_NO,
        or TRI_MODULE, respectively.
      - Boolean values. Are represented as bool (_Bool) types. Accepted values are
        'y' and 'n' only, turning into true/false values, respectively.
      - Single-character values. Can be used both as a substritute for
        bool/tristate, or as a small-range integer:
        - 'y'/'n'/'m' are represented as is, as characters 'y', 'n', or 'm';
        - integers in a range [-128, 127] or [0, 255] (depending on signedness of
          char in target architecture) are recognized and represented with
          respective values of char type.
      - Strings. String values are declared as fixed-length char arrays. String of
        up to that length will be accepted and put in first N bytes of char array,
        with the rest of bytes zeroed out. If config string value is longer than
        space alloted, it will be truncated and warning message emitted. Char array
        is always zero terminated. String literals in config have to be enclosed in
        double quotes, just like C-style string literals.
      - Integers. 8-, 16-, 32-, and 64-bit integers are supported, both signed and
        unsigned variants. Libbpf enforces parsed config value to be in the
        supported range of corresponding integer type. Integers values in config can
        be:
        - decimal integers, with optional + and - signs;
        - hexadecimal integers, prefixed with 0x or 0X;
        - octal integers, starting with 0.
      
      Config file itself is searched in /boot/config-$(uname -r) location with
      fallback to /proc/config.gz, unless config path is specified explicitly
      through bpf_object_open_opts' kernel_config_path option. Both gzipped and
      plain text formats are supported. Libbpf adds explicit dependency on zlib
      because of this, but this shouldn't be a problem, given libelf already depends
      on zlib.
      
      All detected extern variables, are put into a separate .extern internal map.
      It, similarly to .rodata map, is marked as read-only from BPF program side, as
      well as is frozen on load. This allows BPF verifier to track extern values as
      constants and perform enhanced branch prediction and dead code elimination.
      This can be relied upon for doing kernel version/feature detection and using
      potentially unsupported field relocations or BPF helpers in a CO-RE-based BPF
      program, while still having a single version of BPF program running on old and
      new kernels. Selftests are validating this explicitly for unexisting BPF
      helper.
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20191214014710.3449601-3-andriin@fb.com
      166750bc
  4. 11 12月, 2019 1 次提交
    • A
      tools headers kvm: Sync linux/kvm.h with the kernel sources · b4442688
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes from:
      
        22945688 ("KVM: PPC: Book3S HV: Support reset of secure guest")
      
      No tools changes are caused by this, as the only defines so far used
      from these files are for syscall arg pretty printing are:
      
        $ grep KVM tools/perf/trace/beauty/*.sh
        tools/perf/trace/beauty/kvm_ioctl.sh:regex='^#[[:space:]]*define[[:space:]]+KVM_(\w+)[[:space:]]+_IO[RW]*\([[:space:]]*KVMIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
        $
      
      This addresses these tools/perf build warnings:
      
        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: Bharata B Rao <bharata@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Link: https://lkml.kernel.org/n/tip-bdbe4x02johhul05a03o27zj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b4442688
  5. 02 12月, 2019 4 次提交
    • A
      tools headers UAPI: Sync sched.h with the kernel · 2603a490
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        0acefef5 ("Merge tag 'threads-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux")
        49cb2fc4 ("fork: extend clone3() to support setting a PID")
        fa729c4d ("clone3: validate stack arguments")
        b612e5df ("clone3: add CLONE_CLEAR_SIGHAND")
      
      This file gets rebuilt, but no changes ensues:
      
         CC       /tmp/build/perf/trace/beauty/clone.o
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
        diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.
      
      The CLONE_CLEAR_SIGHAND one will be used in tools/perf/trace/beauty/clone.c
      in a followup patch to show that string when this bit is set in the
      syscall arg. Keeping a copy of this file allows us to build this in
      older systems and have the binary support printing that flag whenever
      that system gets its kernel updated to one where this feature is
      present.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Adrian Reber <areber@redhat.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-nprqsvvzbhzoy64cbvos6c5b@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2603a490
    • A
      tools headers kvm: Sync kvm headers with the kernel sources · 1fc3d0ee
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes from:
      
        14edff88 Merge tag 'kvmarm-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
        a4b28f5c Merge remote-tracking branch 'kvmarm/kvm-arm64/stolen-time' into kvmarm-master/next
        58772e9a ("KVM: arm64: Provide VCPU attributes for stolen time")
        da345174 ("KVM: arm/arm64: Allow user injection of external data aborts")
        c726200d ("KVM: arm/arm64: Allow reporting non-ISV data aborts to userspace")
        efe5ddca ("KVM: PPC: Book3S HV: XIVE: Allow userspace to set the # of VPs")
      
      No tools changes are caused by this, as the only defines so far used
      from these files are for syscall arg pretty printing are:
      
        $ grep KVM tools/perf/trace/beauty/*.sh
        tools/perf/trace/beauty/kvm_ioctl.sh:regex='^#[[:space:]]*define[[:space:]]+KVM_(\w+)[[:space:]]+_IO[RW]*\([[:space:]]*KVMIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*'
        $
      
      Some are also include by:
      
        tools/perf/arch/x86/util/kvm-stat.c
        tools/perf/arch/powerpc/util/kvm-stat.c
      
      This addresses these tools/perf build warnings:
      
        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
        Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/kvm.h' differs from latest version at 'arch/powerpc/include/uapi/asm/kvm.h'
        diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/arm/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm/include/uapi/asm/kvm.h arch/arm/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christoffer Dall <christoffer.dall@arm.com>
      Cc: Fabiano Rosas <farosas@linux.ibm.com>
      Cc: Greg Kurz <groug@kaod.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Steven Price <steven.price@arm.com>
      Link: https://lkml.kernel.org/n/tip-qrjdudhq25mk5bfnhveofbm4@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1fc3d0ee
    • A
      tools headers uapi: Sync linux/stat.h with the kernel sources · c66f2566
      Arnaldo Carvalho de Melo 提交于
      To pick the changes from:
      
        3ad2522c ("statx: define STATX_ATTR_VERITY")
      
      That don't trigger any changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/stat.h' differs from latest version at 'include/uapi/linux/stat.h'
        diff -u tools/include/uapi/linux/stat.h include/uapi/linux/stat.h
      
      At some point we wi'll beautify structs passed in pointers to syscalls
      and then we'll need to have tables for these defines, for now update the
      file to silence the warning as this file is used for doing this type of
      number -> string translations for other defines found in these file.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-thcy60dpry5qrpn7nmc58bwg@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c66f2566
    • A
      tools headers uapi: Sync linux/fscrypt.h with the kernel sources · ad46f35c
      Arnaldo Carvalho de Melo 提交于
      To pick the changes from:
      
        b103fb76 ("fscrypt: add support for IV_INO_LBLK_64 policies")
      
      That don't trigger any changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fscrypt.h' differs from latest version at 'include/uapi/linux/fscrypt.h'
        diff -u tools/include/uapi/linux/fscrypt.h include/uapi/linux/fscrypt.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-cgfz3ffe07pw2m8hmstvkudl@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ad46f35c
  6. 21 11月, 2019 1 次提交
  7. 18 11月, 2019 1 次提交
    • A
      bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY · fc970227
      Andrii Nakryiko 提交于
      Add ability to memory-map contents of BPF array map. This is extremely useful
      for working with BPF global data from userspace programs. It allows to avoid
      typical bpf_map_{lookup,update}_elem operations, improving both performance
      and usability.
      
      There had to be special considerations for map freezing, to avoid having
      writable memory view into a frozen map. To solve this issue, map freezing and
      mmap-ing is happening under mutex now:
        - if map is already frozen, no writable mapping is allowed;
        - if map has writable memory mappings active (accounted in map->writecnt),
          map freezing will keep failing with -EBUSY;
        - once number of writable memory mappings drops to zero, map freezing can be
          performed again.
      
      Only non-per-CPU plain arrays are supported right now. Maps with spinlocks
      can't be memory mapped either.
      
      For BPF_F_MMAPABLE array, memory allocation has to be done through vmalloc()
      to be mmap()'able. We also need to make sure that array data memory is
      page-sized and page-aligned, so we over-allocate memory in such a way that
      struct bpf_array is at the end of a single page of memory with array->value
      being aligned with the start of the second page. On deallocation we need to
      accomodate this memory arrangement to free vmalloc()'ed memory correctly.
      
      One important consideration regarding how memory-mapping subsystem functions.
      Memory-mapping subsystem provides few optional callbacks, among them open()
      and close().  close() is called for each memory region that is unmapped, so
      that users can decrease their reference counters and free up resources, if
      necessary. open() is *almost* symmetrical: it's called for each memory region
      that is being mapped, **except** the very first one. So bpf_map_mmap does
      initial refcnt bump, while open() will do any extra ones after that. Thus
      number of close() calls is equal to number of open() calls plus one more.
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Link: https://lore.kernel.org/bpf/20191117172806.2195367-4-andriin@fb.com
      fc970227
  8. 16 11月, 2019 2 次提交
  9. 03 11月, 2019 1 次提交
    • D
      bpf: Add probe_read_{user, kernel} and probe_read_{user, kernel}_str helpers · 6ae08ae3
      Daniel Borkmann 提交于
      The current bpf_probe_read() and bpf_probe_read_str() helpers are broken
      in that they assume they can be used for probing memory access for kernel
      space addresses /as well as/ user space addresses.
      
      However, plain use of probe_kernel_read() for both cases will attempt to
      always access kernel space address space given access is performed under
      KERNEL_DS and some archs in-fact have overlapping address spaces where a
      kernel pointer and user pointer would have the /same/ address value and
      therefore accessing application memory via bpf_probe_read{,_str}() would
      read garbage values.
      
      Lets fix BPF side by making use of recently added 3d708182 ("uaccess:
      Add non-pagefault user-space read functions"). Unfortunately, the only way
      to fix this status quo is to add dedicated bpf_probe_read_{user,kernel}()
      and bpf_probe_read_{user,kernel}_str() helpers. The bpf_probe_read{,_str}()
      helpers are kept as-is to retain their current behavior.
      
      The two *_user() variants attempt the access always under USER_DS set, the
      two *_kernel() variants will -EFAULT when accessing user memory if the
      underlying architecture has non-overlapping address ranges, also avoiding
      throwing the kernel warning via 00c42373 ("x86-64: add warning for
      non-canonical user access address dereferences").
      
      Fixes: a5e8c070 ("bpf: add bpf_probe_read_str helper")
      Fixes: 2541517c ("tracing, perf: Implement BPF programs attached to kprobes")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/796ee46e948bc808d54891a1108435f8652c6ca4.1572649915.git.daniel@iogearbox.net
      6ae08ae3
  10. 31 10月, 2019 1 次提交
  11. 26 10月, 2019 1 次提交
  12. 21 10月, 2019 1 次提交
  13. 17 10月, 2019 2 次提交
  14. 15 10月, 2019 2 次提交
    • A
      tools headers UAPI: Sync sched.h with the kernel · 5eca1379
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        78f6face ("sched: add kernel-doc for struct clone_args")
        f14c234b ("clone3: switch to copy_struct_from_user()")
      
      This file gets rebuilt, but no changes ensues:
      
         CC       /tmp/build/perf/trace/beauty/clone.o
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
        diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Aleksa Sarai <cyphar@cyphar.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-xqruu8wohwlbc57udg1g0xzx@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5eca1379
    • A
      tools headers kvm: Sync kvm.h headers with the kernel sources · 8daf1fb7
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        344c6c80 ("KVM/Hyper-V: Add new KVM capability KVM_CAP_HYPERV_DIRECT_TLBFLUSH")
        dee04eee ("KVM: RISC-V: Add KVM_REG_RISCV for ONE_REG interface")
      
      These trigger the rebuild of this object:
      
        CC       /tmp/build/perf/trace/beauty/ioctl.o
      
      But do not result in any change in tooling, as the additions are not
      being used in any table generatator.
      
      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: Anup Patel <Anup.Patel@wdc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Tianyu Lan <Tianyu.Lan@microsoft.com>
      Link: https://lkml.kernel.org/n/tip-d1v48a0qfoe98u5v9tn3mu5u@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8daf1fb7
  15. 07 10月, 2019 1 次提交
  16. 01 10月, 2019 3 次提交
    • A
      tools headers kvm: Sync kvm headers with the kernel sources · b7ad6108
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        200824f5 ("KVM: s390: Disallow invalid bits in kvm_valid_regs and kvm_dirty_regs")
        4a53d99d ("KVM: VMX: Introduce exit reason for receiving INIT signal on guest-mode")
        7396d337 ("KVM: x86: Return to userspace with internal error on unexpected exit reason")
        92f35b75 ("KVM: arm/arm64: vgic: Allow more than 256 vcpus for KVM_IRQ_LINE")
      
      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/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
        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
        Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h'
        diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/arm/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm/include/uapi/asm/kvm.h arch/arm/include/uapi/asm/kvm.h
        Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Liran Alon <liran.alon@oracle.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Thomas Huth <thuth@redhat.com>
      Link: https://lkml.kernel.org/n/tip-akuugvvjxte26kzv23zp5d2z@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b7ad6108
    • A
      tools headers uapi: Sync linux/fs.h with the kernel sources · 0ae40612
      Arnaldo Carvalho de Melo 提交于
      To pick the changes from:
      
        78a1b96b ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS ioctl")
        23c688b5 ("fscrypt: allow unprivileged users to add/remove keys for v2 policies")
        5dae460c ("fscrypt: v2 encryption policy support")
        5a7e2992 ("fscrypt: add FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl")
        b1c0ec35 ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl")
        22d94f49 ("fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl")
        3b6df59b ("fscrypt: use FSCRYPT_* definitions, not FS_*")
        2336d0de ("fscrypt: use FSCRYPT_ prefix for uapi constants")
        7af0ab0d ("fs, fscrypt: move uapi definitions to new header <linux/fscrypt.h>")
      
      That don't trigger any changes in tooling, as it so far is used only
      for:
      
        $ grep -l 'fs\.h' tools/perf/trace/beauty/*.sh | xargs grep regex=
        tools/perf/trace/beauty/rename_flags.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*'
        tools/perf/trace/beauty/sync_file_range.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*'
        tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
        tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
        $
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fs.h' differs from latest version at 'include/uapi/linux/fs.h'
        diff -u tools/include/uapi/linux/fs.h include/uapi/linux/fs.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-44g48exl9br9ba0t64chqb4i@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0ae40612
    • A
      tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources · 05f371f8
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes from:
      
        4ed33505 ("USB: usbfs: Add a capability flag for runtime suspend")
        7794f486 ("usbfs: Add ioctls for runtime power management")
      
      This triggers these changes in the kernel sources, automagically
      supporting these new ioctls in the 'perf trace' beautifiers.
      
      Soon this will be used in things like filter expressions for tracepoints
      in 'perf record', 'perf trace', 'perf top', i.e. filter expressions will
      do a lookup to turn things like USBDEVFS_WAIT_FOR_RESUME into _IO('U',
      35) before associating the tracepoint expression to tracepoint perf
      event.
      
        $ tools/perf/trace/beauty/usbdevfs_ioctl.sh  > before
        $ cp include/uapi/linux/usbdevice_fs.h tools/include/uapi/linux/usbdevice_fs.h
        $ git diff
        diff --git a/tools/include/uapi/linux/usbdevice_fs.h b/tools/include/uapi/linux/usbdevice_fs.h
        index 78efe870c2b7..cf525cddeb94 100644
        --- a/tools/include/uapi/linux/usbdevice_fs.h
        +++ b/tools/include/uapi/linux/usbdevice_fs.h
        @@ -158,6 +158,7 @@ struct usbdevfs_hub_portinfo {
         #define USBDEVFS_CAP_MMAP                      0x20
         #define USBDEVFS_CAP_DROP_PRIVILEGES           0x40
         #define USBDEVFS_CAP_CONNINFO_EX               0x80
        +#define USBDEVFS_CAP_SUSPEND                   0x100
      
         /* USBDEVFS_DISCONNECT_CLAIM flags & struct */
      
        @@ -223,5 +224,8 @@ struct usbdevfs_streams {
          * extending size of the data returned.
          */
         #define USBDEVFS_CONNINFO_EX(len)  _IOC(_IOC_READ, 'U', 32, len)
        +#define USBDEVFS_FORBID_SUSPEND    _IO('U', 33)
        +#define USBDEVFS_ALLOW_SUSPEND     _IO('U', 34)
        +#define USBDEVFS_WAIT_FOR_RESUME   _IO('U', 35)
      
         #endif /* _UAPI_LINUX_USBDEVICE_FS_H */
        $ tools/perf/trace/beauty/usbdevfs_ioctl.sh  > after
        $ diff -u before after
        --- before	2019-09-27 11:41:50.634867620 -0300
        +++ after	2019-09-27 11:42:07.453102978 -0300
        @@ -24,6 +24,9 @@
         	[30] = "DROP_PRIVILEGES",
         	[31] = "GET_SPEED",
         	[32] = "CONNINFO_EX",
        +	[33] = "FORBID_SUSPEND",
        +	[34] = "ALLOW_SUSPEND",
        +	[35] = "WAIT_FOR_RESUME",
         	[3] = "RESETEP",
         	[4] = "SETINTERFACE",
         	[5] = "SETCONFIGURATION",
        $
      
      This addresses the following perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/usbdevice_fs.h' differs from latest version at 'include/uapi/linux/usbdevice_fs.h'
        diff -u tools/include/uapi/linux/usbdevice_fs.h include/uapi/linux/usbdevice_fs.h
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-x1rb109b9nfi7pukota82xhj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      05f371f8
  17. 21 9月, 2019 1 次提交
    • A
      tools headers uapi: Sync prctl.h with the kernel sources · 7b678ccd
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        63f0c603 ("arm64: Introduce prctl() options to control the tagged user addresses ABI")
      
      that introduces prctl options that then automagically gets catched by
      the prctl cmd table generator, and thus supported in the 'perf trace'
      prctl beautifier for the 'option' argument:
      
        $ tools/perf/trace/beauty/prctl_option.sh  > after
        $ diff -u before after
        --- before	2019-09-20 14:38:41.386720870 -0300
        +++ after	2019-09-20 14:40:02.583990802 -0300
        @@ -49,6 +49,8 @@
         	[52] = "GET_SPECULATION_CTRL",
         	[53] = "SET_SPECULATION_CTRL",
         	[54] = "PAC_RESET_KEYS",
        +	[55] = "SET_TAGGED_ADDR_CTRL",
        +	[56] = "GET_TAGGED_ADDR_CTRL",
         };
         static const char *prctl_set_mm_options[] = {
         	[1] = "START_CODE",
        $
      
      For now just the translation of 55 and 56 to the respecting strings are
      done, more work needed to allow for filters to be used using strings.
      
      This, for instance, already works:
      
        # perf record -e syscalls:sys_enter_close --filter="fd==4"
        # perf script | head -5
                     gpm  1018 [006] 21327.171436: syscalls:sys_enter_close: fd: 0x00000004
                     gpm  1018 [006] 21329.171583: syscalls:sys_enter_close: fd: 0x00000004
                    bash  4882 [002] 21330.785496: syscalls:sys_enter_close: fd: 0x00000004
                    bash 20672 [001] 21330.785719: syscalls:sys_enter_close: fd: 0x00000004
                    find 20672 [001] 21330.789082: syscalls:sys_enter_close: fd: 0x00000004
        # perf record -e syscalls:sys_enter_close --filter="fd>=4"
        ^C[ perf record: Woken up 1 times to write data ]
        # perf script | head -5
                     gpm  1018 [005] 21401.178501: syscalls:sys_enter_close: fd: 0x00000004
         gsd-housekeepin  2287 [006] 21402.225365: syscalls:sys_enter_close: fd: 0x0000000b
         gsd-housekeepin  2287 [006] 21402.226234: syscalls:sys_enter_close: fd: 0x0000000b
         gsd-housekeepin  2287 [006] 21402.227255: syscalls:sys_enter_close: fd: 0x0000000b
         gsd-housekeepin  2287 [006] 21402.228088: syscalls:sys_enter_close: fd: 0x0000000b
        #
      
      Being able to pass something like:
      
        # perf record -e syscalls:sys_enter_prctl --filter="option=*TAGGED_ADDR*"
      
      Should be easy enough, first using tracepoint filters, then via the
      augmented_raw_syscalls.c BPF method.
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/prctl.h' differs from latest version at 'include/uapi/linux/prctl.h'
        diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lkml.kernel.org/n/tip-y8u8kvflooyo9x0if1g3jska@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7b678ccd
  18. 31 8月, 2019 1 次提交
  19. 28 8月, 2019 1 次提交
  20. 23 8月, 2019 1 次提交
  21. 22 8月, 2019 1 次提交
  22. 21 8月, 2019 1 次提交
  23. 20 8月, 2019 1 次提交
  24. 18 8月, 2019 2 次提交
  25. 14 8月, 2019 1 次提交
  26. 10 8月, 2019 1 次提交
  27. 31 7月, 2019 1 次提交
  28. 30 7月, 2019 1 次提交
  29. 29 7月, 2019 3 次提交
    • A
      tools headers UAPI: Sync if_link.h with the kernel · e54599c9
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        07a4ddec ("bonding: add an option to specify a delay between peer notifications")
      
      And silence this build warning:
      
        Kernel ABI header at 'tools/include/uapi/linux/if_link.h' differs from latest version at 'include/uapi/linux/if_link.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vincent Bernat <vincent@bernat.ch>
      Link: https://lkml.kernel.org/n/tip-3liw4exxh8goc0rq9xryl2kv@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e54599c9
    • A
      tools headers UAPI: Sync sched.h with the kernel · c093de6b
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        a509a7cd ("sched/uclamp: Extend sched_setattr() to support utilization clamping")
        1d6362fa ("sched/core: Allow sched_setattr() to use the current policy")
        7f192e3c ("fork: add clone3")
      
      And silence this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
        diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
      
      No changes in tools/ due to the above.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Brauner <christian@brauner.io>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Patrick Bellasi <patrick.bellasi@arm.com>
      Link: https://lkml.kernel.org/n/tip-mtrpsjrux5hgyr5uf8l1aa46@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c093de6b
    • A
      tools headers UAPI: Sync usbdevice_fs.h with the kernels to get new ioctl · 0f58163c
      Arnaldo Carvalho de Melo 提交于
      To get the changes in:
      
        6d101f24 ("USB: add usbfs ioctl to retrieve the connection parameters")
      
      And address this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/usbdevice_fs.h' differs from latest version at 'include/uapi/linux/usbdevice_fs.h'
        diff -u tools/include/uapi/linux/usbdevice_fs.h include/uapi/linux/usbdevice_fs.h
      
      Which ends up autogenerating a ioctl_cmd->string table used by 'perf
      trace':
      
        $ tools/perf/trace/beauty/usbdevfs_ioctl.sh > before
        $ cp include/uapi/linux/usbdevice_fs.h tools/include/uapi/linux/usbdevice_fs.h
        $ tools/perf/trace/beauty/usbdevfs_ioctl.sh > after
        $ diff -u before after
        --- before 2019-07-26 15:26:55.513636844 -0300
        +++ after 2019-07-26 15:29:11.650518677 -0300
        @@ -23,6 +23,7 @@
                [2] = "BULK",
                [30] = "DROP_PRIVILEGES",
                [31] = "GET_SPEED",
        +       [32] = "CONNINFO_EX",
                [3] = "RESETEP",
                [4] = "SETINTERFACE",
                [5] = "SETCONFIGURATION",
        $
      
      Now 'perf trace' ioctl beautifier will translate this new ioctl to a
      string and at some point will allow filtering the 'ioctl' syscall with
      something like this in a system wide strace-like sessin:
      
        # perf trace -e ioctl/cmd=USBDEVFS_CONNINFO_EX/
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-tkdfbgzqypwco96b309c0ovd@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0f58163c