1. 21 Mar, 2024 32 commits
    • Namhyung Kim's avatar
      perf annotate-data: Introduce 'struct data_loc_info' · a3f4d5b5
      Namhyung Kim authored
      The find_data_type() needs many information to describe the location of
      the data.  Add the new 'struct data_loc_info' to pass those information at
      once.
      
      No functional changes intended.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-7-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a3f4d5b5
    • Namhyung Kim's avatar
      perf map: Add map__objdump_2rip() · 52a09bc2
      Namhyung Kim authored
      Sometimes we want to convert an address in objdump output to
      map-relative address to match with a sample data.  Let's add
      map__objdump_2rip() for that.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-6-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      52a09bc2
    • Namhyung Kim's avatar
      perf dwarf-aux: Add die_find_func_rettype() · 7a838c2f
      Namhyung Kim authored
      The die_find_func_rettype() is to find a debug entry for the given
      function name and sets the type information of the return value.  By
      convention, it'd return the pointer to the type die (should be the
      same as the given mem_die argument) if found, or NULL otherwise.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7a838c2f
    • Namhyung Kim's avatar
      perf dwarf-aux: Handle type transfer for memory access · 437683a9
      Namhyung Kim authored
      We want to track type states as instructions are executed.  Each
      instruction can access compound types like struct or union and load/
      store its members to a different location.
      
      The die_deref_ptr_type() is to find a type of memory access with a
      pointer variable.  If it points to a compound type like struct, the
      target memory is a member in the struct.  The access will happen with an
      offset indicating which member it refers.  Let's follow the DWARF info
      to figure out the type of the pointer target.
      
      For example, say we have the following code.
      
        struct foo {
          int a;
          int b;
        };
      
        struct foo *p = malloc(sizeof(*p));
        p->b = 0;
      
      The last pointer access should produce x86 asm like below:
      
        mov  0x0, 4(%rbx)
      
      And we know %rbx register has a pointer to struct foo.  Then offset 4
      should return the debug info of member 'b'.
      
      Also variables of compound types can be accessed directly without a
      pointer.  The die_get_member_type() is to handle a such case.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-4-namhyung@kernel.org
      [ Check if die_get_real_type() returned NULL ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      437683a9
    • Namhyung Kim's avatar
      perf dwarf-aux: Add die_collect_vars() · 932dcc2c
      Namhyung Kim authored
      The die_collect_vars() is to find all variable information in the scope
      including function parameters.  The struct die_var_type is to save the
      type of the variable with the location (reg and offset) as well as where
      it's defined in the code (addr).
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      932dcc2c
    • Namhyung Kim's avatar
      perf dwarf-aux: Remove unused pc argument · b508965d
      Namhyung Kim authored
      It's not used, let's get rid of it.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20240319055115.4063940-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b508965d
    • Ian Rogers's avatar
      perf cpumap: Use perf_cpu_map__for_each_cpu when possible · 71bc3ac8
      Ian Rogers authored
      Rather than manually iterating the CPU map, use
      perf_cpu_map__for_each_cpu(). When possible tidy local variables.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      71bc3ac8
    • Ian Rogers's avatar
      perf stat: Remove duplicate cpus_map_matched function · 954ac1b4
      Ian Rogers authored
      Use libperf's perf_cpu_map__equal() that performs the same function.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      954ac1b4
    • Ian Rogers's avatar
      perf arm64 header: Remove unnecessary CPU map get and put · 4ddccd00
      Ian Rogers authored
      In both cases the CPU map is known owned by either the caller or a
      PMU.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4ddccd00
    • Ian Rogers's avatar
      perf cpumap: Clean up use of perf_cpu_map__has_any_cpu_or_is_empty · 3e5deb70
      Ian Rogers authored
      Most uses of what was perf_cpu_map__empty but is now
      perf_cpu_map__has_any_cpu_or_is_empty want to do something with the
      CPU map if it contains CPUs. Replace uses of
      perf_cpu_map__has_any_cpu_or_is_empty with other helpers so that CPUs
      within the map can be handled.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3e5deb70
    • Ian Rogers's avatar
      perf intel-pt/intel-bts: Switch perf_cpu_map__has_any_cpu_or_is_empty use · 291dcd77
      Ian Rogers authored
      Switch perf_cpu_map__has_any_cpu_or_is_empty() to
      perf_cpu_map__is_any_cpu_or_is_empty() as a CPU map may contain CPUs as
      well as the dummy event and perf_cpu_map__is_any_cpu_or_is_empty() is a
      more correct alternative.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      291dcd77
    • Ian Rogers's avatar
      perf arm-spe/cs-etm: Directly iterate CPU maps · e28ee123
      Ian Rogers authored
      Rather than iterate all CPUs and see if they are in CPU maps, directly
      iterate the CPU map. Similarly make use of the intersect function
      taking care for when "any" CPU is specified. Switch
      perf_cpu_map__has_any_cpu_or_is_empty() to more appropriate
      alternatives.
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e28ee123
    • Ian Rogers's avatar
      libperf cpumap: Ensure empty cpumap is NULL from alloc · dcd45b37
      Ian Rogers authored
      Potential corner cases could cause a cpumap to be allocated with size
      0, but an empty cpumap should be represented as NULL. Add a path in
      perf_cpu_map__alloc() to ensure this.
      Suggested-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Closes: https://lore.kernel.org/lkml/2cd09e7c-eb88-6726-6169-647dcd0a8101@arm.com/
      Link: https://lore.kernel.org/r/20240202234057.2085863-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dcd45b37
    • Ian Rogers's avatar
      libperf cpumap: Add any, empty and min helpers · b6b4a62d
      Ian Rogers authored
      Additional helpers to better replace perf_cpu_map__has_any_cpu_or_is_empty().
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
      Cc: Andrew Jones <ajones@ventanamicro.com>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Atish Patra <atishp@rivosinc.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paran Lee <p4ranlee@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yang Li <yang.lee@linux.alibaba.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Link: https://lore.kernel.org/r/20240202234057.2085863-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b6b4a62d
    • Ethan Adams's avatar
      perf build: Fix out of tree build related to installation of sysreg-defs · efae55bb
      Ethan Adams authored
      It seems that a previous modification to sysreg-defs, which corrected
      emitting the header to the specified output directory, exposed missing
      subdir, prefix variables.
      
      This breaks out of tree builds of perf as the file is now built into the
      output directory, but still tries to descend into output directory as a
      subdir.
      
      Fixes: a29ee6ae ("perf build: Ensure sysreg-defs Makefile respects output dir")
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Reviewed-by: default avatarTycho Andersen <tycho@tycho.pizza>
      Signed-off-by: default avatarEthan Adams <j.ethan.adams@gmail.com>
      Tested-by: default avatarTycho Andersen <tycho@tycho.pizza>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240314222012.47193-1-j.ethan.adams@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      efae55bb
    • Adrian Hunter's avatar
      perf auxtrace: Fix multiple use of --itrace option · bb69c912
      Adrian Hunter authored
      If the --itrace option is used more than once, the options are
      combined, but "i" and "y" (sub-)options can be corrupted because
      itrace_do_parse_synth_opts() incorrectly overwrites the period type and
      period with default values.
      
      For example, with:
      
      	--itrace=i0ns --itrace=e
      
      The processing of "--itrace=e", resets the "i" period from 0 nanoseconds
      to the default 100 microseconds.
      
      Fix by performing the default setting of period type and period only if
      "i" or "y" are present in the currently processed --itrace value.
      
      Fixes: f6986c95 ("perf session: Add instruction tracing options")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240315071334.3478-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bb69c912
    • Adrian Hunter's avatar
      perf script: Show also errors for --insn-trace option · d4a98b45
      Adrian Hunter authored
      The trace could be misleading if trace errors are not taken into
      account, so display them also by adding the itrace "e" option.
      
      Note --call-trace and --call-ret-trace already add the itrace "e"
      option.
      
      Fixes: b585ebdb ("perf script: Add --insn-trace for instruction decoding")
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20240315071334.3478-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d4a98b45
    • James Clark's avatar
      perf docs arm_spe: Clarify more SPE requirements related to KPTI · 36f65f9b
      James Clark authored
      The question of exactly when KPTI needs to be disabled comes up a lot
      because it doesn't always need to be done. Add the relevant kernel
      function and some examples that describe the behavior.
      
      Also describe the interrupt requirement and that no error message will
      be printed if this isn't met.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@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/20240312132508.423320-1-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      36f65f9b
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines · a672af91
      Arnaldo Carvalho de Melo authored
      These were used to build perf to provide defines not available in older
      distros, but this was back in 2017, nowadays most the distros that are
      supported and I have build containers for work using just the system
      headers, so ditch them.
      
      For the few that don't have STATX_MNT_ID{_UNIQUE}, or STATX_MNT_DIOALIGN
      add them conditionally.
      
      Some of these older distros may not have things that are used in 'perf
      trace', but then they also don't have libtraceevent packages, so don't
      build 'perf trace'.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240315204835.748716-6-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a672af91
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Remove now unused copies of uapi/{fcntl,openat2}.h and asm/fcntl.h · 8a1ad441
      Arnaldo Carvalho de Melo authored
      These were used to build perf to provide defines not available in older
      distros, but this was back in 2017, nowadays all the distros that are
      supported and I have build containers for work using just the system
      headers, so ditch them.
      
      Some of these older distros may not have things that are used in 'perf
      trace', but then they also don't have libtraceevent packages, so don't
      build 'perf trace'.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240315204835.748716-5-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a1ad441
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Use the system linux/fcntl.h instead of a copy from the kernel · 6652830c
      Arnaldo Carvalho de Melo authored
      Builds ok all the way back to these older distros:
      
         1  almalinux:8    : Ok  gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20) , clang version 16.0.6 (Red Hat 16.0.6-2.module_el8.9.0+3621+df7f7146) flex 2.6.1
         3  alpine:3.15    : Ok  gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027 , Alpine clang version 12.0.1 flex 2.6.4
        15  debian:10      : Ok  gcc (Debian 8.3.0-6) 8.3.0 , Debian clang version 11.0.1-2~deb10u1 flex 2.6.4
        32  opensuse:15.4  : Ok  gcc (SUSE Linux) 7.5.0 , clang version 15.0.7 flex 2.6.4
        23  fedora:35      : Ok  gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-3) , clang version 13.0.1 (Fedora 13.0.1-1.fc35) flex 2.6.4
        38  ubuntu:18.04   : Ok  gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0  flex 2.6.4
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20240315204835.748716-4-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6652830c
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move prctl.h files (uapi/linux and x86's) copy out of the directory used to build perf · eb01fe7a
      Arnaldo Carvalho de Melo authored
      It is used only to generate string tables, not to build perf, so move it
      to the tools/perf/trace/beauty/{include,arch}/ hierarchies, that is used
      just for scraping.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      
      No other tools/ living code uses it, just <linux/usbdevice_fs.h> coming
      from either 'make install_headers' or from the system /usr/include/
      directory.
      Suggested-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: https://lore.kernel.org/lkml/20240315204835.748716-3-acme@kernel.org
      Link: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      eb01fe7a
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Stop using the copy of uapi/linux/prctl.h · f324b73c
      Arnaldo Carvalho de Melo authored
      Use the system one, nothing used in that file isn't available in the
      supported, active distros.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      To: Ian Rogers <irogers@google.com>
      Link: https://lore.kernel.org/lkml/20240315204835.748716-3-acme@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f324b73c
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move arch/x86/include/asm/irq_vectors.h copy out of the directory used to build perf · c8bfe3fa
      Arnaldo Carvalho de Melo authored
      It is used only to generate string tables, not to build perf, so move it
      to the tools/perf/trace/beauty/include/ hierarchy, that is used just for
      scraping.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      
      No other tools/ living code uses it.
      Suggested-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-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: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c8bfe3fa
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move uapi/sound/asound.h copy out of the directory used to build perf · 7050e33e
      Arnaldo Carvalho de Melo authored
      It is used only to generate string tables, not to build perf, so move it
      to the tools/perf/trace/beauty/include/ hierarchy, that is used just for
      scraping.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      Suggested-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-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: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7050e33e
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move uapi/linux/usbdevice_fs.h copy out of the directory used to build perf · 44512bd6
      Arnaldo Carvalho de Melo authored
      It is mostly used only to generate string tables, not to build perf, so
      move it to the tools/perf/trace/beauty/include/ hierarchy, that is used
      just for scraping.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      
      No other tools/ living code uses it, just <linux/usbdevice_fs.h> coming
      from either 'make install_headers' or from the system /usr/include/
      directory.
      Suggested-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-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: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      44512bd6
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move uapi/linux/mount.h copy out of the directory used to build perf · ab331611
      Arnaldo Carvalho de Melo authored
      It is mostly used only to generate string tables, not to build perf, so
      move it to the tools/perf/trace/beauty/include/ hierarchy, that is used
      just for scraping.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      
      No other tools/ living code uses it, just <linux/mount.h> coming from
      either 'make install_headers' or from the system /usr/include/
      directory.
      Suggested-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: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ab331611
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Don't include uapi/linux/mount.h, use sys/mount.h instead · 22916d2c
      Arnaldo Carvalho de Melo authored
      The tools/include/uapi/linux/mount.h file is mostly used for scrapping
      defines into id->string tables, this is the only place were it is being
      directly used, stop doing so.
      
      Define MOUNT_ATTR_RELATIME and MOUNT_ATTR__ATIME if not available in the
      system's headers.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      22916d2c
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Move uapi/linux/fs.h copy out of the directory used to build perf · faf7217a
      Arnaldo Carvalho de Melo authored
      It is mostly used only to generate string tables, not to build perf, so
      move it to the tools/perf/trace/beauty/include/ hierarchy, that is used
      just for scraping.
      
      The only case where it was being used to build was in
      tools/perf/trace/beauty/sync_file_range.c, because some older systems
      doesn't have the SYNC_FILE_RANGE_WRITE_AND_WAIT define, just use the
      system's linux/fs.h header instead, defining it if not available.
      
      This is a something that should've have happened, as happened with the
      linux/socket.h scrapper, do it now as Ian suggested while doing an
      audit/refactor session in the headers used by perf.
      
      No other tools/ living code uses it, just <linux/fs.h> coming from
      either 'make install_headers' or from the system /usr/include/
      directory.
      Suggested-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-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: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      faf7217a
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Fix dependency of tables using uapi/linux/mount.h · 5d8c6460
      Arnaldo Carvalho de Melo authored
      Several such tables were depending on uapi/linux/fs.h, cut and paste
      error when they were introduced, fix it.
      
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/Ze9vjxv42PN_QGZv@x1Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d8c6460
    • Bhaskar Chowdhury's avatar
      perf c2c: Fix a punctuation · 4b3761ee
      Bhaskar Chowdhury authored
      s/dont/don\'t/
      Signed-off-by: default avatarBhaskar Chowdhury <unixbhaskar@gmail.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@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/20210319232824.742-1-unixbhaskar@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4b3761ee
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Collect sys_nanosleep first argument · a9f4c6c9
      Arnaldo Carvalho de Melo authored
      That is a 'struct timespec' passed from userspace to the kernel as we
      can see with a system wide syscall tracing:
      
        root@number:~# perf trace -e nanosleep
             0.000 (10.102 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
            38.924 (10.077 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           100.177 (10.107 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           139.171 (10.063 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           200.603 (10.105 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           239.399 (10.064 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           300.994 (10.096 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           339.584 (10.067 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           401.335 (10.057 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           439.758 (10.166 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           501.814 (10.110 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           539.983 (10.227 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           602.284 (10.199 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           640.208 (10.105 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           702.662 (10.163 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           740.440 (10.107 ms): podman/2195174 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
           802.993 (10.159 ms): podman/9150 nanosleep(rqtp: { .tv_sec: 0, .tv_nsec: 10000000 })                   = 0
        ^Croot@number:~# strace -p 9150 -e nanosleep
      
      If we then use the ptrace method to look at that podman process:
      
        root@number:~# strace -p 9150 -e nanosleep
        strace: Process 9150 attached
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0
        ^Cstrace: Process 9150 detached
        root@number:~#
      
      With some changes we can get something closer to the strace output,
      still in system wide mode:
      
        root@number:~# perf config trace.show_arg_names=false
        root@number:~# perf config trace.show_duration=false
        root@number:~# perf config trace.show_timestamp=false
        root@number:~# perf config trace.show_zeros=true
        root@number:~# perf config trace.args_alignment=0
        root@number:~# perf trace -e nanosleep --max-events=10
        podman/2195174 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/9150 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/2195174 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/9150 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/2195174 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/9150 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/2195174 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/9150 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/2195174 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        podman/9150 nanosleep({ .tv_sec: 0, .tv_nsec: 10000000 }, NULL) = 0
        root@number:~#
        root@number:~# perf config
        trace.show_arg_names=false
        trace.show_duration=false
        trace.show_timestamp=false
        trace.show_zeros=true
        trace.args_alignment=0
        root@number:~# cat ~/.perfconfig
        # this file is auto-generated.
        [trace]
        	show_arg_names = false
        	show_duration = false
        	show_timestamp = false
        	show_zeros = true
        	args_alignment = 0
        root@number:~#
      
      This will not get reused by any other syscall as nanosleep is the only
      one to have as its first argument a 'struct timespec" pointer argument
      passed from userspace to the kernel:
      
        root@number:~# grep timespec /sys/kernel/tracing/events/syscalls/sys_enter_*/format | grep offset:16
        /sys/kernel/tracing/events/syscalls/sys_enter_nanosleep/format:	field:struct __kernel_timespec * rqtp;	offset:16;	size:8;	signed:0;
        root@number:~#
      
      BTF based pretty printing will simplify all this, but then lets just get
      the low hanging fruits first.
      Reviewed-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: https://lore.kernel.org/lkml/Zbq72dJRpOlfRWnf@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a9f4c6c9
  2. 20 Mar, 2024 8 commits
    • Linus Torvalds's avatar
      Merge tag 'v6.9-rc-smb3-server-fixes' of git://git.samba.org/ksmbd · 23956900
      Linus Torvalds authored
      Pull smb server updates from Steve French:
      
       - add support for durable file handles (an important data integrity
         feature)
      
       - fixes for potential out of bounds issues
      
       - fix possible null dereference in close
      
       - getattr fixes
      
       - trivial typo fix and minor cleanup
      
      * tag 'v6.9-rc-smb3-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: remove module version
        ksmbd: fix potencial out-of-bounds when buffer offset is invalid
        ksmbd: fix slab-out-of-bounds in smb_strndup_from_utf16()
        ksmbd: Fix spelling mistake "connction" -> "connection"
        ksmbd: fix possible null-deref in smb_lazy_parent_lease_break_close
        ksmbd: add support for durable handles v1/v2
        ksmbd: mark SMB2_SESSION_EXPIRED to session when destroying previous session
        ksmbd: retrieve number of blocks using vfs_getattr in set_file_allocation_info
        ksmbd: replace generic_fillattr with vfs_getattr
      23956900
    • Linus Torvalds's avatar
      Merge tag 'trace-tools-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 42c2a756
      Linus Torvalds authored
      Pull trace tool updates from Steven Rostedt:
       "Tracing:
      
         - Update makefiles for latency-collector and RTLA, using tools/build/
           makefiles like perf does, inheriting its benefits. For example,
           having a proper way to handle library dependencies.
      
         - The timerlat tracer has an interface for any tool to use. rtla
           timerlat tool uses this interface dispatching its own threads as
           workload. But, rtla timerlat could also be used for any other
           process. So, add 'rtla timerlat -U' option, allowing the timerlat
           tool to measure the latency of any task using the timerlat tracer
           interface.
      
        Verification:
      
         - Update makefiles for verification/rv, using tools/build/ makefiles
           like perf does, inheriting its benefits. For example, having a
           proper way to handle dependencies"
      
      * tag 'trace-tools-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tools/rtla: Add -U/--user-load option to timerlat
        tools/verification: Use tools/build makefiles on rv
        tools/rtla: Use tools/build makefiles to build rtla
        tools/tracing: Use tools/build makefiles on latency-collector
      42c2a756
    • Linus Torvalds's avatar
      Merge tag 'docs-6.9-2' of git://git.lwn.net/linux · dba89d1b
      Linus Torvalds authored
      Pull more documentation updates from Jonathan Corbet:
       "A handful of late-arriving documentation fixes and enhancements"
      
      * tag 'docs-6.9-2' of git://git.lwn.net/linux:
        docs: verify/bisect: remove a level of indenting
        docs: verify/bisect: drop 'v' prefix, EOL aspect, and assorted fixes
        docs: verify/bisect: check taint flag
        docs: verify/bisect: improve install instructions
        docs: handling-regressions.rst: Update regzbot command fixed-by to fix
        docs: *-regressions.rst: Add colon to regzbot commands
        doc: Fix typo in admin-guide/cifs/introduction.rst
        README: Fix spelling
      dba89d1b
    • Daniel Bristot de Oliveira's avatar
      tools/rtla: Add -U/--user-load option to timerlat · a23c05fd
      Daniel Bristot de Oliveira authored
      The timerlat tracer provides an interface for any application to wait
      for the timerlat's periodic wakeup. Currently, rtla timerlat uses it
      to dispatch its user-space workload (-u option).
      
      But as the tracer interface is generic, rtla timerlat can also be used
      to monitor any workload that uses it. For example, a user might
      place their own workload to wait on the tracer interface, and
      monitor the results with rtla timerlat.
      
      Add the -U option to rtla timerlat top and hist. With this option, rtla
      timerlat will not dispatch its workload but only setting up the
      system, waiting for a user to dispatch its workload.
      
      The sample code in this patch is an example of python application
      that loops in the timerlat tracer fd.
      
      To use it, dispatch:
      
       # rtla timerlat -U
      
      In a terminal, then run the python program on another terminal,
      specifying the CPU to run it. For example, setting on CPU 1:
      
       #./timerlat_load.py 1
      
      Then rtla timerlat will start printing the statistics of the
      ./timerlat_load.py app.
      
      An interesting point is that the "Ret user Timer Latency" value
      is the overall response time of the load. The sample load does
      a memory copy to exemplify that.
      
      The stop tracing options on rtla timerlat works in this setup
      as well, including auto analysis.
      
      Link: https://lkml.kernel.org/r/36e6bcf18fe15c7601048fd4c65aeb193c502cc8.1707229706.git.bristot@kernel.org
      
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      a23c05fd
    • Daniel Bristot de Oliveira's avatar
      tools/verification: Use tools/build makefiles on rv · 012e4e77
      Daniel Bristot de Oliveira authored
      Use tools/build/ makefiles to build rv, inheriting the benefits of
      it. For example, having a proper way to handle dependencies.
      
      Link: https://lkml.kernel.org/r/2a38a8f7b8dc65fa790381ec9ab42fb62beb2e25.1710519524.git.bristot@kernel.org
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      012e4e77
    • Daniel Bristot de Oliveira's avatar
      tools/rtla: Use tools/build makefiles to build rtla · 01474dc7
      Daniel Bristot de Oliveira authored
      Use tools/build/ makefiles to build rtla, inheriting the benefits of
      it. For example, having a proper way to handle dependencies.
      
      rtla is built using perf infra-structure when building inside the
      kernel tree.
      
      At this point, rtla diverges from perf in two points: Documentation
      and tarball generation/build.
      
      At the documentation level, rtla is one step ahead, placing the
      documentation at Documentation/tools/rtla/, using the same build
      tools as kernel documentation. The idea is to move perf
      documentation to the same scheme and then share the same makefiles.
      
      rtla has a tarball target that the (old) RHEL8 uses. The tarball was
      kept using a simple standalone makefile for compatibility. The
      standalone makefile shares most of the code, e.g., flags, with
      regular buildings.
      
      The tarball method was set as deprecated. If necessary, we can make
      a rtla tarball like perf, which includes the entire tools/build.
      But this would also require changes in the user side (the directory
      structure changes, and probably the deps to build the package).
      
      Inspired on perf and objtool.
      
      Link: https://lkml.kernel.org/r/57563abf2715d22515c0c54a87cff3849eca5d52.1710519524.git.bristot@kernel.org
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      01474dc7
    • Daniel Bristot de Oliveira's avatar
      tools/tracing: Use tools/build makefiles on latency-collector · 9d56c88e
      Daniel Bristot de Oliveira authored
      Use tools/build/ makefiles to build latency-collector, inheriting
      the benefits of it. For example: Before this patch, a missing
      tracefs/traceevents headers will result in fail like this:
      
        ~/linux/tools/tracing/latency $ make
        cc -Wall -Wextra -g -O2  -o latency-collector latency-collector.c -lpthread
        latency-collector.c:26:10: fatal error: tracefs.h: No such file or directory
           26 | #include <tracefs.h>
              |          ^~~~~~~~~~~
        compilation terminated.
        make: *** [Makefile:14: latency-collector] Error 1
      
      Which is not that helpful. After this change it reports:
      
        ~/linux/tools/tracing/latency# make
      
        Auto-detecting system features:
        ...                           libtraceevent: [ OFF ]
        ...                              libtracefs: [ OFF ]
      
        libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel
        libtracefs is missing. Please install libtracefs-dev/libtracefs-devel
        Makefile.config:29: *** Please, check the errors above..  Stop.
      
      This type of output is common across other tools in tools/ like perf
      and objtool.
      
      Link: https://lkml.kernel.org/r/872420b0880b11304e4ba144a0086c6478c5b469.1710519524.git.bristot@kernel.org
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      9d56c88e
    • Linus Torvalds's avatar
      Merge tag 'bcachefs-2024-03-19' of https://evilpiepirate.org/git/bcachefs · a4145ce1
      Linus Torvalds authored
      Pull bcachefs fixes from Kent Overstreet:
       "Assorted bugfixes.
      
        Most are fixes for simple assertion pops; the most significant fix is
        for a deadlock in recovery when we have to rewrite large numbers of
        btree nodes to fix errors. This was incorrectly running out of the
        same workqueue as the core interior btree update path - we now give it
        its own single threaded workqueue.
      
        This was visible to users as "bch2_btree_update_start(): error:
        BCH_ERR_journal_reclaim_would_deadlock" - and then recovery hanging"
      
      * tag 'bcachefs-2024-03-19' of https://evilpiepirate.org/git/bcachefs:
        bcachefs: Fix lost wakeup on journal shutdown
        bcachefs; Fix deadlock in bch2_btree_update_start()
        bcachefs: ratelimit errors from async_btree_node_rewrite
        bcachefs: Run check_topology() first
        bcachefs: Improve bch2_fatal_error()
        bcachefs: Fix lost transaction restart error
        bcachefs: Don't corrupt journal keys gap buffer when dropping alloc info
        bcachefs: fix for building in userspace
        bcachefs: bch2_snapshot_is_ancestor() now safe to call in early recovery
        bcachefs: Fix nested transaction restart handling in bch2_bucket_gens_init()
        bcachefs: Improve sysfs internal/btree_updates
        bcachefs: Split out btree_node_rewrite_worker
        bcachefs: Fix locking in bch2_alloc_write_key()
        bcachefs: Avoid extent entry type assertions in .invalid()
        bcachefs: Fix spurious -BCH_ERR_transaction_restart_nested
        bcachefs: Fix check_key_has_snapshot() call
        bcachefs: Change "accounting overran journal reservation" to a warning
      a4145ce1