Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jul 18, 2024
    • Mark Brown's avatar
      kselftest/alsa: Log the PCM ID in pcm-test · 4594d26f
      Mark Brown authored
      
      Drivers report a string with a name for each PCM, log it during startup of
      pcm-test as a diagnostic aid.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://patch.msgid.link/20240716-alsa-kselftest-board-name-v2-2-60f1acdde096@kernel.org
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4594d26f
    • Mark Brown's avatar
      kselftest/alsa: Use card name rather than number in test names · b1a7b97a
      Mark Brown authored
      
      Currently for the PCM and mixer tests we report test names which identify
      the card being tested with the card number. This ensures we have unique
      names but since card numbers are dynamically assigned at runtime the names
      we end up with will often not be stable on systems with multiple cards
      especially where those cards are provided by separate modules loeaded at
      runtime. This makes it difficult for automated systems and UIs to relate
      test results between runs on affected platforms.
      
      Address this by replacing our use of card numbers with card names which are
      more likely to be stable across runs. We use the card ID since it is
      guaranteed to be unique by default, unlike the long name. There is still
      some vulnerability to ordering issues if multiple cards with the same base
      ID are present in the system but have separate dependencies but not all
      drivers put distinguishing information in their long names.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://patch.msgid.link/20240716-alsa-kselftest-board-name-v2-1-60f1acdde096@kernel.org
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b1a7b97a
    • Ido Schimmel's avatar
      ipv4: Fix incorrect TOS in fibmatch route get reply · f036e682
      Ido Schimmel authored
      The TOS value that is returned to user space in the route get reply is
      the one with which the lookup was performed ('fl4->flowi4_tos'). This is
      fine when the matched route is configured with a TOS as it would not
      match if its TOS value did not match the one with which the lookup was
      performed.
      
      However, matching on TOS is only performed when the route's TOS is not
      zero. It is therefore possible to have the kernel incorrectly return a
      non-zero TOS:
      
       # ip link add name dummy1 up type dummy
       # ip address add 192.0.2.1/24 dev dummy1
       # ip route get fibmatch 192.0.2.2 tos 0xfc
       192.0.2.0/24 tos 0x1c dev dummy1 proto kernel scope link src 192.0.2.1
      
      Fix by instead returning the DSCP field from the FIB result structure
      which was populated during the route lookup.
      
      Output after the patch:
      
       # ip link add name dummy1 up type dummy
       # ip address add 192.0.2.1/24 dev dummy1
       # ip route get fibmatch 192.0.2.2 tos 0xfc
       192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1
      
      Extend the existing selftests to not only verify that the correct route
      is returned, but that it is also returned with correct "tos" value (or
      without it).
      
      Fixes: b6179813
      
       ("net: ipv4: RTM_GETROUTE: return matched fib result when requested")
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Reviewed-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      f036e682
  2. Jul 17, 2024
    • Florian Westphal's avatar
      selftests: netfilter: add test case for recent mismatch bug · 0935ee60
      Florian Westphal authored
      
      Without 'netfilter: nf_set_pipapo: fix initial map fill' this fails:
      
      TEST: reported issues
        Add two elements, flush, re-add       1s                              [ OK ]
        net,mac with reload                   1s                              [ OK ]
        net,port,proto                        1s                              [FAIL]
      post-add: should have returned 10.5.8.0/24 . 51-60 . 6-17  but got table inet filter {
              set test {
                      type ipv4_addr . inet_service . inet_proto
                      flags interval,timeout
                      elements = { 10.5.7.0/24 . 51-60 . 6-17 }
              }
      }
      
      The other sets defined in the selftest do not trigger this bug, it only
      occurs if the first field group bitsize is smaller than the largest
      group bitsize.
      
      For each added element, check 'get' works and actually returns the
      requested range.
      After map has been filled, check all added ranges can still be
      retrieved.
      
      For each deleted element, check that 'get' fails.
      
      Based on a reproducer script from Yi Chen.
      
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      0935ee60
  3. Jul 15, 2024
  4. Jul 14, 2024
    • Nicolas Dichtel's avatar
      selftests: vrf_route_leaking: add local test · 39367183
      Nicolas Dichtel authored
      
      The goal is to check that the source address selected by the kernel is
      routable when a leaking route is used. ICMP, TCP and UDP connections are
      tested.
      The symmetric topology is enough for this test.
      
      Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://patch.msgid.link/20240710081521.3809742-5-nicolas.dichtel@6wind.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      39367183
    • Amit Cohen's avatar
      selftests: forwarding: devlink_lib: Wait for udev events after reloading · f67a90a0
      Amit Cohen authored
      Lately, an additional locking was added by commit c0a40097
      ("drivers: core: synchronize really_probe() and dev_uevent()"). The
      locking protects dev_uevent() calling. This function is used to send
      messages from the kernel to user space. Uevent messages notify user space
      about changes in device states, such as when a device is added, removed,
      or changed. These messages are used by udev (or other similar user-space
      tools) to apply device-specific rules.
      
      After reloading devlink instance, udev events should be processed. This
      locking causes a short delay of udev events handling.
      
      One example for useful udev rule is renaming ports. 'forwading.config'
      can be configured to use names after udev rules are applied. Some tests run
      devlink_reload() and immediately use the updated names. This worked before
      the above mentioned commit was pushed, but now the delay of uevent messages
      causes that devlink_reload() returns before udev events are handled and
      tests fail.
      
      Adjust devlink_reload() to not assume that udev events are already
      processed when devlink reload is done, instead, wait for udev events to
      ensure they are processed before returning from the function.
      
      Without this patch:
      TESTS='rif_mac_profile' ./resource_scale.sh
      TEST: 'rif_mac_profile' 4                                           [ OK ]
      sysctl: cannot stat /proc/sys/net/ipv6/conf/swp1/disable_ipv6: No such file or directory
      sysctl: cannot stat /proc/sys/net/ipv6/conf/swp1/disable_ipv6: No such file or directory
      sysctl: cannot stat /proc/sys/net/ipv6/conf/swp2/disable_ipv6: No such file or directory
      sysctl: cannot stat /proc/sys/net/ipv6/conf/swp2/disable_ipv6: No such file or directory
      Cannot find device "swp1"
      Cannot find device "swp2"
      TEST: setup_wait_dev (: Interface swp1 does not come up.) [FAIL]
      
      With this patch:
      $ TESTS='rif_mac_profile' ./resource_scale.sh
      TEST: 'rif_mac_profile' 4                                           [ OK ]
      TEST: 'rif_mac_profile' overflow 5                                  [ OK ]
      
      This is relevant not only for this test.
      
      Fixes: bc7cbb1e
      
       ("selftests: forwarding: Add devlink_lib.sh")
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Link: https://patch.msgid.link/89367666e04b38a8993027f1526801ca327ab96a.1720709333.git.petrm@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f67a90a0
  5. Jul 13, 2024
  6. Jul 12, 2024
    • Tengda Wu's avatar
      selftests/bpf: Test for null-pointer-deref bugfix in resolve_prog_type() · e435b043
      Tengda Wu authored
      
      This test verifies that resolve_prog_type() works as expected when
      `attach_prog_fd` is not passed in.
      
      `prog->aux->dst_prog` in resolve_prog_type() is assigned by
      `attach_prog_fd`, and would be NULL if `attach_prog_fd` is not provided.
      
      Loading EXT prog with bpf_dynptr_from_skb() kfunc call in this way will
      lead to null-pointer-deref.
      
      Verify that the null-pointer-deref bug in resolve_prog_type() is fixed.
      
      Signed-off-by: default avatarTengda Wu <wutengda@huaweicloud.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20240711145819.254178-3-wutengda@huaweicloud.com
      e435b043
    • Howard Chu's avatar
      perf trace: Fix iteration of syscall ids in syscalltbl->entries · 7a2fb561
      Howard Chu authored
      This is a bug found when implementing pretty-printing for the
      landlock_add_rule system call, I decided to send this patch separately
      because this is a serious bug that should be fixed fast.
      
      I wrote a test program to do landlock_add_rule syscall in a loop,
      yet perf trace -e landlock_add_rule freezes, giving no output.
      
      This bug is introduced by the false understanding of the variable "key"
      below:
      ```
      for (key = 0; key < trace->sctbl->syscalls.nr_entries; ++key) {
      	struct syscall *sc = trace__syscall_info(trace, NULL, key);
      	...
      }
      ```
      The code above seems right at the beginning, but when looking at
      syscalltbl.c, I found these lines:
      
      ```
      for (i = 0; i <= syscalltbl_native_max_id; ++i)
      	if (syscalltbl_native[i])
      		++nr_entries;
      
      entries = tbl->syscalls.entries = malloc(sizeof(struct syscall) * nr_entries);
      ...
      
      for (i = 0, j = 0; i <= syscalltbl_native_max_id; ++i) {
      	if (syscalltbl_native[i]) {
      		entries[j].name = syscalltbl_native[i];
      		entries[j].id = i;
      		++j;
      	}
      }
      ```
      
      meaning the key is merely an index to traverse the syscall table,
      instead of the actual syscall id for this particular syscall.
      
      So if one uses key to do trace__syscall_info(trace, NULL, key), because
      key only goes up to trace->sctbl->syscalls.nr_entries, for example, on
      my X86_64 machine, this number is 373, it will end up neglecting all
      the rest of the syscall, in my case, everything after `rseq`, because
      the traversal will stop at 373, and `rseq` is the last syscall whose id
      is lower than 373
      
      in tools/perf/arch/x86/include/generated/asm/syscalls_64.c:
      ```
      	...
      	[334] = "rseq",
      	[424] = "pidfd_send_signal",
      	...
      ```
      
      The reason why the key is scrambled but perf trace works well is that
      key is used in trace__syscall_info(trace, NULL, key) to do
      trace->syscalls.table[id], this makes sure that the struct syscall returned
      actually has an id the same value as key, making the later bpf_prog
      matching all correct.
      
      After fixing this bug, I can do perf trace on 38 more syscalls, and
      because more syscalls are visible, we get 8 more syscalls that can be
      augmented.
      
      before:
      
      perf $ perf trace -vv --max-events=1 |& grep Reusing
      Reusing "open" BPF sys_enter augmenter for "stat"
      Reusing "open" BPF sys_enter augmenter for "lstat"
      Reusing "open" BPF sys_enter augmenter for "access"
      Reusing "connect" BPF sys_enter augmenter for "accept"
      Reusing "sendto" BPF sys_enter augmenter for "recvfrom"
      Reusing "connect" BPF sys_enter augmenter for "bind"
      Reusing "connect" BPF sys_enter augmenter for "getsockname"
      Reusing "connect" BPF sys_enter augmenter for "getpeername"
      Reusing "open" BPF sys_enter augmenter for "execve"
      Reusing "open" BPF sys_enter augmenter for "truncate"
      Reusing "open" BPF sys_enter augmenter for "chdir"
      Reusing "open" BPF sys_enter augmenter for "mkdir"
      Reusing "open" BPF sys_enter augmenter for "rmdir"
      Reusing "open" BPF sys_enter augmenter for "creat"
      Reusing "open" BPF sys_enter augmenter for "link"
      Reusing "open" BPF sys_enter augmenter for "unlink"
      Reusing "open" BPF sys_enter augmenter for "symlink"
      Reusing "open" BPF sys_enter augmenter for "readlink"
      Reusing "open" BPF sys_enter augmenter for "chmod"
      Reusing "open" BPF sys_enter augmenter for "chown"
      Reusing "open" BPF sys_enter augmenter for "lchown"
      Reusing "open" BPF sys_enter augmenter for "mknod"
      Reusing "open" BPF sys_enter augmenter for "statfs"
      Reusing "open" BPF sys_enter augmenter for "pivot_root"
      Reusing "open" BPF sys_enter augmenter for "chroot"
      Reusing "open" BPF sys_enter augmenter for "acct"
      Reusing "open" BPF sys_enter augmenter for "swapon"
      Reusing "open" BPF sys_enter augmenter for "swapoff"
      Reusing "open" BPF sys_enter augmenter for "delete_module"
      Reusing "open" BPF sys_enter augmenter for "setxattr"
      Reusing "open" BPF sys_enter augmenter for "lsetxattr"
      Reusing "openat" BPF sys_enter augmenter for "fsetxattr"
      Reusing "open" BPF sys_enter augmenter for "getxattr"
      Reusing "open" BPF sys_enter augmenter for "lgetxattr"
      Reusing "openat" BPF sys_enter augmenter for "fgetxattr"
      Reusing "open" BPF sys_enter augmenter for "listxattr"
      Reusing "open" BPF sys_enter augmenter for "llistxattr"
      Reusing "open" BPF sys_enter augmenter for "removexattr"
      Reusing "open" BPF sys_enter augmenter for "lremovexattr"
      Reusing "fsetxattr" BPF sys_enter augmenter for "fremovexattr"
      Reusing "open" BPF sys_enter augmenter for "mq_open"
      Reusing "open" BPF sys_enter augmenter for "mq_unlink"
      Reusing "fsetxattr" BPF sys_enter augmenter for "add_key"
      Reusing "fremovexattr" BPF sys_enter augmenter for "request_key"
      Reusing "fremovexattr" BPF sys_enter augmenter for "inotify_add_watch"
      Reusing "fremovexattr" BPF sys_enter augmenter for "mkdirat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "mknodat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "fchownat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "futimesat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "newfstatat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "unlinkat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "linkat"
      Reusing "open" BPF sys_enter augmenter for "symlinkat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "readlinkat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "fchmodat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "faccessat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "utimensat"
      Reusing "connect" BPF sys_enter augmenter for "accept4"
      Reusing "fremovexattr" BPF sys_enter augmenter for "name_to_handle_at"
      Reusing "fremovexattr" BPF sys_enter augmenter for "renameat2"
      Reusing "open" BPF sys_enter augmenter for "memfd_create"
      Reusing "fremovexattr" BPF sys_enter augmenter for "execveat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "statx"
      
      after
      
      perf $ perf trace -vv --max-events=1 |& grep Reusing
      Reusing "open" BPF sys_enter augmenter for "stat"
      Reusing "open" BPF sys_enter augmenter for "lstat"
      Reusing "open" BPF sys_enter augmenter for "access"
      Reusing "connect" BPF sys_enter augmenter for "accept"
      Reusing "sendto" BPF sys_enter augmenter for "recvfrom"
      Reusing "connect" BPF sys_enter augmenter for "bind"
      Reusing "connect" BPF sys_enter augmenter for "getsockname"
      Reusing "connect" BPF sys_enter augmenter for "getpeername"
      Reusing "open" BPF sys_enter augmenter for "execve"
      Reusing "open" BPF sys_enter augmenter for "truncate"
      Reusing "open" BPF sys_enter augmenter for "chdir"
      Reusing "open" BPF sys_enter augmenter for "mkdir"
      Reusing "open" BPF sys_enter augmenter for "rmdir"
      Reusing "open" BPF sys_enter augmenter for "creat"
      Reusing "open" BPF sys_enter augmenter for "link"
      Reusing "open" BPF sys_enter augmenter for "unlink"
      Reusing "open" BPF sys_enter augmenter for "symlink"
      Reusing "open" BPF sys_enter augmenter for "readlink"
      Reusing "open" BPF sys_enter augmenter for "chmod"
      Reusing "open" BPF sys_enter augmenter for "chown"
      Reusing "open" BPF sys_enter augmenter for "lchown"
      Reusing "open" BPF sys_enter augmenter for "mknod"
      Reusing "open" BPF sys_enter augmenter for "statfs"
      Reusing "open" BPF sys_enter augmenter for "pivot_root"
      Reusing "open" BPF sys_enter augmenter for "chroot"
      Reusing "open" BPF sys_enter augmenter for "acct"
      Reusing "open" BPF sys_enter augmenter for "swapon"
      Reusing "open" BPF sys_enter augmenter for "swapoff"
      Reusing "open" BPF sys_enter augmenter for "delete_module"
      Reusing "open" BPF sys_enter augmenter for "setxattr"
      Reusing "open" BPF sys_enter augmenter for "lsetxattr"
      Reusing "openat" BPF sys_enter augmenter for "fsetxattr"
      Reusing "open" BPF sys_enter augmenter for "getxattr"
      Reusing "open" BPF sys_enter augmenter for "lgetxattr"
      Reusing "openat" BPF sys_enter augmenter for "fgetxattr"
      Reusing "open" BPF sys_enter augmenter for "listxattr"
      Reusing "open" BPF sys_enter augmenter for "llistxattr"
      Reusing "open" BPF sys_enter augmenter for "removexattr"
      Reusing "open" BPF sys_enter augmenter for "lremovexattr"
      Reusing "fsetxattr" BPF sys_enter augmenter for "fremovexattr"
      Reusing "open" BPF sys_enter augmenter for "mq_open"
      Reusing "open" BPF sys_enter augmenter for "mq_unlink"
      Reusing "fsetxattr" BPF sys_enter augmenter for "add_key"
      Reusing "fremovexattr" BPF sys_enter augmenter for "request_key"
      Reusing "fremovexattr" BPF sys_enter augmenter for "inotify_add_watch"
      Reusing "fremovexattr" BPF sys_enter augmenter for "mkdirat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "mknodat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "fchownat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "futimesat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "newfstatat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "unlinkat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "linkat"
      Reusing "open" BPF sys_enter augmenter for "symlinkat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "readlinkat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "fchmodat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "faccessat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "utimensat"
      Reusing "connect" BPF sys_enter augmenter for "accept4"
      Reusing "fremovexattr" BPF sys_enter augmenter for "name_to_handle_at"
      Reusing "fremovexattr" BPF sys_enter augmenter for "renameat2"
      Reusing "open" BPF sys_enter augmenter for "memfd_create"
      Reusing "fremovexattr" BPF sys_enter augmenter for "execveat"
      Reusing "fremovexattr" BPF sys_enter augmenter for "statx"
      
      TL;DR:
      
      These are the new syscalls that can be augmented
      Reusing "openat" BPF sys_enter augmenter for "open_tree"
      Reusing "openat" BPF sys_enter augmenter for "openat2"
      Reusing "openat" BPF sys_enter augmenter for "mount_setattr"
      Reusing "openat" BPF sys_enter augmenter for "move_mount"
      Reusing "open" BPF sys_enter augmenter for "fsopen"
      Reusing "openat" BPF sys_enter augmenter for "fspick"
      Reusing "openat" BPF sys_enter augmenter for "faccessat2"
      Reusing "openat" BPF sys_enter augmenter for "fchmodat2"
      
      as for the perf trace output:
      
      before
      
      perf $ perf trace -e faccessat2 --max-events=1
      [no output]
      
      after
      
      perf $ ./perf trace -e faccessat2 --max-events=1
           0.000 ( 0.037 ms): waybar/958 faccessat2(dfd: 40, filename: "uevent")                               = 0
      
      P.S. The reason why this bug was not found in the past five years is
      probably because it only happens to the newer syscalls whose id is
      greater, for instance, faccessat2 of id 439, which not a lot of people
      care about when using perf trace.
      
      [Arnaldo]: notes
      
      That and the fact that the BPF code was hidden before having to use -e,
      that got changed kinda recently when we switched to using BPF skels for
      augmenting syscalls in 'perf trace':
      
      ⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
      a9f4c6c9 perf trace: Collect sys_nanosleep first argument
      29d16de2 perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h
      5069211e perf trace: Use the right bpf_probe_read(_str) variant for reading user data
      33b725ce perf trace: Avoid compile error wrt redefining bool
      7d964231 perf bpf augmented_raw_syscalls: Add an assert to make sure sizeof(augmented_arg->value) is a power of two.
      262b54b6 perf bpf augmented_raw_syscalls: Add an assert to make sure sizeof(saddr) is a power of two.
      18364804 perf bpf_skel augmented_raw_syscalls: Cap the socklen parameter using &= sizeof(saddr)
      cd2cece6 perf trace: Tidy comments related to BPF + syscall augmentation
      5e6da6be perf trace: Migrate BPF augmentation to use a skeleton
      ⬢[acme@toolbox perf-tools-next]$
      
      ⬢[acme@toolbox perf-tools-next]$ git show --oneline --pretty=reference 5e6da6be | head -1
      5e6da6be
      
       (perf trace: Migrate BPF augmentation to use a skeleton, 2023-08-10)
      ⬢[acme@toolbox perf-tools-next]$
      
      I.e. from August, 2023.
      
      One had as well to ask for BUILD_BPF_SKEL=1, which now is default if all
      it needs is available on the system.
      
      I simplified the code to not expose the 'struct syscall' outside of
      tools/perf/util/syscalltbl.c, instead providing a function to go from
      the index to the syscall id:
      
        int syscalltbl__id_at_idx(struct syscalltbl *tbl, int idx);
      
      Signed-off-by: default avatarHoward Chu <howardchu95@gmail.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://lore.kernel.org/lkml/ZmhlAxbVcAKoPTg8@x1
      Link: https://lore.kernel.org/r/20240705132059.853205-2-howardchu95@gmail.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      7a2fb561
    • Ian Rogers's avatar
      perf dso: Fix address sanitizer build · 1553419c
      Ian Rogers authored
      Various files had been missed from having accessor functions added for
      the sake of dso reference count checking. Add the function calls and
      missing dso accessor functions.
      
      Fixes: ee756ef7
      
       ("perf dso: Add reference count checking and accessor functions")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: James Clark <james.clark@linaro.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Yunseong Kim <yskelg@gmail.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Leo Yan <leo.yan@linux.dev>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: John Garry <john.g.garry@oracle.com>
      Link: https://lore.kernel.org/r/20240704011745.1021288-1-irogers@google.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      1553419c
    • Leo Yan's avatar
      perf mem: Warn if memory events are not supported on all CPUs · 14b0fffa
      Leo Yan authored
      
      It is possible that memory events are not supported on all CPUs.
      
      Prints a warning by dumping the enabled CPU maps in this case.
      
      Signed-off-by: default avatarLeo Yan <leo.yan@arm.com>
      Reviewed-by: default avatarJames Clark <james.clark@linaro.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: coresight@lists.linaro.org
      Link: https://lore.kernel.org/r/20240706152035.86983-3-leo.yan@arm.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      14b0fffa
    • Leo Yan's avatar
      perf arm-spe: Support multiple Arm SPE PMUs · e6b4da67
      Leo Yan authored
      
      A platform can have more than one Arm SPE PMU. For example, a system
      with multiple clusters may have each cluster enabled with its own Arm
      SPE instance. In such case, the PMU devices will be named 'arm_spe_0',
      'arm_spe_1', and so on.
      
      Currently, the tool only supports 'arm_spe_0'. This commit extends
      support to multiple Arm SPE PMUs by detecting the substring 'arm_spe_'.
      
      Signed-off-by: default avatarLeo Yan <leo.yan@arm.com>
      Reviewed-by: default avatarJames Clark <james.clark@linaro.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: coresight@lists.linaro.org
      Link: https://lore.kernel.org/r/20240706152035.86983-2-leo.yan@arm.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      e6b4da67
    • Haoze Xie's avatar
      perf build x86: Fix SC2034 error in syscalltbl.sh · 759ce73c
      Haoze Xie authored
      Change the unused var in 'arch/x86/entry/syscalls/syscalltbl.sh' to '_'
      when reading from '$sorted_table'. This change allows the script to pass
      tests of ShellCheck before and after version 0.7.2 at the same time.
      
      When building in arch x86, syscalltbl.sh got a ShellCheck warning, which
      makes compilation error:
      
          In arch/x86/entry/syscalls/syscalltbl.sh line 27:
          while read nr _abi name entry _compat; do
                        ^-^ SC2034: abi appears unused.
                        Verify use (or export if used externally).
                                        ^----^ SC2034: compat appears unused.
                                     Verify use (or export if used externally).
      
      The script reads unused param abi and compat. It uses format '_xxx' to
      indicate dummy vars, which won't work properly when ShellCheck <= 0.7.2.
      
      According to SC2034, the more general way of writing is to use directly
      '_' to indicate discarding vars. 'entry' is also replaced by '_' because
      it just happens to be defined in emit function, otherwise it will lead
      to some misunderstandings.
      
      Link: https://www.shellcheck.net/wiki/SC2034
      
      
      Signed-off-by: default avatarHaoze Xie <royenheart@gmail.com>
      Signed-off-by: default avatarYuan Tan <tanyuan@tinylab.org>
      Link: https://lore.kernel.org/r/2143cab4cd8468c88860f4e5e382d0e6b4d89ac9.1720372178.git.royenheart@gmail.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      759ce73c
    • Haoze Xie's avatar
      perf record: Fix memset out-of-range error · 6353abd3
      Haoze Xie authored
      Modified the object of 'memset' from '&lost.lost' to '&lost' in
      record__read_lost_samples. This allows 'memset' to access memory properly
      without causing out-of-bounds problems.
      
      The problems got from builtin-record.c are:
      
      In file included from /usr/include/string.h:495,
                       from util/parse-events.h:13,
                       from builtin-record.c:14:
      In function 'memset',
          inlined from 'record__read_lost_samples' at
          builtin-record.c:1958:6,
          inlined from '__cmd_record.constprop' at builtin-record.c:2817:2:
      /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:10: error:
      '__builtin_memset' offset [17, 64] from the object at 'lost' is out
      of the bounds of referenced subobject 'lost' with type
      'struct perf_record_lost_samples' at offset 0 [-Werror=array-bounds]
      71|return __builtin___memset_chk (__dest,__ch,__len,__bos0 (__dest));
        |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      The error arised when performing a memset operation on the 'lost' variable,
      the bytes of 'sizeof(lost)' exceeds that of '&lost.lost', which are 64
      and 16.
      
      Fixes: 6c1785cd
      
       ("perf record: Ensure space for lost samples")
      Signed-off-by: default avatarHaoze Xie <royenheart@gmail.com>
      Signed-off-by: default avatarYuan Tan <tanyuan@tinylab.org>
      Link: https://lore.kernel.org/r/11e12f171b846577cac698cd3999db3d7f6c4d03.1720372317.git.royenheart@gmail.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      6353abd3
    • Madadi Vineeth Reddy's avatar
      perf sched map: Add --fuzzy-name option for fuzzy matching in task names · 306f921e
      Madadi Vineeth Reddy authored
      
      The --fuzzy-name option can be used if fuzzy name matching is required.
      For example, "taskname" can be matched to any string that contains
      "taskname" as its substring.
      
      Sample output for --task-name wdav --fuzzy-name
      =============
       .  *A0  .   .   .   .   -   .   131040.641346 secs A0 => wdavdaemon:62509
       .   A0 *B0  .   .   .   -   .   131040.641378 secs B0 => wdavdaemon:62274
       .  *-   B0  .   .   .   -   .   131040.641379 secs
      *C0  .   B0  .   .   .   .   .   131040.641572 secs C0 => wdavdaemon:62283
       C0  .   B0  .  *D0  .   .   .   131040.641572 secs D0 => wdavdaemon:62277
       C0  .   B0  .   D0  .  *E0  .   131040.641578 secs E0 => wdavdaemon:62270
      *-   .   B0  .   D0  .   E0  .   131040.641581 secs
      
      Suggested-by: default avatarChen Yu <yu.c.chen@intel.com>
      Reviewed-and-tested-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMadadi Vineeth Reddy <vineethr@linux.ibm.com>
      Link: https://lore.kernel.org/r/20240707182716.22054-4-vineethr@linux.ibm.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      306f921e
    • Madadi Vineeth Reddy's avatar
      perf sched map: Add support for multiple task names using CSV · 9cc0afed
      Madadi Vineeth Reddy authored
      
      To track the scheduling patterns of multiple tasks simultaneously,
      multiple task names can be specified using a comma separator
      without any whitespace.
      
      Sample output for --task-name perf,wdavdaemon
      =============
       .  *A0  .   .   .   .   -   .   131040.641346 secs A0 => wdavdaemon:62509
       .   A0 *B0  .   .   .   -   .   131040.641378 secs B0 => wdavdaemon:62274
       .  *-   B0  .   .   .   -   .   131040.641379 secs
      *C0  .   B0  .   .   .   .   .   131040.641572 secs C0 => wdavdaemon:62283
      
      ...
      
       .  *-   .   .   .   .   .   .   131041.395649 secs
       .   .   .   .   .   .   .  *X2  131041.403969 secs X2 => perf:70211
       .   .   .   .   .   .   .  *-   131041.404006 secs
      
      Suggested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Reviewed-and-tested-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMadadi Vineeth Reddy <vineethr@linux.ibm.com>
      Cc: Chen Yu <yu.c.chen@intel.com>
      Link: https://lore.kernel.org/r/20240707182716.22054-3-vineethr@linux.ibm.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      9cc0afed
    • Madadi Vineeth Reddy's avatar
      perf sched map: Add task-name option to filter the output map · 3116d609
      Madadi Vineeth Reddy authored
      
      By default, perf sched map prints sched-in events for all the tasks
      which may not be required all the time as it prints lot of symbols
      and rows to the terminal.
      
      With --task-name option, one could specify the specific task name
      for which the map has to be shown. This would help in analyzing the
      CPU usage patterns easier for that specific task. Since multiple
      PID's might have the same task name, using task-name filter
      would be more useful for debugging.
      
      For other tasks, instead of printing the symbol, '-' is printed and
      the same '.' is used to represent idle. '-' is used instead of symbol
      for other tasks because it helps in clear visualization of task
      of interest and secondly the symbol itself doesn't mean anything
      because the sched-in of that symbol will not be printed(first sched-in
      contains pid and the corresponding symbol).
      
      When using the --task-name option, the sched-out time is represented
      by a '*-'. Since not all task sched-in events are printed, the sched-out
      time of the relevant task might be lost. This representation ensures
      that the sched-out time of the interested task is not overlooked.
      
      6.10.0-rc1
      ==========
      *A0                              131040.639793 secs A0 => migration/0:19
      *.                               131040.639801 secs .  => swapper:0
       .  *B0                          131040.639830 secs B0 => migration/1:24
       .  *.                           131040.639836 secs
       .   .  *C0                      131040.640108 secs C0 => migration/2:30
       .   .  *.                       131040.640163 secs
       .   .   .  *D0                  131040.640386 secs D0 => migration/3:36
       .   .   .  *.                   131040.640395 secs
      
      6.10.0-rc1 + patch (--task-name wdavdaemon)
      =============
       .  *A0  .   .   .   .   -   .   131040.641346 secs A0 => wdavdaemon:62509
       .   A0 *B0  .   .   .   -   .   131040.641378 secs B0 => wdavdaemon:62274
       -  *-   B0  .   .   .   -   .   131040.641379 secs
      *C0  .   B0  .   .   .   .   .   131040.641572 secs C0 => wdavdaemon:62283
       C0  .   B0  .  *D0  .   .   .   131040.641572 secs D0 => wdavdaemon:62277
       C0  .   B0  .   D0  .  *E0  .   131040.641578 secs E0 => wdavdaemon:62270
      *-   .   B0  .   D0  .   E0  .   131040.641581 secs
       .   .   B0  .   D0  .  *-   .   131040.641583 secs
      
      Reviewed-and-tested-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMadadi Vineeth Reddy <vineethr@linux.ibm.com>
      Cc: Chen Yu <yu.c.chen@intel.com>
      Link: https://lore.kernel.org/r/20240707182716.22054-2-vineethr@linux.ibm.com
      
      
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      3116d609
    • Daniel Borkmann's avatar
      selftests/bpf: DENYLIST.aarch64: Skip fexit_sleep again · 517125f6
      Daniel Borkmann authored
      Revert commit 90dc9460 ("selftests/bpf: DENYLIST.aarch64: Remove
      fexit_sleep") again. The fix in 19d3c179 ("bpf, arm64: Fix trampoline
      for BPF_TRAMP_F_CALL_ORIG") does not address all of the issues and BPF
      CI is still hanging and timing out:
      
         https://github.com/kernel-patches/bpf/actions/runs/9905842936/job/27366435436
      
      
      
         [...]
         #89/11   fexit_bpf2bpf/func_replace_global_func:OK
         #89/12   fexit_bpf2bpf/fentry_to_cgroup_bpf:OK
         #89/13   fexit_bpf2bpf/func_replace_progmap:OK
         #89      fexit_bpf2bpf:OK
         Error: The operation was canceled.
      
      Thus more investigation work & fixing is needed before the test can be put
      in place again.
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: Puranjay Mohan <puranjay@kernel.org>
      Link: https://lore.kernel.org/bpf/20240705145009.32340-1-puranjay@kernel.org
      517125f6
    • Andrew Jones's avatar
      KVM: riscv: selftests: Add Zawrs extension to get-reg-list test · f2c43c61
      Andrew Jones authored
      
      KVM RISC-V allows the Zawrs extension for the Guest/VM, so add it
      to the get-reg-list test.
      
      Signed-off-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Acked-by: default avatarAnup Patel <anup@brainfault.org>
      Link: https://lore.kernel.org/r/20240426100820.14762-14-ajones@ventanamicro.com
      
      
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      f2c43c61
    • Nícolas F. R. A. Prado's avatar
      kselftest: devices: Add test to detect device error logs · b7274930
      Nícolas F. R. A. Prado authored
      
      Log errors are the most widely used mechanism for reporting issues in
      the kernel. When an error is logged using the device helpers, eg
      dev_err(), it gets metadata attached that identifies the subsystem and
      device where the message is coming from. Introduce a new test that makes
      use of that metadata to report which devices logged errors (or more
      critical messages).
      
      Signed-off-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
      Acked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20240705-dev-err-log-selftest-v2-3-163b9cd7b3c1@collabora.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7274930
    • Nícolas F. R. A. Prado's avatar
      kselftest: Move ksft helper module to common directory · 0e7b7bde
      Nícolas F. R. A. Prado authored
      
      Move the ksft python module, which provides generic helpers for
      kselftests, to a common directory so it can be more easily shared
      between different tests.
      
      Signed-off-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
      Acked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20240705-dev-err-log-selftest-v2-2-163b9cd7b3c1@collabora.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e7b7bde
    • Nícolas F. R. A. Prado's avatar
      kselftest: devices: Move discoverable devices test to subdirectory · 0debb20c
      Nícolas F. R. A. Prado authored
      
      Move the discoverable devices test to a subdirectory to allow other
      related tests to be added to the devices directory.
      
      Signed-off-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
      Acked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20240705-dev-err-log-selftest-v2-1-163b9cd7b3c1@collabora.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0debb20c
  7. Jul 11, 2024