1. 26 Mar, 2022 5 commits
    • Kim Phillips's avatar
      perf evsel: Improve AMD IBS (Instruction-Based Sampling) error handling messages · ab0809af
      Kim Phillips authored
      Improve the error message returned on failed perf_event_open() on AMD
      systems when using IBS (Instruction-Based Sampling).
      
      Output of executing 'perf record -e ibs_op// true' as a non root user
      BEFORE this patch (perf will add the 'u' modifier at the end to exclude
      kernel/hypervisor sampling):
      
        The sys_perf_event_open() syscall returned with 22 (Invalid argument)for event (ibs_op//u).
        /bin/dmesg | grep -i perf may provide additional information.
      
      Output after:
      
        AMD IBS can't exclude kernel events.  Try running at a higher privilege level.
      
      Output of executing 'sudo perf record -e ibs_op// true' BEFORE this patch:
      
        Error:
        The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (ibs_op//).
        /bin/dmesg | grep -i perf may provide additional information.
      
      Output after:
      
        Error:
        Invalid event (ibs_op//) in per-thread mode, enable system wide with '-a'.
      
      Folowing the suggestion:
      
        $ sudo perf record -a -e ibs_op// true
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.664 MB perf.data (194 samples) ]
        $
      Signed-off-by: default avatarKim Phillips <kim.phillips@amd.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: João Martins <joao.m.martins@oracle.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20220322221517.2510440-12-eranian@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ab0809af
    • Arnaldo Carvalho de Melo's avatar
      perf python: Add perf_env stubs that will be needed in evsel__open_strerror() · b58230de
      Arnaldo Carvalho de Melo authored
      The AMD IBS error message enhancements will use these, but we're not
      using evsel__open_strerror() in the python binding so far.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b58230de
    • Wei Li's avatar
      perf tools: Enhance the matching of sub-commands abbreviations · ae0f4eb3
      Wei Li authored
      We support short command 'rec*' for 'record' and 'rep*' for 'report' in
      lots of sub-commands, but the matching is not quite strict currnetly.
      
      It may be puzzling sometime, like we mis-type a 'recport' to report but
      it will perform 'record' in fact without any message.
      
      To fix this, add a check to ensure that the short cmd is valid prefix
      of the real command.
      
      Committer testing:
      
        [root@quaco ~]# perf c2c re sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        # perf c2c rec sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.038 MB perf.data (16 samples) ]
        # perf c2c recport sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        # perf c2c record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.038 MB perf.data (15 samples) ]
        # perf c2c records sleep 1
      
         Usage: perf c2c {record|report}
      
            -v, --verbose         be more verbose (show counter open errors, etc)
      
        #
      Signed-off-by: default avatarWei Li <liwei391@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Rui Xiang <rui.xiang@huawei.com>
      Link: http://lore.kernel.org/lkml/20220325092032.2956161-1-liwei391@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ae0f4eb3
    • Shunsuke Nakamura's avatar
      libperf tests: Fix typo in perf_evlist__open() failure error messages · c2eeac98
      Shunsuke Nakamura authored
      This patch corrects typos in error messages. I should be "evlist", not
      "evsel" as the function that fails is perf_evlist__open().
      
      Fixes: 3ce311af ("libperf: Move to tools/lib/perf")
      Fixes: a7f3713f ("libperf tests: Add test_stat_multiplexing test")
      Signed-off-by: default avatarShunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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: http://lore.kernel.org/lkml/20220325043829.224045-2-nakamura.shun@fujitsu.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c2eeac98
    • Ali Saidi's avatar
      tools arm64: Import cputype.h · 1314376d
      Ali Saidi authored
      Bring-in the kernel's arch/arm64/include/asm/cputype.h into tools/
      for arm64 to make use of all the core-type definitions in perf.
      
      Replace sysreg.h with the version already imported into tools/.
      
      Committer notes:
      
      Added an entry to tools/perf/check-headers.sh, so that we get notified
      when the original file in the kernel sources gets modified.
      
      Tester notes:
      
      LGTM. I did the testing on both my x86 and Arm64 platforms, thanks for
      the fixing up.
      Signed-off-by: default avatarAli Saidi <alisaidi@amazon.com>
      Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrew Kilroy <andrew.kilroy@arm.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Li Huafei <lihuafei1@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick.Forrington@arm.com
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20220324183323.31414-2-alisaidi@amazon.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1314376d
  2. 25 Mar, 2022 3 commits
  3. 24 Mar, 2022 4 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · d16d30f4
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        fa31a4d6 ("x86/cpufeatures: Put the AMX macros in the word 18 block")
        7b8f40b3 ("x86/cpu: Add definitions for the Intel Hardware Feedback Interface")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jim Mattson <jmattson@google.com>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
      Link: https://lore.kernel.org/lkml/YjzZPxdyLjf76gM+@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d16d30f4
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · 1efe4cbd
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        7c1ef591 ("x86/cpufeatures: Re-enable ENQCMD")
      
      That causes only these 'perf bench' objects to rebuild:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
        diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
      
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Link: https://lore.kernel.org/lkml/YjzX+PknzGoKaGMX@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1efe4cbd
    • Thomas Richter's avatar
      perf stat: Fix forked applications enablement of counters · d0a0a511
      Thomas Richter authored
      I have run into the following issue:
      
       # perf stat -a -e new_pmu/INSTRUCTION_7/ --  mytest -c1 7
      
       Performance counter stats for 'system wide':
      
                       0      new_pmu/INSTRUCTION_7/
      
             0.000366428 seconds time elapsed
       #
      
      The new PMU for s390 counts the execution of certain CPU instructions.
      The root cause is the extremely small run time of the mytest program. It
      just executes some assembly instructions and then exits.
      
      In above invocation the instruction is executed exactly one time (-c1
      option). The PMU is expected to report this one time execution by a
      counter value of one, but fails to do so in some cases, not all.
      
      Debugging reveals the invocation of the child process is done
      *before* the counter events are installed and enabled.
      
      Tracing reveals that sometimes the child process starts and exits before
      the event is installed on all CPUs. The more CPUs the machine has, the
      more often this miscount happens.
      
      Fix this by reversing the start of the work load after the events have
      been installed on the specified CPUs. Now the comment also matches the
      code.
      
      Output after:
      
       # perf stat -a -e new_pmu/INSTRUCTION_7/ --  mytest -c1 7
      
       Performance counter stats for 'system wide':
      
                       1      new_pmu/INSTRUCTION_7/
      
             0.000366428 seconds time elapsed
       #
      
      Now the correct result is reported rock solid all the time regardless
      how many CPUs are online.
      
      Reviewers notes:
      
      Jiri:
      
      Right, without -a the event has enable_on_exec so the race does not
      matter, but it's a problem for system wide with fork.
      
      Namhyung:
      
      Agreed. Also we may move the enable_counters() and the clock code out of
      the if block to be shared with the else block.
      
      Fixes: acf28922 ("perf stat: Use perf_evlist__prepare/start_workload()")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220317155346.577384-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d0a0a511
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 61726144
      Arnaldo Carvalho de Melo authored
      To pick up the changes from these csets:
      
        7b8f40b3 ("x86/cpu: Add definitions for the Intel Hardware Feedback Interface")
      
      That cause no changes to tooling:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        $
      
      Just silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
        diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
      
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
      Link: https://lore.kernel.org/lkml/YjzVt8CjAORAsTCo@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      61726144
  4. 22 Mar, 2022 28 commits
    • Kim Phillips's avatar
      perf evsel: Make evsel__env() always return a valid env · 7b830875
      Kim Phillips authored
      It's possible to have an evsel and evsel->evlist populated without
      an evsel->evlist->env, when, e.g., cmd_record is in its error path.
      
      Future patches will add support for evsel__open_strerror to be able
      to customize error messaging based on perf_env__{arch,cpuid}, so
      let's have evsel__env return &perf_env instead of NULL in that case.
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarKim Phillips <kim.phillips@amd.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joao Martins <joao.m.martins@oracle.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20211004214114.188477-1-kim.phillips@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7b830875
    • Colin Ian King's avatar
      perf build-id: Fix spelling mistake "Cant" -> "Can't" · 011899cc
      Colin Ian King authored
      There is a spelling mistake in a pr_err message. Fix it.
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Acked-by: default avatarIan 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>
      Cc: kernel-janitors@vger.kernel.org
      Link: https://lore.kernel.org/r/20220316232452.53062-1-colin.i.king@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      011899cc
    • Colin Ian King's avatar
      perf header: Fix spelling mistake "could't" -> "couldn't" · ccbc9df9
      Colin Ian King authored
      There is a spelling mistake in a pr_debug2 message. Fix it.
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-janitors@vger.kernel.org
      Link: https://lore.kernel.org/r/20220316232212.52820-1-colin.i.king@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ccbc9df9
    • Kan Liang's avatar
      perf script: Add 'brstackinsnlen' for branch stacks · 6f680c6a
      Kan Liang authored
      When analyzing with 'perf script', it's useful to understand the
      captured instruction and the next sequential instruction.
      
      To calculate the address of the next sequential instruction, the length
      of the captured instruction is required.
      
      For example, you can’t know the next sequential instruction after an
      unconditional branch unless you calculate that based on its length.
      
      For branch stacks, 'perf script' only prints the instruction bytes with
      'brstackinsn', but lacks the instruction length.
      
      Add 'brstackinsnlen' to print the instruction length.
      
        $ perf script -F ip,brstackinsn,brstackinsnlen --xed
           7fa555be8f75
              _start:
              00007fa555be8090    mov %rsp, %rdi              ilen: 3
              00007fa555be8093    callq  0x7fa555be8ea0       ilen: 5 # PRED 102 cycles [102] 0.02 IPC
              _dl_start+38:
              00007fa555be8ec6    movq  %rdx,0x227853(%rip)   ilen: 7
              00007fa555be8ecd    leaq  0x227f94(%rip),%rdx   ilen: 7
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Ahmad Yasin <ahmad.yasin@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/1647871212-184070-1-git-send-email-kan.liang@linux.intel.com
      [ Added the new field to tools/perf/Documentation/perf-script.txt ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6f680c6a
    • Ian Rogers's avatar
      perf parse-events: Move slots only with topdown · bc355822
      Ian Rogers authored
      If slots isn't with a topdown event then moving it is unnecessary. For
      example {instructions, slots} is re-ordered:
      
        $ perf stat -e '{instructions,slots}' -a sleep 1
      
         Performance counter stats for 'system wide':
      
               936,600,825      slots
               144,440,968      instructions
      
               1.006061423 seconds time elapsed
      
      Which can break tools expecting the command line order to match the
      printed order. It is necessary to move the slots event first when it
      appears with topdown events. Add extra checking so that the slots event
      is only moved in the case of there being a topdown event like:
      
        $ perf stat -e '{instructions,slots,topdown-fe-bound}' -a sleep 1
      
         Performance counter stats for 'system wide':
      
                2427568570      slots
                 300927614      instructions
                 551021649      topdown-fe-bound
      
               1.001771803 seconds time elapsed
      
      Fixes: 94dbfd67 ("perf parse-events: Architecture specific leader override")
      Reported-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20220321223344.1034479-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bc355822
    • Arnaldo Carvalho de Melo's avatar
      Merge remote-tracking branch 'torvalds/master' into perf/core · 34fe4ccb
      Arnaldo Carvalho de Melo authored
      To pick up fixes that went thru perf/urgent and now are fixed by an
      upcoming patch.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      34fe4ccb
    • Namhyung Kim's avatar
      perf ftrace latency: Update documentation · feff0839
      Namhyung Kim authored
      Add description of 'perf ftrace latency' subcommand.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Changbin Du <changbin.du@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220321234609.90455-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      feff0839
    • Namhyung Kim's avatar
      perf ftrace latency: Add -n/--use-nsec option · 84005bb6
      Namhyung Kim authored
      Sometimes we want to see nano-second granularity.
      
        $ sudo perf ftrace latency -T dput -a sleep 1
        #   DURATION     |      COUNT | GRAPH                          |
             0 - 1    us |    2098375 | #############################  |
             1 - 2    us |         61 |                                |
             2 - 4    us |         33 |                                |
             4 - 8    us |         13 |                                |
             8 - 16   us |        124 |                                |
            16 - 32   us |        123 |                                |
            32 - 64   us |          1 |                                |
            64 - 128  us |          0 |                                |
           128 - 256  us |          1 |                                |
           256 - 512  us |          0 |                                |
           512 - 1024 us |          0 |                                |
             1 - 2    ms |          0 |                                |
             2 - 4    ms |          0 |                                |
             4 - 8    ms |          0 |                                |
             8 - 16   ms |          0 |                                |
            16 - 32   ms |          0 |                                |
            32 - 64   ms |          0 |                                |
            64 - 128  ms |          0 |                                |
           128 - 256  ms |          0 |                                |
           256 - 512  ms |          0 |                                |
           512 - 1024 ms |          0 |                                |
             1 - ...   s |          0 |                                |
      
        $ sudo perf ftrace latency -T dput -a -n sleep 1
        #   DURATION     |      COUNT | GRAPH                          |
             0 - 1    us |          0 |                                |
             1 - 2    ns |          0 |                                |
             2 - 4    ns |          0 |                                |
             4 - 8    ns |          0 |                                |
             8 - 16   ns |          0 |                                |
            16 - 32   ns |          0 |                                |
            32 - 64   ns |          0 |                                |
            64 - 128  ns |    1163434 | ##############                 |
           128 - 256  ns |     914102 | #############                  |
           256 - 512  ns |        884 |                                |
           512 - 1024 ns |        613 |                                |
             1 - 2    us |         31 |                                |
             2 - 4    us |         17 |                                |
             4 - 8    us |          7 |                                |
             8 - 16   us |        123 |                                |
            16 - 32   us |         83 |                                |
            32 - 64   us |          0 |                                |
            64 - 128  us |          0 |                                |
           128 - 256  us |          0 |                                |
           256 - 512  us |          0 |                                |
           512 - 1024 us |          0 |                                |
             1 - ...  ms |          0 |                                |
      
      Committer testing:
      
      Testing it with BPF:
      
        # perf ftrace latency -b -n -T dput -a sleep 1
        #   DURATION     |      COUNT | GRAPH                                          |
             0 - 1    us |          0 |                                                |
             1 - 2    ns |          0 |                                                |
             2 - 4    ns |          0 |                                                |
             4 - 8    ns |          0 |                                                |
             8 - 16   ns |          0 |                                                |
            16 - 32   ns |          0 |                                                |
            32 - 64   ns |          0 |                                                |
            64 - 128  ns |          0 |                                                |
           128 - 256  ns |     823489 | #############################################  |
           256 - 512  ns |       3232 |                                                |
           512 - 1024 ns |         51 |                                                |
             1 - 2    us |        172 |                                                |
             2 - 4    us |          9 |                                                |
             4 - 8    us |          0 |                                                |
             8 - 16   us |          2 |                                                |
            16 - 32   us |          0 |                                                |
            32 - 64   us |          0 |                                                |
            64 - 128  us |          0 |                                                |
           128 - 256  us |          0 |                                                |
           256 - 512  us |          0 |                                                |
           512 - 1024 us |          0 |                                                |
             1 - ...  ms |          0 |                                                |
        [root@quaco ~]# strace -e bpf perf ftrace latency -b -n -T dput -a sleep 1
        bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=2, insns=0x7ffe2bd574f0, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL, func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 144) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0\20\0\0\0\20\0\0\0\5\0\0\0\1\0\0\0\0\0\0\1"..., btf_log_buf=NULL, btf_size=45, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0000\0\0\0000\0\0\0\t\0\0\0\1\0\0\0\0\0\0\1"..., btf_log_buf=NULL, btf_size=81, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\08\0\0\08\0\0\0\t\0\0\0\0\0\0\0\0\0\0\1"..., btf_log_buf=NULL, btf_size=89, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0\f\0\0\0\f\0\0\0\7\0\0\0\1\0\0\0\0\0\0\20"..., btf_log_buf=NULL, btf_size=43, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0000\0\0\0000\0\0\0\t\0\0\0\1\0\0\0\0\0\0\1"..., btf_log_buf=NULL, btf_size=81, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0000\0\0\0000\0\0\0\5\0\0\0\0\0\0\0\0\0\0\1"..., btf_log_buf=NULL, btf_size=77, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0(\0\0\0(\0\0\0\5\0\0\0\0\0\0\0\0\0\0\1"..., btf_log_buf=NULL, btf_size=69, btf_log_size=0, btf_log_level=0}, 28) = -1 EINVAL (Invalid argument)
        bpf(BPF_BTF_LOAD, {btf="\237\353\1\0\30\0\0\0\0\0\0\0<\3\0\0<\3\0\0\362\3\0\0\0\0\0\0\0\0\0\2"..., btf_log_buf=NULL, btf_size=1862, btf_log_size=0, btf_log_level=0}, 28) = 3
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, value_size=4, max_entries=1, map_flags=BPF_F_MMAPABLE, inner_map_fd=0, map_name="", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 4
        bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=2, insns=0x7ffe2bd571c0, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="test", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL, func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 144) = 4
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=8, value_size=8, max_entries=10000, map_flags=0, inner_map_fd=0, map_name="functime", map_ifindex=0, btf_fd=3, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 4
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=4, value_size=1, max_entries=1, map_flags=0, inner_map_fd=0, map_name="cpu_filter", map_ifindex=0, btf_fd=3, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 5
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=4, value_size=1, max_entries=1, map_flags=0, inner_map_fd=0, map_name="task_filter", map_ifindex=0, btf_fd=3, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 7
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_PERCPU_ARRAY, key_size=4, value_size=8, max_entries=22, map_flags=0, inner_map_fd=0, map_name="latency", map_ifindex=0, btf_fd=3, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 8
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, value_size=32, max_entries=1, map_flags=0, inner_map_fd=0, map_name="", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 9
        bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_SOCKET_FILTER, insn_cnt=5, insns=0x7ffe2bd57220, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL, func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 144) = 10
        bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_ARRAY, key_size=4, value_size=16, max_entries=1, map_flags=BPF_F_MMAPABLE, inner_map_fd=0, map_name="func_lat.bss", map_ifindex=0, btf_fd=3, btf_key_type_id=0, btf_value_type_id=33, btf_vmlinux_value_type_id=0, map_extra=0}, 72) = 9
        bpf(BPF_MAP_UPDATE_ELEM, {map_fd=9, key=0x7ffe2bd57330, value=0x7f9a5fc39000, flags=BPF_ANY}, 144) = 0
        bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_KPROBE, insn_cnt=42, insns=0x113daf0, license="", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(5, 16, 13), prog_flags=0, prog_name="func_begin", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=3, func_info_rec_size=8, func_info=0x113fb70, func_info_cnt=1, line_info_rec_size=16, line_info=0x113fb90, line_info_cnt=21, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 144) = 10
        bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_KPROBE, insn_cnt=124, insns=0x113d360, license="", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(5, 16, 13), prog_flags=0, prog_name="func_end", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=3, func_info_rec_size=8, func_info=0x113fcf0, func_info_cnt=1, line_info_rec_size=16, line_info=0x1139770, line_info_cnt=60, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 144) = 11
        bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_TRACEPOINT, insn_cnt=2, insns=0x7ffe2bd57150, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(0, 0, 0), prog_flags=0, prog_name="", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL, func_info_cnt=0, line_info_rec_size=0, line_info=NULL, line_info_cnt=0, attach_btf_id=0, attach_prog_fd=0, fd_array=NULL}, 144) = 13
        bpf(BPF_LINK_CREATE, {link_create={prog_fd=13, target_fd=-1, attach_type=BPF_PERF_EVENT, flags=0}}, 144) = -1 EBADF (Bad file descriptor)
        bpf(BPF_LINK_CREATE, {link_create={prog_fd=10, target_fd=12, attach_type=BPF_PERF_EVENT, flags=0}}, 144) = 13
        bpf(BPF_LINK_CREATE, {link_create={prog_fd=11, target_fd=14, attach_type=BPF_PERF_EVENT, flags=0}}, 144) = 15
        --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=130075, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        bpf(BPF_MAP_LOOKUP_ELEM, {map_fd=8, key=0x7ffe2bd57624, value=0x113fdd0, flags=BPF_ANY}, 144) = 0
        #   DURATION     |      COUNT | GRAPH                                          |
             0 - 1    us |          0 |                                                |
             1 - 2    ns |          0 |                                                |
             2 - 4    ns |          0 |                                                |
             4 - 8    ns |          0 |                                                |
             8 - 16   ns |          0 |                                                |
            16 - 32   ns |          0 |                                                |
            32 - 64   ns |          0 |                                                |
            64 - 128  ns |          0 |                                                |
           128 - 256  ns |      42519 | ###########################################    |
           256 - 512  ns |       2140 | ##                                             |
           512 - 1024 ns |         54 |                                                |
             1 - 2    us |         16 |                                                |
             2 - 4    us |         10 |                                                |
             4 - 8    us |          0 |                                                |
             8 - 16   us |          0 |                                                |
            16 - 32   us |          0 |                                                |
            32 - 64   us |          0 |                                                |
            64 - 128  us |          0 |                                                |
           128 - 256  us |          0 |                                                |
           256 - 512  us |          0 |                                                |
           512 - 1024 us |          0 |                                                |
             1 - ...  ms |          0 |                                                |
        +++ exited with 0 +++
        #
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Changbin Du <changbin.du@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220321234609.90455-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84005bb6
    • John Garry's avatar
      perf tools: Fix version kernel tag · 7572733b
      John Garry authored
      Generating the version kernel tag relies on "git describe" command to
      get the latest Linus kernel tag.
      
      However, when working from clones of Linus' git we may not have the latest
      tag. For example, when working on Arnaldo's acme.git, we can have this:
      
        $ git branch
        perf/core
        $ head -n 5 ../../Makefile  | tail -n 4
        VERSION = 5
        PATCHLEVEL = 17
        SUBLEVEL = 0
        EXTRAVERSION = -rc3
        $ git describe --abbrev=0 --match "v[0-9].[0-9]*"
        v4.13-rc5
      
      Indeed using tags is a problem as it relies on tags being pulled from
      Linus' git (and pushed to the clone).
      
      In commit a4147f0f ("perf tools: Fix perf version generation")
      Robert introduced a change to use the kernelversion rule to generate the
      kernel tag when no git tags are available.
      
      However, as mentioned above, the tag we generate may be incorrect, so
      just always use kernelversion to get the tag (apart from building perf
      out of tree).
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@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>
      Cc: Robert Richter <rric@kernel.org>
      Link: https://lore.kernel.org/r/1645449409-158238-3-git-send-email-john.garry@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7572733b
    • Linus Torvalds's avatar
      Merge tag 'for-5.18-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 51912904
      Linus Torvalds authored
      Pull btrfs updates from David Sterba:
       "This contains feature updates, performance improvements, preparatory
        and core work and some related VFS updates:
      
        Features:
      
         - encoded read/write ioctls, allows user space to read or write raw
           data directly to extents (now compressed, encrypted in the future),
           will be used by send/receive v2 where it saves processing time
      
         - zoned mode now works with metadata DUP (the mkfs.btrfs default)
      
         - error message header updates:
            - print error state: transaction abort, other error, log tree
              errors
            - print transient filesystem state: remount, device replace,
              ignored checksum verifications
      
         - tree-checker: verify the transaction id of the to-be-written dirty
           extent buffer
      
        Performance improvements for fsync:
      
         - directory logging speedups (up to -90% run time)
      
         - avoid logging all directory changes during renames (up to -60% run
           time)
      
         - avoid inode logging during rename and link when possible (up to
           -60% run time)
      
         - prepare extents to be logged before locking a log tree path
           (throughput +7%)
      
         - stop copying old file extents when doing a full fsync()
      
         - improved logging of old extents after truncate
      
        Core, fixes:
      
         - improved stale device identification by dev_t and not just path
           (for devices that are behind other layers like device mapper)
      
         - continued extent tree v2 preparatory work
            - disable features that won't work yet
            - add wrappers and abstractions for new tree roots
      
         - improved error handling
      
         - add super block write annotations around background block group
           reclaim
      
         - fix device scanning messages potentially accessing stale pointer
      
         - cleanups and refactoring
      
        VFS:
      
         - allow reflinks/deduplication from two different mounts of the same
           filesystem
      
         - export and add helpers for read/write range verification, for the
           encoded ioctls"
      
      * tag 'for-5.18-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (98 commits)
        btrfs: zoned: put block group after final usage
        btrfs: don't access possibly stale fs_info data in device_list_add
        btrfs: add lockdep_assert_held to need_preemptive_reclaim
        btrfs: verify the tranisd of the to-be-written dirty extent buffer
        btrfs: unify the error handling of btrfs_read_buffer()
        btrfs: unify the error handling pattern for read_tree_block()
        btrfs: factor out do_free_extent_accounting helper
        btrfs: remove last_ref from the extent freeing code
        btrfs: add a alloc_reserved_extent helper
        btrfs: remove BUG_ON(ret) in alloc_reserved_tree_block
        btrfs: add and use helper for unlinking inode during log replay
        btrfs: extend locking to all space_info members accesses
        btrfs: zoned: mark relocation as writing
        fs: allow cross-vfsmount reflink/dedupe
        btrfs: remove the cross file system checks from remap
        btrfs: pass btrfs_fs_info to btrfs_recover_relocation
        btrfs: pass btrfs_fs_info for deleting snapshots and cleaner
        btrfs: add filesystems state details to error messages
        btrfs: deal with unexpected extent type during reflinking
        btrfs: fix unexpected error path when reflinking an inline extent
        ...
      51912904
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 9b03992f
      Linus Torvalds authored
      Pull ext4 updates from Ted Ts'o:
       "Fix some bugs in converting ext4 to use the new mount API, as well as
        more bug fixes and clean ups in the ext4 fast_commit feature (most
        notably, in the tracepoints).
      
        In the jbd2 layer, the t_handle_lock spinlock has been removed, with
        the last place where it was actually needed replaced with an atomic
        cmpxchg"
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (35 commits)
        ext4: fix kernel doc warnings
        ext4: fix remaining two trace events to use same printk convention
        ext4: add commit tid info in ext4_fc_commit_start/stop trace events
        ext4: add commit_tid info in jbd debug log
        ext4: add transaction tid info in fc_track events
        ext4: add new trace event in ext4_fc_cleanup
        ext4: return early for non-eligible fast_commit track events
        ext4: do not call FC trace event in ext4_fc_commit() if FS does not support FC
        ext4: convert ext4_fc_track_dentry type events to use event class
        ext4: fix ext4_fc_stats trace point
        ext4: remove unused enum EXT4_FC_COMMIT_FAILED
        ext4: warn when dirtying page w/o buffers in data=journal mode
        doc: fixed a typo in ext4 documentation
        ext4: make mb_optimize_scan performance mount option work with extents
        ext4: make mb_optimize_scan option work with set/unset mount cmd
        ext4: don't BUG if someone dirty pages without asking ext4 first
        ext4: remove redundant assignment to variable split_flag1
        ext4: fix underflow in ext4_max_bitmap_size()
        ext4: fix ext4_mb_clear_bb() kernel-doc comment
        ext4: fix fs corruption when tring to remove a non-empty directory with IO error
        ...
      9b03992f
    • Linus Torvalds's avatar
      Merge tag 'nfsd-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · 14705fda
      Linus Torvalds authored
      Pull nfsd updates from Chuck Lever:
       "New features:
      
         - NFSv3 support in NFSD is now always built
      
         - Added NFSD support for the NFSv4 birth-time file attribute
      
         - Added support for storing and displaying sockaddrs in trace points
      
         - NFSD now recognizes RPC_AUTH_TLS probes
      
        Performance improvements:
      
         - Optimized the svc transport enqueuing mechanism
      
         - Added micro-optimizations for the duplicate reply cache
      
        Notable bug fixes:
      
         - Allocation of the NFSD file cache hash table is more reliable"
      
      * tag 'nfsd-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (30 commits)
        nfsd: fix using the correct variable for sizeof()
        nfsd: use correct format characters
        NFSD: prevent integer overflow on 32 bit systems
        NFSD: prevent underflow in nfssvc_decode_writeargs()
        fs/lock: documentation cleanup. Replace inode->i_lock with flc_lock.
        NFSD: Fix nfsd_breaker_owns_lease() return values
        NFSD: Clean up _lm_ operation names
        arch: Remove references to CONFIG_NFSD_V3 in the default configs
        NFSD: Remove CONFIG_NFSD_V3
        nfsd: more robust allocation failure handling in nfsd_file_cache_init
        SUNRPC: Teach server to recognize RPC_AUTH_TLS
        NFSD: Move svc_serv_ops::svo_function into struct svc_serv
        NFSD: Remove svc_serv_ops::svo_module
        SUNRPC: Remove svc_shutdown_net()
        SUNRPC: Rename svc_close_xprt()
        SUNRPC: Rename svc_create_xprt()
        SUNRPC: Remove svo_shutdown method
        SUNRPC: Merge svc_do_enqueue_xprt() into svc_enqueue_xprt()
        SUNRPC: Remove the .svo_enqueue_xprt method
        SUNRPC: Record endpoint information in trace log
        ...
      14705fda
    • Linus Torvalds's avatar
      Merge tag '5.18-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6 · 105b6c05
      Linus Torvalds authored
      Pull cfis updates from Steve French:
       "Handlecache,  unmount, fiemap and two reconnect fixes"
      
      * tag '5.18-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: use a different reconnect helper for non-cifsd threads
        cifs: we do not need a spinlock around the tree access during umount
        Adjust cifssb maximum read size
        cifs: truncate the inode and mapping when we simulate fcollapse
        cifs: fix handlecache and multiuser
      105b6c05
    • Linus Torvalds's avatar
      Merge tag 'f2fs-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · ef510682
      Linus Torvalds authored
      Pull f2fs updates from Jaegeuk Kim:
       "In this cycle, f2fs has some performance improvements for Android
        workloads such as using read-unfair rwsems and adding some sysfs
        entries to control GCs and discard commands in more details. In
        addtiion, it has some tunings to improve the recovery speed after
        sudden power-cut.
      
        Enhancement:
         - add reader-unfair rwsems with F2FS_UNFAIR_RWSEM: will replace with
           generic API support
         - adjust to make the readahead/recovery flow more efficiently
         - sysfs entries to control issue speeds of GCs and Discard commands
         - enable idmapped mounts
      
        Bug fix:
         - correct wrong error handling routines
         - fix missing conditions in quota
         - fix a potential deadlock between writeback and block plug routines
         - fix a deadlock btween freezefs and evict_inode
      
        We've added some boundary checks to avoid kernel panics on corrupted
        images, and several minor code clean-ups"
      
      * tag 'f2fs-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (27 commits)
        f2fs: fix to do sanity check on .cp_pack_total_block_count
        f2fs: make gc_urgent and gc_segment_mode sysfs node readable
        f2fs: use aggressive GC policy during f2fs_disable_checkpoint()
        f2fs: fix compressed file start atomic write may cause data corruption
        f2fs: initialize sbi->gc_mode explicitly
        f2fs: introduce gc_urgent_mid mode
        f2fs: compress: fix to print raw data size in error path of lz4 decompression
        f2fs: remove redundant parameter judgment
        f2fs: use spin_lock to avoid hang
        f2fs: don't get FREEZE lock in f2fs_evict_inode in frozen fs
        f2fs: remove unnecessary read for F2FS_FITS_IN_INODE
        f2fs: introduce F2FS_UNFAIR_RWSEM to support unfair rwsem
        f2fs: avoid an infinite loop in f2fs_sync_dirty_inodes
        f2fs: fix to do sanity check on curseg->alloc_type
        f2fs: fix to avoid potential deadlock
        f2fs: quota: fix loop condition at f2fs_quota_sync()
        f2fs: Restore rwsem lockdep support
        f2fs: fix missing free nid in f2fs_handle_failed_inode
        f2fs: support idmapped mounts
        f2fs: add a way to limit roll forward recovery time
        ...
      ef510682
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · aab4ed58
      Linus Torvalds authored
      Pull erofs updates from Gao Xiang:
       "In this cycle, we continue converting to use meta buffers for all
        remaining uncompressed paths to prepare for the upcoming subpage,
        folio and fscache features.
      
        We also fixed a double-free issue when sysfs initialization fails,
        which was reported by syzbot.
      
        Besides, in order for the userspace to control per-file timestamp
        easier, we now switch to record mtime instead of ctime with a
        compatible feature marked. And there are also some code cleanups and
        documentation update as usual.
      
        Summary:
      
         - Avoid using page structure directly for all uncompressed paths
      
         - Fix a double-free issue when sysfs initialization fails
      
         - Complete DAX description for erofs
      
         - Use mtime instead since there's no (easy) way for users to control
           ctime
      
         - Several code cleanups"
      
      * tag 'erofs-for-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: rename ctime to mtime
        erofs: use meta buffers for inode lookup
        erofs: use meta buffers for reading directories
        fs: erofs: add sanity check for kobject in erofs_unregister_sysfs
        erofs: refine managed inode stuffs
        erofs: clean up z_erofs_extent_lookback
        erofs: silence warnings related to impossible m_plen
        Documentation/filesystem/dax: update DAX description on erofs
        erofs: clean up preload_compressed_pages()
        erofs: get rid of `struct z_erofs_collector'
        erofs: use meta buffers for erofs_read_superblock()
      aab4ed58
    • Linus Torvalds's avatar
      Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt · 881b5687
      Linus Torvalds authored
      Pull fscrypt updates from Eric Biggers:
       "Add support for direct I/O on encrypted files when blk-crypto (inline
        encryption) is being used for file contents encryption"
      
      * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
        fscrypt: update documentation for direct I/O support
        f2fs: support direct I/O with fscrypt using blk-crypto
        ext4: support direct I/O with fscrypt using blk-crypto
        iomap: support direct I/O with fscrypt using blk-crypto
        fscrypt: add functions for direct I/O support
      881b5687
    • Linus Torvalds's avatar
      Revert "random: block in /dev/urandom" · 0313bc27
      Linus Torvalds authored
      This reverts commit 6f98a4bf.
      
      It turns out we still can't do this.  Way too many platforms that don't
      have any real source of randomness at boot and no jitter entropy because
      they don't even have a cycle counter.
      
      As reported by Guenter Roeck:
      
       "This causes a large number of qemu boot test failures for various
        architectures (arm, m68k, microblaze, sparc32, xtensa are the ones I
        observed).
      
        Common denominator is that boot hangs at 'Saving random seed:'"
      
      This isn't hugely unexpected - we tried it, it failed, so now we'll
      revert it.
      
      Link: https://lore.kernel.org/all/20220322155820.GA1745955@roeck-us.net/Reported-and-bisected-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: Jason Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0313bc27
    • John Garry's avatar
      perf tools: Fix dependency for version file creation · 4e666cdb
      John Garry authored
      The version generated by perf may not be correct by just changing the
      head commit, like this:
      
        $ git log --pretty=format:"%H" -n 1
        b5d9d4708a24ac1889a30e9aedf8af8d73102139
        $ perf -v
        perf version 5.16.gb5d9d4708a24
        $ git reset --hard HEAD^
        HEAD is now at 629f520b265f
        $ make
        ...
        $ ./perf -v
        perf version 5.16.gb5d9d4708a24
      
      The dependency to building PERF-VERSION-FILE should also include ORIG_HEAD,
      as this changes when changing the head commit (while HEAD does not).
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@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>
      Cc: Robert Richter <rric@kernel.org>
      Link: https://lore.kernel.org/r/1645449409-158238-2-git-send-email-john.garry@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4e666cdb
    • Linus Torvalds's avatar
      Merge tag 'audit-pr-20220321' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit · b47d5a4f
      Linus Torvalds authored
      Pull audit update from Paul Moore:
       "Just one audit patch queued for v5.18:
      
         - Change the AUDIT_TIME_* record generation so that they are
           generated at syscall exit time and subject to all of the normal
           syscall exit filtering.
      
           This should help reduce noise and ensure those records which are
           most relevant to the admin's audit configuration are recorded in
           the audit log"
      
      * tag 'audit-pr-20220321' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit:
        audit: log AUDIT_TIME_* records only from rules
      b47d5a4f
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20220321' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · c269497d
      Linus Torvalds authored
      Pull selinux updates from Paul Moore:
       "We've got a number of SELinux patches queued up, the highlights are:
      
         - Fixup the security_fs_context_parse_param() LSM hook so it executes
           all of the LSM hook implementations unless a serious error occurs.
      
           We also correct the SELinux hook implementation so that it returns
           zero on success.
      
         - In addition to a few SELinux mount option parsing fixes, we
           simplified the parsing by moving it earlier in the process.
      
           The logic was that it was unlikely an admin/user would use the new
           mount API and not have the policy loaded before passing the SELinux
           options.
      
         - Properly fixed the LSM/SELinux/SCTP hooks with the addition of the
           security_sctp_assoc_established() hook.
      
           This work was done in conjunction with the netdev folks and should
           complete the move of the SCTP labeling from the endpoints to the
           associations.
      
         - Fixed a variety of sparse warnings caused by changes in the "__rcu"
           markings of some core kernel structures.
      
         - Ensure we access the superblock's LSM security blob using the
           stacking-safe accessors.
      
         - Added the ability for the kernel to always allow FIOCLEX and
           FIONCLEX if the "ioctl_skip_cloexec" policy capability is
           specified.
      
         - Various constifications improvements, type casting improvements,
           additional return value checks, and dead code/parameter removal.
      
         - Documentation fixes"
      
      * tag 'selinux-pr-20220321' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: (23 commits)
        selinux: shorten the policy capability enum names
        docs: fix 'make htmldocs' warning in SCTP.rst
        selinux: allow FIOCLEX and FIONCLEX with policy capability
        selinux: use correct type for context length
        selinux: drop return statement at end of void functions
        security: implement sctp_assoc_established hook in selinux
        security: add sctp_assoc_established hook
        selinux: parse contexts for mount options early
        selinux: various sparse fixes
        selinux: try to use preparsed sid before calling parse_sid()
        selinux: Fix selinux_sb_mnt_opts_compat()
        LSM: general protection fault in legacy_parse_param
        selinux: fix a type cast problem in cred_init_security()
        selinux: drop unused macro
        selinux: simplify cred_init_security
        selinux: do not discard const qualifier in cast
        selinux: drop unused parameter of avtab_insert_node
        selinux: drop cast to same type
        selinux: enclose macro arguments in parenthesis
        selinux: declare name parameter of hash_eval const
        ...
      c269497d
    • Linus Torvalds's avatar
      Merge tag 'integrity-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity · 7f313ff0
      Linus Torvalds authored
      Pull integrity subsystem updates from Mimi Zohar:
       "Except for extending the 'encrypted' key type to support user provided
        data, the rest is code cleanup, __setup() usage bug fix, and a trivial
        change"
      
      * tag 'integrity-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
        MAINTAINERS: add missing security/integrity/platform_certs
        EVM: fix the evm= __setup handler return value
        KEYS: encrypted: Instantiate key with user-provided decrypted data
        ima: define ima_max_digest_data struct without a flexible array variable
        ima: rename IMA_ACTION_FLAGS to IMA_NONACTION_FLAGS
        ima: Return error code obtained from securityfs functions
        MAINTAINERS: add missing "security/integrity" directory
        ima: Fix trivial typos in the comments
      7f313ff0
    • Linus Torvalds's avatar
      Merge tag 'Smack-for-5.18' of https://github.com/cschaufler/smack-next · 2c5a5358
      Linus Torvalds authored
      Pull smack update from Casey Schaufler:
       "A single fix to repair an incorrect use of ntohs() in IPv6 audit code.
        It's very minor and went unnoticed until lkp found it.
      
        It's been in next and passes all tests"
      
      * tag 'Smack-for-5.18' of https://github.com/cschaufler/smack-next:
        Fix incorrect type in assignment of ipv6 port for audit
      2c5a5358
    • Linus Torvalds's avatar
      Merge branch 'keys-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · 6ca014cd
      Linus Torvalds authored
      Pull watch_queue fixes from David Howells:
       "Here are fixes for a couple more watch_queue bugs, both found by syzbot:
      
         - Fix error cleanup in watch_queue_set_size() where it tries to clean
           up all the pointers in the page list, even if they've not been
           allocated yet[1]. Unfortunately, __free_page() doesn't treat a NULL
           pointer as being "do nothing".
      
           A second report[2] looks like it's probably the same bug, but on
           arm64 rather than x86_64, but there's no reproducer.
      
         - Fix a missing kfree in free_watch() to actually free the watch[3]"
      
      Link: https://lore.kernel.org/r/000000000000b1807c05daad8f98@google.com/ [1]
      Link: https://lore.kernel.org/r/000000000000035b9c05daae8a5e@google.com/ [2]
      Link: https://lore.kernel.org/r/000000000000bc8eaf05dab91c63@google.com/ [3]
      
      * 'keys-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        watch_queue: Actually free the watch
        watch_queue: Fix NULL dereference in error cleanup
      6ca014cd
    • Linus Torvalds's avatar
      Merge tag 'bounds-fixes-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 8565d644
      Linus Torvalds authored
      Pull bounds fixes from Kees Cook:
       "These are a handful of buffer and array bounds fixes that I've been
        carrying in preparation for the coming memcpy improvements and the
        enabling of '-Warray-bounds' globally.
      
        There are additional similar fixes in other maintainer's trees, but
        these ended up getting carried by me. :)"
      
      * tag 'bounds-fixes-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        media: omap3isp: Use struct_group() for memcpy() region
        tpm: vtpm_proxy: Check length to avoid compiler warning
        alpha: Silence -Warray-bounds warnings
        m68k: cmpxchg: Dereference matching size
        intel_th: msu: Use memset_startat() for clearing hw header
        KVM: x86: Replace memset() "optimization" with normal per-field writes
      8565d644
    • Linus Torvalds's avatar
      Merge tag 'overflow-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · d0858cbd
      Linus Torvalds authored
      Pull overflow updates from Kees Cook:
       "These changes come in roughly two halves: support of Gustavo A. R.
        Silva's struct_size() work via additional helpers for catching
        overflow allocation size calculations, and conversions of selftests to
        KUnit (which includes some tweaks for UML + Clang):
      
         - Convert overflow selftest to KUnit
      
         - Convert stackinit selftest to KUnit
      
         - Implement size_t saturating arithmetic helpers
      
         - Allow struct_size() to be used in initializers"
      
      * tag 'overflow-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        lib: stackinit: Convert to KUnit
        um: Allow builds with Clang
        lib: overflow: Convert to Kunit
        overflow: Provide constant expression struct_size
        overflow: Implement size_t saturating arithmetic helpers
        test_overflow: Regularize test reporting output
      d0858cbd
    • Linus Torvalds's avatar
      Merge tag 'hardening-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 2142b7f0
      Linus Torvalds authored
      Pull kernel hardening updates from Kees Cook:
      
       - Add arm64 Shadow Call Stack support for GCC 12 (Dan Li)
      
       - Avoid memset with stack offset randomization under Clang (Marco
         Elver)
      
       - Clean up stackleak plugin to play nice with .noinstr (Kees Cook)
      
       - Check stack depth for greater usercopy hardening coverage (Kees Cook)
      
      * tag 'hardening-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        arm64: Add gcc Shadow Call Stack support
        m68k: Implement "current_stack_pointer"
        xtensa: Implement "current_stack_pointer"
        usercopy: Check valid lifetime via stack depth
        stack: Constrain and fix stack offset randomization with Clang builds
        stack: Introduce CONFIG_RANDOMIZE_KSTACK_OFFSET
        gcc-plugins/stackleak: Ignore .noinstr.text and .entry.text
        gcc-plugins/stackleak: Exactly match strings instead of prefixes
        gcc-plugins/stackleak: Provide verbose mode
      2142b7f0
    • Linus Torvalds's avatar
      Merge tag 'pstore-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · fd2d7a4a
      Linus Torvalds authored
      Pull pstore updates from Kees Cook:
      
       - Don't use semaphores in always-atomic-context code (Jann Horn)
      
       - Add "ECC:" prefix to ECC messages (Vincent Whitchurch)
      
      * tag 'pstore-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        pstore: Don't use semaphores in always-atomic-context code
        pstore: Add prefix to ECC messages
      fd2d7a4a
    • Linus Torvalds's avatar
      Merge tag 'execve-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · b7a801f3
      Linus Torvalds authored
      Pull execve updates from Kees Cook:
       "Execve and binfmt updates.
      
        Eric and I have stepped up to be the active maintainers of this area,
        so here's our first collection. The bulk of the work was in coredump
        handling fixes; additional details are noted below:
      
         - Handle unusual AT_PHDR offsets (Akira Kawata)
      
         - Fix initial mapping size when PT_LOADs are not ordered (Alexey
           Dobriyan)
      
         - Move more code under CONFIG_COREDUMP (Alexey Dobriyan)
      
         - Fix missing mmap_lock in file_files_note (Eric W. Biederman)
      
         - Remove a.out support for alpha and m68k (Eric W. Biederman)
      
         - Include first pages of non-exec ELF libraries in coredump (Jann
           Horn)
      
         - Don't write past end of notes for regset gap in coredump (Rick
           Edgecombe)
      
         - Comment clean-ups (Tom Rix)
      
         - Force single empty string when argv is empty (Kees Cook)
      
         - Add NULL argv selftest (Kees Cook)
      
         - Properly redefine PT_GNU_* in terms of PT_LOOS (Kees Cook)
      
         - MAINTAINERS: Update execve entry with tree (Kees Cook)
      
         - Introduce initial KUnit testing for binfmt_elf (Kees Cook)"
      
      * tag 'execve-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        binfmt_elf: Don't write past end of notes for regset gap
        a.out: Stop building a.out/osf1 support on alpha and m68k
        coredump: Don't compile flat_core_dump when coredumps are disabled
        coredump: Use the vma snapshot in fill_files_note
        coredump/elf: Pass coredump_params into fill_note_info
        coredump: Remove the WARN_ON in dump_vma_snapshot
        coredump: Snapshot the vmas in do_coredump
        coredump: Move definition of struct coredump_params into coredump.h
        binfmt_elf: Introduce KUnit test
        ELF: Properly redefine PT_GNU_* in terms of PT_LOOS
        MAINTAINERS: Update execve entry with more details
        exec: cleanup comments
        fs/binfmt_elf: Refactor load_elf_binary function
        fs/binfmt_elf: Fix AT_PHDR for unusual ELF files
        binfmt: move more stuff undef CONFIG_COREDUMP
        selftests/exec: Test for empty string on NULL argv
        exec: Force single empty string when argv is empty
        coredump: Also dump first pages of non-executable ELF libraries
        ELF: fix overflow in total mapping size calculation
      b7a801f3