1. 02 Jan, 2023 5 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix segfault when trying to process tracepoints in perf.data and... · 77fe30fe
      Arnaldo Carvalho de Melo authored
      perf tools: Fix segfault when trying to process tracepoints in perf.data and not linked with libtraceevent
      
      When we have a perf.data file with tracepoints, such as:
      
        # perf evlist -f
        probe_perf:lzma_decompress_to_file
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
        #
      
      We end up segfaulting when using perf built with NO_LIBTRACEEVENT=1 by
      trying to find an evsel with a NULL 'event_name' variable:
      
        (gdb) run report --stdio -f
        Starting program: /root/bin/perf report --stdio -f
      
        Program received signal SIGSEGV, Segmentation fault.
        0x000000000055219d in find_evsel (evlist=0xfda7b0, event_name=0x0) at util/sort.c:2830
        warning: Source file is more recent than executable.
        2830		if (event_name[0] == '%') {
        Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.8-11.fc36.x86_64 cyrus-sasl-lib-2.1.27-18.fc36.x86_64 elfutils-debuginfod-client-0.188-3.fc36.x86_64 elfutils-libelf-0.188-3.fc36.x86_64 elfutils-libs-0.188-3.fc36.x86_64 glibc-2.35-20.fc36.x86_64 keyutils-libs-1.6.1-4.fc36.x86_64 krb5-libs-1.19.2-12.fc36.x86_64 libbrotli-1.0.9-7.fc36.x86_64 libcap-2.48-4.fc36.x86_64 libcom_err-1.46.5-2.fc36.x86_64 libcurl-7.82.0-12.fc36.x86_64 libevent-2.1.12-6.fc36.x86_64 libgcc-12.2.1-4.fc36.x86_64 libidn2-2.3.4-1.fc36.x86_64 libnghttp2-1.51.0-1.fc36.x86_64 libpsl-0.21.1-5.fc36.x86_64 libselinux-3.3-4.fc36.x86_64 libssh-0.9.6-4.fc36.x86_64 libstdc++-12.2.1-4.fc36.x86_64 libunistring-1.0-1.fc36.x86_64 libunwind-1.6.2-2.fc36.x86_64 libxcrypt-4.4.33-4.fc36.x86_64 libzstd-1.5.2-2.fc36.x86_64 numactl-libs-2.0.14-5.fc36.x86_64 opencsd-1.2.0-1.fc36.x86_64 openldap-2.6.3-1.fc36.x86_64 openssl-libs-3.0.5-2.fc36.x86_64 slang-2.3.2-11.fc36.x86_64 xz-libs-5.2.5-9.fc36.x86_64 zlib-1.2.11-33.fc36.x86_64
        (gdb) bt
        #0  0x000000000055219d in find_evsel (evlist=0xfda7b0, event_name=0x0) at util/sort.c:2830
        #1  0x0000000000552416 in add_dynamic_entry (evlist=0xfda7b0, tok=0xffb6eb "trace", level=2) at util/sort.c:2976
        #2  0x0000000000552d26 in sort_dimension__add (list=0xf93e00 <perf_hpp_list>, tok=0xffb6eb "trace", evlist=0xfda7b0, level=2) at util/sort.c:3193
        #3  0x0000000000552e1c in setup_sort_list (list=0xf93e00 <perf_hpp_list>, str=0xffb6eb "trace", evlist=0xfda7b0) at util/sort.c:3227
        #4  0x00000000005532fa in __setup_sorting (evlist=0xfda7b0) at util/sort.c:3381
        #5  0x0000000000553cdc in setup_sorting (evlist=0xfda7b0) at util/sort.c:3608
        #6  0x000000000042eb9f in cmd_report (argc=0, argv=0x7fffffffe470) at builtin-report.c:1596
        #7  0x00000000004aee7e in run_builtin (p=0xf64ca0 <commands+288>, argc=3, argv=0x7fffffffe470) at perf.c:330
        #8  0x00000000004af0f2 in handle_internal_command (argc=3, argv=0x7fffffffe470) at perf.c:384
        #9  0x00000000004af241 in run_argv (argcp=0x7fffffffe29c, argv=0x7fffffffe290) at perf.c:428
        #10 0x00000000004af5fc in main (argc=3, argv=0x7fffffffe470) at perf.c:562
        (gdb)
      
      So check if we have tracepoint events in add_dynamic_entry() and bail
      out instead:
      
        # perf report --stdio -f
        This perf binary isn't linked with libtraceevent, can't process probe_perf:lzma_decompress_to_file
        Error:
        Unknown --sort key: `trace'
        #
      
      Fixes: 378ef0f5 ("perf build: Use libtraceevent from the system")
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/Y7MDb7kRaHZB6APC@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      77fe30fe
    • Ahelenia Ziemiańska's avatar
      perf tools: Don't include signature in version strings · f24fb539
      Ahelenia Ziemiańska authored
      This explodes the build if HEAD is signed, since the generated version
      is gpg: Signature made Mon 26 Dec 2022 20:34:48 CET, then a few more
      lines, then the SHA.
      Signed-off-by: default avatarAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/7c9637711271f50ec2341fb8a7c29585335dab04.1672174189.git.nabijaczleweli@nabijaczleweli.xyzSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f24fb539
    • Yang Jihong's avatar
      perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands · 55c41f2e
      Yang Jihong authored
      Commands such as kmem, kwork, lock, sched, trace and timechart depend on
      libtraceevent, these commands need to be isolated using HAVE_LIBTRACEEVENT
      macro when cmdlist generation.
      
      The output of the generate-cmdlist.sh script is as follows:
      
        # ./util/generate-cmdlist.sh
        /* Automatically generated by ./util/generate-cmdlist.sh */
        struct cmdname_help
        {
            char name[16];
            char help[80];
        };
      
        static struct cmdname_help common_cmds[] = {
          {"annotate", "Read perf.data (created by perf record) and display annotated code"},
          {"archive", "Create archive with object files with build-ids found in perf.data file"},
          {"bench", "General framework for benchmark suites"},
          {"buildid-cache", "Manage build-id cache."},
          {"buildid-list", "List the buildids in a perf.data file"},
          {"c2c", "Shared Data C2C/HITM Analyzer."},
          {"config", "Get and set variables in a configuration file."},
          {"daemon", "Run record sessions on background"},
          {"data", "Data file related processing"},
          {"diff", "Read perf.data files and display the differential profile"},
          {"evlist", "List the event names in a perf.data file"},
          {"ftrace", "simple wrapper for kernel's ftrace functionality"},
          {"inject", "Filter to augment the events stream with additional information"},
          {"iostat", "Show I/O performance metrics"},
          {"kallsyms", "Searches running kernel for symbols"},
          {"kvm", "Tool to trace/measure kvm guest os"},
          {"list", "List all symbolic event types"},
          {"mem", "Profile memory accesses"},
          {"record", "Run a command and record its profile into perf.data"},
          {"report", "Read perf.data (created by perf record) and display the profile"},
          {"script", "Read perf.data (created by perf record) and display trace output"},
          {"stat", "Run a command and gather performance counter statistics"},
          {"test", "Runs sanity tests."},
          {"top", "System profiling tool."},
          {"version", "display the version of perf binary"},
        #ifdef HAVE_LIBELF_SUPPORT
          {"probe", "Define new dynamic tracepoints"},
        #endif /* HAVE_LIBELF_SUPPORT */
        #if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))
          {"trace", "strace inspired tool"},
        #endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */
        #ifdef HAVE_LIBTRACEEVENT
          {"kmem", "Tool to trace/measure kernel memory properties"},
          {"kwork", "Tool to trace/measure kernel work properties (latencies)"},
          {"lock", "Analyze lock events"},
          {"sched", "Tool to trace/measure scheduler properties (latencies)"},
          {"timechart", "Tool to visualize total system behavior during a workload"},
        #endif /* HAVE_LIBTRACEEVENT */
        };
      
      Fixes: 378ef0f5 ("perf build: Use libtraceevent from the system")
      Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221226085703.95081-1-yangjihong1@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      55c41f2e
    • Eric Lin's avatar
      perf tools riscv: Fix build error on riscv due to missing header for 'struct perf_sample' · a8f54d94
      Eric Lin authored
      Since the definition of 'struct perf_sample' has been moved to sample.h,
      we need to include this header file to fix the build error as follows:
      
        arch/riscv/util/unwind-libdw.c: In function 'libdw__arch_set_initial_registers':
        arch/riscv/util/unwind-libdw.c:12:50: error: invalid use of undefined type 'struct perf_sample'
           12 |         struct regs_dump *user_regs = &ui->sample->user_regs;
              |                                                  ^~
      
      Fixes: 9823147d ("perf tools: Move 'struct perf_sample' to a separate header file to disentangle headers")
      Signed-off-by: default avatarEric Lin <eric.lin@sifive.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: greentime.hu@sifive.com
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: linux-riscv@lists.infradead.org
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vincent Chen <vincent.chen@sifive.com>
      Link: https://lore.kernel.org/r/20221231052731.24908-1-eric.lin@sifive.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a8f54d94
    • Miaoqian Lin's avatar
      perf tools: Fix resources leak in perf_data__open_dir() · 0a6564eb
      Miaoqian Lin authored
      In perf_data__open_dir(), opendir() opens the directory stream.  Add
      missing closedir() to release it after use.
      
      Fixes: eb617670 ("perf data: Add perf_data__open_dir_data function")
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221229090903.1402395-1-linmq006@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a6564eb
  2. 01 Jan, 2023 6 commits
  3. 31 Dec, 2022 2 commits
  4. 30 Dec, 2022 19 commits
  5. 29 Dec, 2022 3 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 2258c2dc
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Changes that were posted too late for 6.1, or after the release.
      
        x86:
      
         - several fixes to nested VMX execution controls
      
         - fixes and clarification to the documentation for Xen emulation
      
         - do not unnecessarily release a pmu event with zero period
      
         - MMU fixes
      
         - fix Coverity warning in kvm_hv_flush_tlb()
      
        selftests:
      
         - fixes for the ucall mechanism in selftests
      
         - other fixes mostly related to compilation with clang"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (41 commits)
        KVM: selftests: restore special vmmcall code layout needed by the harness
        Documentation: kvm: clarify SRCU locking order
        KVM: x86: fix deadlock for KVM_XEN_EVTCHN_RESET
        KVM: x86/xen: Documentation updates and clarifications
        KVM: x86/xen: Add KVM_XEN_INVALID_GPA and KVM_XEN_INVALID_GFN to uapi
        KVM: x86/xen: Simplify eventfd IOCTLs
        KVM: x86/xen: Fix SRCU/RCU usage in readers of evtchn_ports
        KVM: x86/xen: Use kvm_read_guest_virt() instead of open-coding it badly
        KVM: x86/xen: Fix memory leak in kvm_xen_write_hypercall_page()
        KVM: Delete extra block of "};" in the KVM API documentation
        kvm: x86/mmu: Remove duplicated "be split" in spte.h
        kvm: Remove the unused macro KVM_MMU_READ_{,UN}LOCK()
        MAINTAINERS: adjust entry after renaming the vmx hyperv files
        KVM: selftests: Mark correct page as mapped in virt_map()
        KVM: arm64: selftests: Don't identity map the ucall MMIO hole
        KVM: selftests: document the default implementation of vm_vaddr_populate_bitmap
        KVM: selftests: Use magic value to signal ucall_alloc() failure
        KVM: selftests: Disable "gnu-variable-sized-type-not-at-end" warning
        KVM: selftests: Include lib.mk before consuming $(CC)
        KVM: selftests: Explicitly disable builtins for mem*() overrides
        ...
      2258c2dc
    • Jens Axboe's avatar
      Merge tag 'nvme-6.2-2022-12-29' of git://git.infradead.org/nvme into block-6.2 · 1551ed5a
      Jens Axboe authored
      Pull NVMe fixes from Christoph:
      
      "nvme fixes for Linux 6.2
      
       - fix various problems in handling the Command Supported and Effects log
         (Christoph Hellwig)
       - don't allow unprivileged passthrough of commands that don't transfer
         data but modify logical block content (Christoph Hellwig)
       - add a features and quirks policy document (Christoph Hellwig)
       - fix some really nasty code that was correct but made smatch complain
         (Sagi Grimberg)"
      
      * tag 'nvme-6.2-2022-12-29' of git://git.infradead.org/nvme:
        nvme-auth: fix smatch warning complaints
        nvme: consult the CSE log page for unprivileged passthrough
        nvme: also return I/O command effects from nvme_command_effects
        nvmet: don't defer passthrough commands with trivial effects to the workqueue
        nvmet: set the LBCC bit for commands that modify data
        nvmet: use NVME_CMD_EFFECTS_CSUPP instead of open coding it
        nvme: fix the NVME_CMD_EFFECTS_CSE_MASK definition
        docs, nvme: add a feature and quirk policy document
      1551ed5a
    • Bhaskar Chowdhury's avatar
      kconfig: Add static text for search information in help menu · da8daff9
      Bhaskar Chowdhury authored
      Add few static text to explain how one can bring up the search dialog
      box by pressing the forward slash key anywhere on this interface.
      Signed-off-by: default avatarBhaskar Chowdhury <unixbhaskar@gmail.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      da8daff9
  6. 28 Dec, 2022 5 commits