Skip to content
  1. Apr 02, 2022
    • Haowen Bai's avatar
      perf evlist: Directly return instead of using local ret variable · f717d89a
      Haowen Bai authored
      
      
      Addresses this coccinelle warning:
      
        ./tools/perf/util/evlist.c:1333:5-8: Unneeded variable: "err". Return
        "- ENOMEM" on line 1358
      
      Signed-off-by: default avatarHaowen Bai <baihaowen@meizu.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/1648432532-23151-1-git-send-email-baihaowen@meizu.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f717d89a
    • Ian Rogers's avatar
      perf cpumap: More cpu map reuse by merge. · da0bfb9f
      Ian Rogers authored
      
      
      perf_cpu_map__merge() will reuse one of its arguments if they are equal or
      the other argument is NULL.
      
      The arguments could be reused if it is known one set of values is a
      subset of the other.
      
      For example, a map of 0-1 and a map of just 0 when merged yields the map
      of 0-1.
      
      Currently a new map is created rather than adding a reference count to
      the original 0-1 map.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328232648.2127340-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da0bfb9f
    • Ian Rogers's avatar
      perf cpumap: Add is_subset function · c3ad8d23
      Ian Rogers authored
      
      
      Returns true if the second argument is a subset of the first.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328232648.2127340-4-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c3ad8d23
    • Ian Rogers's avatar
      perf evlist: Rename cpus to user_requested_cpus · 0df6ade7
      Ian Rogers authored
      
      
      evlist contains cpus and all_cpus. all_cpus is the union of the cpu maps
      of all evsels.
      
      For non-task targets, cpus is set to be cpus requested from the command
      line, defaulting to all online cpus if no cpus are specified.
      
      For an uncore event, all_cpus may be just CPU 0 or every online CPU.
      
      This causes all_cpus to have fewer values than the cpus variable which
      is confusing given the 'all' in the name.
      
      To try to make the behavior clearer, rename cpus to user_requested_cpus
      and add comments on the two struct variables.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328232648.2127340-3-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0df6ade7
    • John Garry's avatar
      perf tools: Stop depending on .git files for building PERF-VERSION-FILE · d4ff9265
      John Garry authored
      This essentially reverts commit c72e3f04 ("tools/perf/build:
      Speed up git-version test on re-make") and commit 4e666cdb
      ("perf tools: Fix dependency for version file creation")
      
      In commit c72e3f04 ("tools/perf/build: Speed up git-version test
      on re-make"), a makefile dependency on .git/HEAD was added. The
      background is that running PERF-VERSION-FILE is relatively slow, and
      commands like "git describe" are particularly slow.
      
      In commit 4e666cdb ("perf tools: Fix dependency for version file
      creation"), an additional dependency on .git/ORIG_HEAD was added, as
      .git/HEAD may not change for "git reset --hard HEAD^" command. However,
      depending on whether we're on a branch or not, a "git cherry-pick" may
      not lead to the version being updated.
      
      As discussed with the git community in [0], using git internal files for
      dependencies is not reliable. Commit 4e666cdb also breaks some build
      scenarios [1].
      
      As mentioned, c72e3f04 ("tools/perf/build: Speed up git-version
      test on re-make") was added to speed up the build. However in commit
      7572733b ("perf tools: Fix version kernel tag") we removed the
      call to "git describe", so just revert Makefile.perf back to same as pre
      c72e3f04 ("tools/perf/build: Speed up git-version test on
      re-make") and the build should not be so slow, as below:
      
      Pre 7572733b:
      
        $> time util/PERF-VERSION-GEN
          PERF_VERSION = 5.17.rc8.g4e666cdb06ee
      
        real    0m0.110s
        user    0m0.091s
        sys     0m0.019s
      
      Post 7572733b:
      
        $> time util/PERF-VERSION-GEN
          PERF_VERSION = 5.17.rc8.g7572733b8499
      
        real    0m0.039s
        user    0m0.036s
        sys     0m0.007s
      
      [0] https://lore.kernel.org/git/87wngkpddp.fsf@igel.home/T/#m4a4dd6de52fdbe21179306cd57b3761eb07f45f8
      [1] https://lore.kernel.org/linux-perf-users/20220329093120.4173283-1-matthieu.baerts@tessares.net/T/#u
      
      
      
      Committer testing:
      
      After a fresh rebuild using 'make -C tools/perf O=/tmp/build/perf install-bin':
      
        $ perf -v
        perf version 5.17.g162f9db407b6
        $ git log --oneline -1
        162f9db407b6a6e5 (HEAD -> perf/core) perf tools: Stop depending on .git files for building PERF-VERSION-FILE
        $
      
      Now using a detached tarball, i.e. outside the kernel source tree:
      
        $ ls -la perf*tar
        ls: cannot access 'perf*tar': No such file or directory
        $ make perf-tar-src-pkg
          TAR
          PERF_VERSION = 5.17.g31d10b3ef133
        $ ls -la perf*tar
        -rw-r--r--. 1 acme acme 22241280 Mar 30 13:26 perf-5.17.0.tar
        $ mv perf-5.17.0.tar /tmp
        $ cd /tmp
        $ tar xf perf-5.17.0.tar
        $ cd perf-5.17.0/
        $ make -C tools/perf |& tail
          CC      util/pmu.o
          CC      util/pmu-flex.o
          CC      util/expr-flex.o
          CC      util/expr.o
          LD      util/scripting-engines/perf-in.o
          LD      util/intel-pt-decoder/perf-in.o
          LD      util/perf-in.o
          LD      perf-in.o
          LINK    perf
        make: Leaving directory '/tmp/perf-5.17.0/tools/perf'
        $ tools/perf/perf -v
        perf version 5.17.g31d10b3ef133
        $ pwd
        /tmp/perf-5.17.0
        $ cat PERF-VERSION-FILE
        #define PERF_VERSION "5.17.g31d10b3ef133"
        $
      
      Fixes: 4e666cdb ("perf tools: Fix dependency for version file creation")
      Reported-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      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: John Garry <john.garry@huawei.com>
      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/1648635774-14581-1-git-send-email-john.garry@huawei.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d4ff9265
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · 5ced8124
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        991625f3 ("x86/ibt: Add IBT feature, MSR and #CP handling")
      
      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: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/lkml/YkSCx2kr4ambH+Qe@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5ced8124
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · f444b2d1
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        caa574ff ("drm/i915/uapi: document behaviour for DG2 64K support")
      
      That don't add any new ioctl, so no changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Lucas De Marchi <lucas.demarchi@intel.com>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Link: http://lore.kernel.org/lkml/YkSChHqaOApscFQ0@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f444b2d1
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · 7ceda0cf
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        6d849191 ("KVM: x86: Introduce KVM_CAP_DISABLE_QUIRKS2")
        ef11c946 ("KVM: s390: Add vm IOCTL for key checked guest absolute memory access")
        e9e9feeb ("KVM: s390: Add optional storage key checking to MEMOP IOCTL")
      
      That just rebuilds perf, as these patches don't add any new KVM ioctl to
      be harvested for the the 'perf trace' ioctl syscall argument
      beautifiers.
      
      This is also by now used by tools/testing/selftests/kvm/, a simple test
      build succeeded.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/YkSCOWHQdir1lhdJ@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7ceda0cf
    • Arnaldo Carvalho de Melo's avatar
      tools kvm headers arm64: Update KVM headers from the kernel sources · 8db38afd
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        34739fd9 ("KVM: arm64: Indicate SYSTEM_RESET2 in kvm_run::system_event flags field")
        583cda1b ("KVM: arm64: Refuse to run VCPU if the PMU doesn't match the physical CPU")
      
      That don't causes any changes in tooling (when built on x86), only
      addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
      
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Alexandru Elisei <alexandru.elisei@arm.com>
      Link: https://lore.kernel.org/lkml/YkSB4Q7kWmnaqeZU@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8db38afd
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 672b259f
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        991625f3 ("x86/ibt: Add IBT feature, MSR and #CP handling")
      
      Addressing these tools/perf build warnings:
      
          diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
          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'
      
      That makes the beautification scripts to pick some new entries:
      
        $ 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
        --- before	2022-03-29 16:23:07.678740040 -0300
        +++ after	2022-03-29 16:23:16.960978524 -0300
        @@ -220,6 +220,13 @@
         	[0x00000669] = "MC6_DEMOTION_POLICY_CONFIG",
         	[0x00000680] = "LBR_NHM_FROM",
         	[0x00000690] = "CORE_PERF_LIMIT_REASONS",
        +	[0x000006a0] = "IA32_U_CET",
        +	[0x000006a2] = "IA32_S_CET",
        +	[0x000006a4] = "IA32_PL0_SSP",
        +	[0x000006a5] = "IA32_PL1_SSP",
        +	[0x000006a6] = "IA32_PL2_SSP",
        +	[0x000006a7] = "IA32_PL3_SSP",
        +	[0x000006a8] = "IA32_INT_SSP_TAB",
         	[0x000006B0] = "GFX_PERF_LIMIT_REASONS",
         	[0x000006B1] = "RING_PERF_LIMIT_REASONS",
         	[0x000006c0] = "LBR_NHM_TO",
        $
      
      And this gets rebuilt:
      
        CC      /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
        LD      /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
        LD      /tmp/build/perf/trace/beauty/perf-in.o
        CC      /tmp/build/perf/util/amd-sample-raw.o
        LD      /tmp/build/perf/util/perf-in.o
        LD      /tmp/build/perf/perf-in.o
        LINK    /tmp/build/perf/perf
      
      Now one can trace systemwide asking to see backtraces to where those
      MSRs are being read/written with:
      
        # perf trace -e msr:*_msr/max-stack=32/ --filter="msr>=IA32_U_CET && msr<=IA32_INT_SSP_TAB"
        ^C#
      
      If we use -v (verbose mode) we can see what it does behind the scenes:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr>=IA32_U_CET && msr<=IA32_INT_SSP_TAB"
        Using CPUID AuthenticAMD-25-21-0
        0x6a0
        0x6a8
        New filter for msr:read_msr: (msr>=0x6a0 && msr<=0x6a8) && (common_pid != 597499 && common_pid != 3313)
        0x6a0
        0x6a8
        New filter for msr:write_msr: (msr>=0x6a0 && msr<=0x6a8) && (common_pid != 597499 && common_pid != 3313)
        mmap size 528384B
        ^C#
      
      Example with a frequent msr:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
        Using CPUID AuthenticAMD-25-21-0
        0x48
        New filter for msr:read_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
        0x48
        New filter for msr:write_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
        mmap size 528384B
        Looking at the vmlinux_path (8 entries long)
        symsrc__init: build id mismatch for vmlinux.
        Using /proc/kcore for kernel data
        Using /proc/kallsyms for symbols
           0.000 Timer/2525383 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
                                             do_trace_write_msr ([kernel.kallsyms])
                                             do_trace_write_msr ([kernel.kallsyms])
                                             __switch_to_xtra ([kernel.kallsyms])
                                             __switch_to ([kernel.kallsyms])
                                             __schedule ([kernel.kallsyms])
                                             schedule ([kernel.kallsyms])
                                             futex_wait_queue_me ([kernel.kallsyms])
                                             futex_wait ([kernel.kallsyms])
                                             do_futex ([kernel.kallsyms])
                                             __x64_sys_futex ([kernel.kallsyms])
                                             do_syscall_64 ([kernel.kallsyms])
                                             entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
                                             __futex_abstimed_wait_common64 (/usr/lib64/libpthread-2.33.so)
           0.030 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
                                             do_trace_write_msr ([kernel.kallsyms])
                                             do_trace_write_msr ([kernel.kallsyms])
                                             __switch_to_xtra ([kernel.kallsyms])
                                             __switch_to ([kernel.kallsyms])
                                             __schedule ([kernel.kallsyms])
                                             schedule_idle ([kernel.kallsyms])
                                             do_idle ([kernel.kallsyms])
                                             cpu_startup_entry ([kernel.kallsyms])
                                             secondary_startup_64_no_verify ([kernel.kallsyms])
        #
      
      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>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/YkNd7Ky+vi7H2Zl2@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      672b259f
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync asm-generic/mman-common.h with the kernel · 6d05e139
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        9457056a ("mm: madvise: MADV_DONTNEED_LOCKED")
      
      That result in these changes in the tools:
      
        $ diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
        --- tools/include/uapi/asm-generic/mman-common.h	2022-03-29 16:17:50.461694991 -0300
        +++ include/uapi/asm-generic/mman-common.h	2022-03-27 19:12:48.923250468 -0300
        @@ -75,6 +75,8 @@
         #define MADV_POPULATE_READ	22	/* populate (prefault) page tables readable */
         #define MADV_POPULATE_WRITE	23	/* populate (prefault) page tables writable */
      
        +#define MADV_DONTNEED_LOCKED	24	/* like DONTNEED, but drop locked pages too */
        +
         /* compatibility flags */
         #define MAP_FILE	0
      
        $ tools/perf/trace/beauty/madvise_behavior.sh > before
        $ cp include/uapi/asm-generic/mman-common.h tools/include/uapi/asm-generic/mman-common.h
        $ tools/perf/trace/beauty/madvise_behavior.sh > after
        $ diff -u before after
        --- before	2022-03-29 16:18:04.091044244 -0300
        +++ after	2022-03-29 16:18:11.692238906 -0300
        @@ -20,6 +20,7 @@
         	[21] = "PAGEOUT",
         	[22] = "POPULATE_READ",
         	[23] = "POPULATE_WRITE",
        +	[24] = "DONTNEED_LOCKED",
         	[100] = "HWPOISON",
         	[101] = "SOFT_OFFLINE",
         };
        $
      
      I.e. now when madvise gets those behaviours as args, 'perf trace' will
      be able to translate from the number to a human readable string and to
      use the strings in tracepoint filter expressions.
      
      This addresses the following perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h'
        diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/YkNcUfeh795yqGMV@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6d05e139
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Update copy of linux/socket.h with the kernel sources · 9a195da4
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        a6a6fe27 ("net/smc: Dynamic control handshake limitation by socket options")
      
      This automagically adds support for the SOL_MNC socket level:
      
        $ diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
        --- tools/perf/trace/beauty/include/linux/socket.h	2022-03-14 17:55:22.277148656 -0300
        +++ include/linux/socket.h	2022-03-27 19:12:48.908250063 -0300
        @@ -366,6 +366,7 @@
         #define SOL_XDP		283
         #define SOL_MPTCP	284
         #define SOL_MCTP	285
        +#define SOL_SMC		286
      
         /* IPX options */
         #define IPX_TYPE	1
        $ tools/perf/trace/beauty/socket.sh > before
        $ cp include/linux/socket.h tools/perf/trace/beauty/include/linux/socket.h
        $ tools/perf/trace/beauty/socket.sh > after
        $ diff -u before after
        --- before	2022-03-29 11:47:56.390258780 -0300
        +++ after	2022-03-29 11:48:03.158436189 -0300
        @@ -67,6 +67,7 @@
         	[283] = "XDP",
         	[284] = "MPTCP",
         	[285] = "MCTP",
        +	[286] = "SMC",
         };
      
         DEFINE_STRARRAY(socket_level, "SOL_");
        $
      
      This will allow 'perf trace' to translate 286 into "SMC" as is done with
      the other socket levels:
      
        # perf trace -e setsockopt --max-events 4
         344.916 ( 0.003 ms): Socket Thread/3816 setsockopt(fd: 168, level: TCP, optname: 5, optval: 0x7f5797b9c4f8, optlen: 4) = 0
         344.920 ( 0.002 ms): Socket Thread/3816 setsockopt(fd: 168, level: TCP, optname: 6, optval: 0x7f5797b9c4f4, optlen: 4) = 0
        1246.974 ( 0.010 ms): systemd-resolv/1128 setsockopt(fd: 22, level: IP, optname: 11, optval: 0x7ffc96cd7244, optlen: 4) = 0
        1246.986 ( 0.002 ms): systemd-resolv/1128 setsockopt(fd: 22, level: IP, optname: 8, optval: 0x7ffc96cd7264, optlen: 4) = 0
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/perf/trace/beauty/include/linux/socket.h' differs from latest version at 'include/linux/socket.h'
        diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: D. Wythe <alibuda@linux.alibaba.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/YkMdpzzjPu5VZtW3@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a195da4
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Update copy of libbpf's hashmap.c · 4d4d00dd
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        fba60b17 ("libbpf: Use IS_ERR_OR_NULL() in hashmap__free()")
      
      That don't entail any changes in tools/perf.
      
      This addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/perf/util/hashmap.h' differs from latest version at 'tools/lib/bpf/hashmap.h'
        diff -u tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
      
      Not a kernel ABI, its just that this uses the mechanism in place for
      checking kernel ABI files drift.
      
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mauricio Vásquez <mauricio@kinvolk.io>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/YkMb2SAIai2VeuUD@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4d4d00dd
    • Ian Rogers's avatar
      perf stat: Avoid SEGV if core.cpus isn't set · 8a96f454
      Ian Rogers authored
      
      
      Passing NULL to perf_cpu_map__max doesn't make sense as there is no
      valid max. Avoid this problem by null checking in
      perf_stat_init_aggr_mode.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20220328062414.1893550-5-irogers@google.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8a96f454
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · b012b323
      Linus Torvalds authored
      Merge still more updates from Andrew Morton:
       "16 patches.
      
        Subsystems affected by this patch series: ofs2, nilfs2, mailmap, and
        mm (madvise, mlock, mfence, memory-failure, kasan, debug, kmemleak,
        and damon)"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm/damon: prevent activated scheme from sleeping by deactivated schemes
        mm/kmemleak: reset tag when compare object pointer
        doc/vm/page_owner.rst: remove content related to -c option
        tools/vm/page_owner_sort.c: remove -c option
        mm, kasan: fix __GFP_BITS_SHIFT definition breaking LOCKDEP
        mm,hwpoison: unmap poisoned page before invalidation
        mailmap: update Kirill's email
        mm: kfence: fix objcgs vector allocation
        mm/munlock: protect the per-CPU pagevec by a local_lock_t
        mm/munlock: update Documentation/vm/unevictable-lru.rst
        mm/munlock: add lru_add_drain() to fix memcg_stat_test
        nilfs2: get rid of nilfs_mapping_init()
        nilfs2: fix lockdep warnings during disk space reclamation
        nilfs2: fix lockdep warnings in page operations for btree nodes
        ocfs2: fix crash when mount with quota enabled
        Revert "mm: madvise: skip unmapped vma holes passed to process_madvise"
      b012b323
    • Jonghyeon Kim's avatar
      mm/damon: prevent activated scheme from sleeping by deactivated schemes · 78049e94
      Jonghyeon Kim authored
      In the DAMON, the minimum wait time of the schemes decides whether the
      kernel wakes up 'kdamon_fn()'.  But since the minimum wait time is
      initialized to zero, there are corner cases against the original
      objective.
      
      For example, if we have several schemes for one target, and if the wait
      time of the first scheme is zero, the minimum wait time will set zero,
      which means 'kdamond_fn()' should wake up to apply this scheme.
      However, in the following scheme, wait time can be set to non-zero.
      Thus, the mininum wait time will be set to non-zero, which can cause
      sleeping this interval for 'kdamon_fn()' due to one deactivated last
      scheme.
      
      This commit prevents making DAMON monitoring inactive state due to other
      deactivated schemes.
      
      Link: https://lkml.kernel.org/r/20220330105302.32114-1-tome01@ajou.ac.kr
      
      
      Signed-off-by: default avatarJonghyeon Kim <tome01@ajou.ac.kr>
      Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      78049e94
    • Kuan-Ying Lee's avatar
      mm/kmemleak: reset tag when compare object pointer · bfc8089f
      Kuan-Ying Lee authored
      When we use HW-tag based kasan and enable vmalloc support, we hit the
      following bug.  It is due to comparison between tagged object and
      non-tagged pointer.
      
      We need to reset the kasan tag when we need to compare tagged object and
      non-tagged pointer.
      
        kmemleak: [name:kmemleak&]Scan area larger than object 0xffffffe77076f440
        CPU: 4 PID: 1 Comm: init Tainted: G S      W         5.15.25-android13-0-g5cacf919c2bc #1
        Hardware name: MT6983(ENG) (DT)
        Call trace:
         add_scan_area+0xc4/0x244
         kmemleak_scan_area+0x40/0x9c
         layout_and_allocate+0x1e8/0x288
         load_module+0x2c8/0xf00
         __se_sys_finit_module+0x190/0x1d0
         __arm64_sys_finit_module+0x20/0x30
         invoke_syscall+0x60/0x170
         el0_svc_common+0xc8/0x114
         do_el0_svc+0x28/0xa0
         el0_svc+0x60/0xf8
         el0t_64_sync_handler+0x88/0xec
         el0t_64_sync+0x1b4/0x1b8
        kmemleak: [name:kmemleak&]Object 0xf5ffffe77076b000 (size 32768):
        kmemleak: [name:kmemleak&]  comm "init", pid 1, jiffies 4294894197
        kmemleak: [name:kmemleak&]  min_count = 0
        kmemleak: [name:kmemleak&]  count = 0
        kmemleak: [name:kmemleak&]  flags = 0x1
        kmemleak: [name:kmemleak&]  checksum = 0
        kmemleak: [name:kmemleak&]  backtrace:
             module_alloc+0x9c/0x120
             move_module+0x34/0x19c
             layout_and_allocate+0x1c4/0x288
             load_module+0x2c8/0xf00
             __se_sys_finit_module+0x190/0x1d0
             __arm64_sys_finit_module+0x20/0x30
             invoke_syscall+0x60/0x170
             el0_svc_common+0xc8/0x114
             do_el0_svc+0x28/0xa0
             el0_svc+0x60/0xf8
             el0t_64_sync_handler+0x88/0xec
             el0t_64_sync+0x1b4/0x1b8
      
      Link: https://lkml.kernel.org/r/20220318034051.30687-1-Kuan-Ying.Lee@mediatek.com
      
      
      Signed-off-by: default avatarKuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Cc: Chinwen Chang <chinwen.chang@mediatek.com>
      Cc: Nicholas Tang <nicholas.tang@mediatek.com>
      Cc: Yee Lee <yee.lee@mediatek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bfc8089f
    • Yinan Zhang's avatar
      doc/vm/page_owner.rst: remove content related to -c option · c89b3ad2
      Yinan Zhang authored
      -c option has been removed from page_owner_sort.c.
      
      Remove the usage of -c option from Documentation.
      
      This work is coauthored by
              Shenghong Han
              Yixuan Cao
              Chongxi Zhao
              Jiajian Ye
              Yuhong Feng
              Yongqiang Liu
      
      Link: https://lkml.kernel.org/r/20220326085920.1470081-2-zhangyinan2019@email.szu.edu.cn
      
      
      Signed-off-by: default avatarYinan Zhang <zhangyinan2019@email.szu.edu.cn>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Sean Anderson <seanga2@gmail.com>
      Cc: Tang Bin <tangbin@cmss.chinamobile.com>
      Cc: Zhenliang Wei <weizhenliang@huawei.com>
      Cc: Georgi Djakov <georgi.djakov@linaro.org>
      Cc: Chongxi Zhao <zhaochongxi2019@email.szu.edu.cn>
      Cc: Jiajian Ye <yejiajian2018@email.szu.edu.cn>
      Cc: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
      Cc: Yuhong Feng <yuhongf@szu.edu.cn>
      Cc: Yongqiang Liu <liuyongqiang13@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c89b3ad2
    • Yinan Zhang's avatar
      tools/vm/page_owner_sort.c: remove -c option · d8b7b3fa
      Yinan Zhang authored
      The -c option is used to cull by stacktrace.  Now, --cull option has
      been Added in page_owner_sort.c.  Culling by stacktrace is one of the
      function of "--cull".  No need to set an extra parameter.  So remove -c
      option.
      
      Remove parsing of -c when parse parameter and remove "-c" from usage.
      
      This work is coauthored by
              Shenghong Han
              Yixuan Cao
              Chongxi Zhao
              Jiajian Ye
              Yuhong Feng
              Yongqiang Liu
      
      Link: https://lkml.kernel.org/r/20220326085920.1470081-1-zhangyinan2019@email.szu.edu.cn
      
      
      Signed-off-by: default avatarYinan Zhang <zhangyinan2019@email.szu.edu.cn>
      Cc: Chongxi Zhao <zhaochongxi2019@email.szu.edu.cn>
      Cc: Georgi Djakov <georgi.djakov@linaro.org>
      Cc: Jiajian Ye <yejiajian2018@email.szu.edu.cn>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Sean Anderson <seanga2@gmail.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Tang Bin <tangbin@cmss.chinamobile.com>
      Cc: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
      Cc: Yongqiang Liu <liuyongqiang13@huawei.com>
      Cc: Yuhong Feng <yuhongf@szu.edu.cn>
      Cc: Zhenliang Wei <weizhenliang@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8b7b3fa
    • Andrey Konovalov's avatar
      mm, kasan: fix __GFP_BITS_SHIFT definition breaking LOCKDEP · ada543af
      Andrey Konovalov authored
      KASAN changes that added new GFP flags mistakenly updated
      __GFP_BITS_SHIFT as the total number of GFP bits instead of as a shift
      used to define __GFP_BITS_MASK.
      
      This broke LOCKDEP, as __GFP_BITS_MASK now gets the 25th bit enabled
      instead of the 28th for __GFP_NOLOCKDEP.
      
      Update __GFP_BITS_SHIFT to always count KASAN GFP bits.
      
      In the future, we could handle all combinations of KASAN and LOCKDEP to
      occupy as few bits as possible.  For now, we have enough GFP bits to be
      inefficient in this quick fix.
      
      Link: https://lkml.kernel.org/r/462ff52742a1fcc95a69778685737f723ee4dfb3.1648400273.git.andreyknvl@google.com
      
      
      Fixes: 9353ffa6 ("kasan, page_alloc: allow skipping memory init for HW_TAGS")
      Fixes: 53ae233c ("kasan, page_alloc: allow skipping unpoisoning for HW_TAGS")
      Fixes: f49d9c5b ("kasan, mm: only define ___GFP_SKIP_KASAN_POISON with HW_TAGS")
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reported-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Marco Elver <elver@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ada543af
    • Rik van Riel's avatar
      mm,hwpoison: unmap poisoned page before invalidation · 3149c79f
      Rik van Riel authored
      In some cases it appears the invalidation of a hwpoisoned page fails
      because the page is still mapped in another process.  This can cause a
      program to be continuously restarted and die when it page faults on the
      page that was not invalidated.  Avoid that problem by unmapping the
      hwpoisoned page when we find it.
      
      Another issue is that sometimes we end up oopsing in finish_fault, if
      the code tries to do something with the now-NULL vmf->page.  I did not
      hit this error when submitting the previous patch because there are
      several opportunities for alloc_set_pte to bail out before accessing
      vmf->page, and that apparently happened on those systems, and most of
      the time on other systems, too.
      
      However, across several million systems that error does occur a handful
      of times a day.  It can be avoided by returning VM_FAULT_NOPAGE which
      will cause do_read_fault to return before calling finish_fault.
      
      Link: https://lkml.kernel.org/r/20220325161428.5068d97e@imladris.surriel.com
      
      
      Fixes: e53ac737 ("mm: invalidate hwpoison page cache page in fault path")
      Signed-off-by: default avatarRik van Riel <riel@surriel.com>
      Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Tested-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3149c79f
    • Kirill Tkhai's avatar
      4f1f9698
    • Muchun Song's avatar
      mm: kfence: fix objcgs vector allocation · 8f0b3649
      Muchun Song authored
      If the kfence object is allocated to be used for objects vector, then
      this slot of the pool eventually being occupied permanently since the
      vector is never freed.  The solutions could be (1) freeing vector when
      the kfence object is freed or (2) allocating all vectors statically.
      
      Since the memory consumption of object vectors is low, it is better to
      chose (2) to fix the issue and it is also can reduce overhead of vectors
      allocating in the future.
      
      Link: https://lkml.kernel.org/r/20220328132843.16624-1-songmuchun@bytedance.com
      
      
      Fixes: d3fb45f3 ("mm, kfence: insert KFENCE hooks for SLAB")
      Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarRoman Gushchin <roman.gushchin@linux.dev>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f0b3649
    • Sebastian Andrzej Siewior's avatar
      mm/munlock: protect the per-CPU pagevec by a local_lock_t · adb11e78
      Sebastian Andrzej Siewior authored
      The access to mlock_pvec is protected by disabling preemption via
      get_cpu_var() or implicit by having preemption disabled by the caller
      (in mlock_page_drain() case).  This breaks on PREEMPT_RT since
      folio_lruvec_lock_irq() acquires a sleeping lock in this section.
      
      Create struct mlock_pvec which consits of the local_lock_t and the
      pagevec.  Acquire the local_lock() before accessing the per-CPU pagevec.
      Replace mlock_page_drain() with a _local() version which is invoked on
      the local CPU and acquires the local_lock_t and a _remote() version
      which uses the pagevec from a remote CPU which offline.
      
      Link: https://lkml.kernel.org/r/YjizWi9IY0mpvIfb@linutronix.de
      
      
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      adb11e78
    • Hugh Dickins's avatar
      mm/munlock: update Documentation/vm/unevictable-lru.rst · 577e9846
      Hugh Dickins authored
      Update Documentation/vm/unevictable-lru.rst to reflect the changes made
      by the mm/munlock series: keeping an mlock_count instead of page_mlock()
      (formerly try_to_munlock()) and munlock_vma_pages_all() etc.  Also make
      other little updates or cleanups wherever noticed.
      
      But, I apologize, this is already out of date, in that "folio" appears
      nowhere: 5.18 will be in a transitional state from "page" to "folio",
      and documenting its current mix of the two does not help to understand
      "the Unevictable LRU".  Should be revisited when naming is more settled.
      
      Link: https://lkml.kernel.org/r/3753962-d491-bf60-f59f-51bfe84fd6a0@google.com
      
      
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Alistair Popple <apopple@nvidia.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Yu Zhao <yuzhao@google.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      577e9846
    • Hugh Dickins's avatar
      mm/munlock: add lru_add_drain() to fix memcg_stat_test · ece369c7
      Hugh Dickins authored
      Mike reports that LTP memcg_stat_test usually leads to
      
        memcg_stat_test 3 TINFO: Test unevictable with MAP_LOCKED
        memcg_stat_test 3 TINFO: Running memcg_process --mmap-lock1 -s 135168
        memcg_stat_test 3 TINFO: Warming up pid: 3460
        memcg_stat_test 3 TINFO: Process is still here after warm up: 3460
        memcg_stat_test 3 TFAIL: unevictable is 122880, 135168 expected
      
      but may also lead to
      
        memcg_stat_test 4 TINFO: Test unevictable with mlock
        memcg_stat_test 4 TINFO: Running memcg_process --mmap-lock2 -s 135168
        memcg_stat_test 4 TINFO: Warming up pid: 4271
        memcg_stat_test 4 TINFO: Process is still here after warm up: 4271
        memcg_stat_test 4 TFAIL: unevictable is 122880, 135168 expected
      
      or both.  A wee bit flaky.
      
      follow_page_pte() used to have an lru_add_drain() per each page mlocked,
      and the test came to rely on accurate stats.  The pagevec to be drained
      is different now, but still covered by lru_add_drain(); and, never mind
      the test, I believe it's in everyone's interest that a bulk faulting
      interface like populate_vma_page_range() or faultin_vma_page_range()
      should drain its local pagevecs at the end, to save others sometimes
      needing the much more expensive lru_add_drain_all().
      
      This does not absolutely guarantee exact stats - the mlocking task can
      be migrated between CPUs as it proceeds - but it's good enough and the
      tests pass.
      
      Link: https://lkml.kernel.org/r/47f6d39c-a075-50cb-1cfb-26dd957a48af@google.com
      
      
      Fixes: b67bf49c ("mm/munlock: delete FOLL_MLOCK and FOLL_POPULATE")
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reported-by: default avatarMike Galbraith <efault@gmx.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ece369c7
    • Ryusuke Konishi's avatar
      nilfs2: get rid of nilfs_mapping_init() · cdd81b31
      Ryusuke Konishi authored
      After applying the lockdep warning fixes, nilfs_mapping_init() is no
      longer used, so delete it.
      
      Link: https://lkml.kernel.org/r/1647867427-30498-4-git-send-email-konishi.ryusuke@gmail.com
      
      
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Hao Sun <sunhao.th@gmail.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cdd81b31
    • Ryusuke Konishi's avatar
      nilfs2: fix lockdep warnings during disk space reclamation · 6e211930
      Ryusuke Konishi authored
      During disk space reclamation, nilfs2 still emits the following lockdep
      warning due to page/folio operations on shadowed page caches that nilfs2
      uses to get a snapshot of DAT file in memory:
      
        WARNING: CPU: 0 PID: 2643 at include/linux/backing-dev.h:272 __folio_mark_dirty+0x645/0x670
        ...
        RIP: 0010:__folio_mark_dirty+0x645/0x670
        ...
        Call Trace:
          filemap_dirty_folio+0x74/0xd0
          __set_page_dirty_nobuffers+0x85/0xb0
          nilfs_copy_dirty_pages+0x288/0x510 [nilfs2]
          nilfs_mdt_save_to_shadow_map+0x50/0xe0 [nilfs2]
          nilfs_clean_segments+0xee/0x5d0 [nilfs2]
          nilfs_ioctl_clean_segments.isra.19+0xb08/0xf40 [nilfs2]
          nilfs_ioctl+0xc52/0xfb0 [nilfs2]
          __x64_sys_ioctl+0x11d/0x170
      
      This fixes the remaining warning by using inode objects to hold those
      page caches.
      
      Link: https://lkml.kernel.org/r/1647867427-30498-3-git-send-email-konishi.ryusuke@gmail.com
      
      
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Hao Sun <sunhao.th@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6e211930
    • Ryusuke Konishi's avatar
      nilfs2: fix lockdep warnings in page operations for btree nodes · e897be17
      Ryusuke Konishi authored
      Patch series "nilfs2 lockdep warning fixes".
      
      The first two are to resolve the lockdep warning issue, and the last one
      is the accompanying cleanup and low priority.
      
      Based on your comment, this series solves the issue by separating inode
      object as needed.  Since I was worried about the impact of the object
      composition changes, I tested the series carefully not to cause
      regressions especially for delicate functions such like disk space
      reclamation and snapshots.
      
      This patch (of 3):
      
      If CONFIG_LOCKDEP is enabled, nilfs2 hits lockdep warnings at
      inode_to_wb() during page/folio operations for btree nodes:
      
        WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 inode_to_wb include/linux/backing-dev.h:269 [inline]
        WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 folio_account_dirtied mm/page-writeback.c:2460 [inline]
        WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 __folio_mark_dirty+0xa7c/0xe30 mm/page-writeback.c:2509
        Modules linked in:
        ...
        RIP: 0010:inode_to_wb include/linux/backing-dev.h:269 [inline]
        RIP: 0010:folio_account_dirtied mm/page-writeback.c:2460 [inline]
        RIP: 0010:__folio_mark_dirty+0xa7c/0xe30 mm/page-writeback.c:2509
        ...
        Call Trace:
          __set_page_dirty include/linux/pagemap.h:834 [inline]
          mark_buffer_dirty+0x4e6/0x650 fs/buffer.c:1145
          nilfs_btree_propagate_p fs/nilfs2/btree.c:1889 [inline]
          nilfs_btree_propagate+0x4ae/0xea0 fs/nilfs2/btree.c:2085
          nilfs_bmap_propagate+0x73/0x170 fs/nilfs2/bmap.c:337
          nilfs_collect_dat_data+0x45/0xd0 fs/nilfs2/segment.c:625
          nilfs_segctor_apply_buffers+0x14a/0x470 fs/nilfs2/segment.c:1009
          nilfs_segctor_scan_file+0x47a/0x700 fs/nilfs2/segment.c:1048
          nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1224 [inline]
          nilfs_segctor_collect fs/nilfs2/segment.c:1494 [inline]
          nilfs_segctor_do_construct+0x14f3/0x6c60 fs/nilfs2/segment.c:2036
          nilfs_segctor_construct+0x7a7/0xb30 fs/nilfs2/segment.c:2372
          nilfs_segctor_thread_construct fs/nilfs2/segment.c:2480 [inline]
          nilfs_segctor_thread+0x3c3/0xf90 fs/nilfs2/segment.c:2563
          kthread+0x405/0x4f0 kernel/kthread.c:327
          ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
      
      This is because nilfs2 uses two page caches for each inode and
      inode->i_mapping never points to one of them, the btree node cache.
      
      This causes inode_to_wb(inode) to refer to a different page cache than
      the caller page/folio operations such like __folio_start_writeback(),
      __folio_end_writeback(), or __folio_mark_dirty() acquired the lock.
      
      This patch resolves the issue by allocating and using an additional
      inode to hold the page cache of btree nodes.  The inode is attached
      one-to-one to the traditional nilfs2 inode if it requires a block
      mapping with b-tree.  This setup change is in memory only and does not
      affect the disk format.
      
      Link: https://lkml.kernel.org/r/1647867427-30498-1-git-send-email-konishi.ryusuke@gmail.com
      Link: https://lkml.kernel.org/r/1647867427-30498-2-git-send-email-konishi.ryusuke@gmail.com
      Link: https://lore.kernel.org/r/YXrYvIo8YRnAOJCj@casper.infradead.org
      Link: https://lore.kernel.org/r/9a20b33d-b38f-b4a2-4742-c1eb5b8e4d6c@redhat.com
      
      
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+0d5b462a6f07447991b3@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+34ef28bb2aeb28724aa0@syzkaller.appspotmail.com>
      Reported-by: default avatarHao Sun <sunhao.th@gmail.com>
      Reported-by: default avatarDavid Hildenbrand <david@redhat.com>
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e897be17
    • Joseph Qi's avatar
      ocfs2: fix crash when mount with quota enabled · de194334
      Joseph Qi authored
      There is a reported crash when mounting ocfs2 with quota enabled.
      
        RIP: 0010:ocfs2_qinfo_lock_res_init+0x44/0x50 [ocfs2]
        Call Trace:
          ocfs2_local_read_info+0xb9/0x6f0 [ocfs2]
          dquot_load_quota_sb+0x216/0x470
          dquot_load_quota_inode+0x85/0x100
          ocfs2_enable_quotas+0xa0/0x1c0 [ocfs2]
          ocfs2_fill_super.cold+0xc8/0x1bf [ocfs2]
          mount_bdev+0x185/0x1b0
          legacy_get_tree+0x27/0x40
          vfs_get_tree+0x25/0xb0
          path_mount+0x465/0xac0
          __x64_sys_mount+0x103/0x140
      
      It is caused by when initializing dqi_gqlock, the corresponding dqi_type
      and dqi_sb are not properly initialized.
      
      This issue is introduced by commit 6c85c2c7, which wants to avoid
      accessing uninitialized variables in error cases.  So make global quota
      info properly initialized.
      
      Link: https://lkml.kernel.org/r/20220323023644.40084-1-joseph.qi@linux.alibaba.com
      Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1007141
      
      
      Fixes: 6c85c2c7 ("ocfs2: quota_local: fix possible uninitialized-variable access in ocfs2_local_read_info()")
      Signed-off-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Reported-by: default avatarDayvison <sathlerds@gmail.com>
      Tested-by: default avatarValentin Vidic <vvidic@valentin-vidic.from.hr>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      de194334
    • Charan Teja Kalla's avatar
      Revert "mm: madvise: skip unmapped vma holes passed to process_madvise" · e6b0a7b3
      Charan Teja Kalla authored
      This reverts commit 08095d63 ("mm: madvise: skip unmapped vma holes
      passed to process_madvise") as process_madvise() fails to return the
      exact processed bytes in other cases too.
      
      As an example: if process_madvise() hits mlocked pages after processing
      some initial bytes passed in [start, end), it just returns EINVAL
      although some bytes are processed.  Thus making an exception only for
      ENOMEM is partially fixing the problem of returning the proper advised
      bytes.
      
      Thus revert this patch and return proper bytes advised.
      
      Link: https://lkml.kernel.org/r/e73da1304a88b6a8a11907045117cccf4c2b8374.1648046642.git.quic_charante@quicinc.com
      
      
      Fixes: 08095d63 ("mm: madvise: skip unmapped vma holes passed to process_madvise")
      Signed-off-by: default avatarCharan Teja Kalla <quic_charante@quicinc.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e6b0a7b3
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · d0d642a5
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Just a few fixes that have been gathered since the previous pull:
      
         - An additional fix for potential PCM deadlocks
      
         - A series of HD-audio CS8409 codec patches for new models
      
         - Other device specific fixes for HD-audio, ASoC mediatek, Intel,
           fsl, rockchip"
      
      * tag 'sound-fix-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock
        ALSA: hda: Avoid unsol event during RPM suspending
        ALSA: hda/realtek: Fix audio regression on Mi Notebook Pro 2020
        ALSA: hda/cs8409: Add new Dolphin HW variants
        ALSA: hda/cs8409: Disable HSBIAS_SENSE_EN for Cyborg
        ALSA: hda/cs8409: Support new Warlock MLK Variants
        ALSA: hda/cs8409: Fix Full Scale Volume setting for all variants
        ALSA: hda/cs8409: Re-order quirk table into ascending order
        ALSA: hda/cs8409: Fix Warlock to use mono mic configuration
        ALSA: cs4236: fix an incorrect NULL check on list iterator
        ALSA: hda/realtek: Enable headset mic on Lenovo P360
        ASoC: SOF: Intel: Fix build error without SND_SOC_SOF_PCI_DEV
        ALSA: hda/realtek: Add mute and micmut LED support for Zbook Fury 17 G9
        ASoC: rockchip: i2s_tdm: Fixup config for SND_SOC_DAIFMT_DSP_A/B
        ASoC: fsl-asoc-card: Fix jack_event() always return 0
        ASoC: mediatek: mt6358: add missing EXPORT_SYMBOLs
      d0d642a5
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 26803bac
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - grammar and formatting fixes in comments for gpio-ts4900
      
       - correct links in gpio-ts5500
      
       - fix a warning in doc generation for the core GPIO documentation
      
      * tag 'gpio-fixes-for-v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: ts5500: Fix Links to Technologic Systems web resources
        gpio: Properly document parent data union
        gpio: ts4900: Fix comment formatting and grammar
      26803bac
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · aa240ee7
      Linus Torvalds authored
      Pull input updates from Dmitry Torokhov:
      
       - a revert of a patch resetting extra buttons on touchpads claiming to
         be buttonpads as this caused regression on certain Dell devices
      
       - a new driver for Mediatek MT6779 keypad
      
       - a new driver for Imagis touchscreen
      
       - rework of Google/Chrome OS "Vivaldi" keyboard handling
      
       - assorted driver fixes.
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (31 commits)
        Revert "Input: clear BTN_RIGHT/MIDDLE on buttonpads"
        Input: adi - remove redundant variable z
        Input: add Imagis touchscreen driver
        dt-bindings: input/touchscreen: bindings for Imagis
        Input: synaptics - enable InterTouch on ThinkPad T14/P14s Gen 1 AMD
        Input: stmfts - fix reference leak in stmfts_input_open
        Input: add bounds checking to input_set_capability()
        Input: iqs5xx - use local input_dev pointer
        HID: google: modify HID device groups of eel
        HID: google: Add support for vivaldi to hid-hammer
        HID: google: extract Vivaldi hid feature mapping for use in hid-hammer
        Input: extract ChromeOS vivaldi physmap show function
        HID: google: switch to devm when registering keyboard backlight LED
        Input: mt6779-keypad - fix signedness bug
        Input: mt6779-keypad - add MediaTek keypad driver
        dt-bindings: input: Add bindings for Mediatek matrix keypad
        Input: da9063 - use devm_delayed_work_autocancel()
        Input: goodix - fix race on driver unbind
        Input: goodix - use input_copy_abs() helper
        Input: add input_copy_abs() function
        ...
      aa240ee7
    • Linus Torvalds's avatar
      Merge tag 'rtc-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux · 6a34fdcc
      Linus Torvalds authored
      Pull RTC updates from Alexandre Belloni:
       "The bulk of the patches are about replacing the uie_unsupported struct
        rtc_device member by a feature bit.
      
        Subsystem:
      
         - remove uie_unsupported, all users have been converted to clear
           RTC_FEATURE_UPDATE_INTERRUPT and provide a reason
      
         - RTCs with an alarm with a resolution of a minute are now letting
           the core handle rounding down the alarm time
      
         - fix use-after-free on device removal
      
        New driver:
      
         - OP-TEE RTC PTA
      
        Drivers:
      
         - sun6i: Add H616 support
      
         - cmos: Fix the AltCentury for AMD platforms
      
         - spear: set range"
      
      * tag 'rtc-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (56 commits)
        rtc: check if __rtc_read_time was successful
        rtc: gamecube: Fix refcount leak in gamecube_rtc_read_offset_from_sram
        rtc: mc146818-lib: Fix the AltCentury for AMD platforms
        rtc: optee: add RTC driver for OP-TEE RTC PTA
        rtc: pm8xxx: Return -ENODEV if set_time disallowed
        rtc: pm8xxx: Attach wake irq to device
        clk: sunxi-ng: sun6i-rtc: include clk/sunxi-ng.h
        rtc: remove uie_unsupported
        rtc: xgene: stop using uie_unsupported
        rtc: hym8563: switch to RTC_FEATURE_UPDATE_INTERRUPT
        rtc: hym8563: let the core handle the alarm resolution
        rtc: hym8563: switch to devm_rtc_allocate_device
        rtc: efi: switch to RTC_FEATURE_UPDATE_INTERRUPT
        rtc: efi: switch to devm_rtc_allocate_device
        rtc: add new RTC_FEATURE_ALARM_WAKEUP_ONLY feature
        rtc: spear: fix spear_rtc_read_time
        rtc: spear: drop uie_unsupported
        rtc: spear: set range
        rtc: spear: switch to devm_rtc_allocate_device
        rtc: pcf8563: switch to RTC_FEATURE_UPDATE_INTERRUPT
        ...
      6a34fdcc
  2. Apr 01, 2022
    • José Expósito's avatar
      Revert "Input: clear BTN_RIGHT/MIDDLE on buttonpads" · 8b188fba
      José Expósito authored
      
      
      This reverts commit 37ef4c19.
      
      The touchpad present in the Dell Precision 7550 and 7750 laptops
      reports a HID_DG_BUTTONTYPE of type MT_BUTTONTYPE_CLICKPAD. However,
      the device is not a clickpad, it is a touchpad with physical buttons.
      
      In order to fix this issue, a quirk for the device was introduced in
      libinput [1] [2] to disable the INPUT_PROP_BUTTONPAD property:
      
      	[Precision 7x50 Touchpad]
      	MatchBus=i2c
      	MatchUdevType=touchpad
      	MatchDMIModalias=dmi:*svnDellInc.:pnPrecision7?50*
      	AttrInputPropDisable=INPUT_PROP_BUTTONPAD
      
      However, because of the change introduced in 37ef4c19 ("Input: clear
      BTN_RIGHT/MIDDLE on buttonpads") the BTN_RIGHT key bit is not mapped
      anymore breaking the device right click button and making impossible to
      workaround it in user space.
      
      In order to avoid breakage on other present or future devices, revert
      the patch causing the issue.
      
      Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      Acked-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220321184404.20025-1-jose.exposito89@gmail.com
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      8b188fba
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml · e8b767f5
      Linus Torvalds authored
      Pull UML updates from Richard Weinberger:
      
       - Devicetree support (for testing)
      
       - Various cleanups and fixes: UBD, port_user, uml_mconsole
      
       - Maintainer update
      
      * tag 'for-linus-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
        um: run_helper: Write error message to kernel log on exec failure on host
        um: port_user: Improve error handling when port-helper is not found
        um: port_user: Allow setting path to port-helper using UML_PORT_HELPER envvar
        um: port_user: Search for in.telnetd in PATH
        um: clang: Strip out -mno-global-merge from USER_CFLAGS
        docs: UML: Mention telnetd for port channel
        um: Remove unused timeval_to_ns() function
        um: Fix uml_mconsole stop/go
        um: Cleanup syscall_handler_t definition/cast, fix warning
        uml: net: vector: fix const issue
        um: Fix WRITE_ZEROES in the UBD Driver
        um: Migrate vector drivers to NAPI
        um: Fix order of dtb unflatten/early init
        um: fix and optimize xor select template for CONFIG64 and timetravel mode
        um: Document dtb command line option
        lib/logic_iomem: correct fallback config references
        um: Remove duplicated include in syscalls_64.c
        MAINTAINERS: Update UserModeLinux entry
      e8b767f5
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs · a87a08e3
      Linus Torvalds authored
      Pull JFFS2, UBI and UBIFS updates from Richard Weinberger:
       "JFFS2:
         - Fixes for various memory issues
      
        UBI:
         - Fix for a race condition in cdev ioctl handler
      
        UBIFS:
         - Fixes for O_TMPFILE and whiteout handling
      
         - Fixes for various memory issues"
      
      * tag 'for-linus-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
        ubifs: rename_whiteout: correct old_dir size computing
        jffs2: fix memory leak in jffs2_scan_medium
        jffs2: fix memory leak in jffs2_do_mount_fs
        jffs2: fix use-after-free in jffs2_clear_xattr_subsystem
        fs/jffs2: fix comments mentioning i_mutex
        ubi: fastmap: Return error code if memory allocation fails in add_aeb()
        ubifs: Fix to add refcount once page is set private
        ubifs: Fix read out-of-bounds in ubifs_wbuf_write_nolock()
        ubifs: setflags: Make dirtied_ino_d 8 bytes aligned
        ubifs: Rectify space amount budget for mkdir/tmpfile operations
        ubifs: Fix 'ui->dirty' race between do_tmpfile() and writeback work
        ubifs: Rename whiteout atomically
        ubifs: Add missing iput if do_tmpfile() failed in rename whiteout
        ubifs: Fix wrong number of inodes locked by ui_mutex in ubifs_inode comment
        ubifs: Fix deadlock in concurrent rename whiteout and inode writeback
        ubifs: rename_whiteout: Fix double free for whiteout_ui->data
        ubi: Fix race condition between ctrl_cdev_ioctl and ubi_cdev_ioctl
      a87a08e3
    • Linus Torvalds's avatar
      Merge tag 'gfs2-v5.17-rc4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 · 3d198e42
      Linus Torvalds authored
      Pull gfs2 fixes from Andreas Gruenbacher:
      
       - To avoid deadlocks, actively cancel dlm locking requests when we give
         up on them.
      
         Further dlm operations on the same lock will return -EBUSY until the
         cancel has been completed, so in that case, wait and repeat. (This is
         rare.)
      
       - Lock inversion fixes in gfs2_inode_lookup() and gfs2_create_inode().
      
       - Some more fallout from the gfs2 mmap + page fault deadlock fixes
         (merged in commit c03098d4: "Merge tag 'gfs2-v5.15-rc5-mmap-fault'").
      
       - Various other minor bug fixes and cleanups.
      
      * tag 'gfs2-v5.17-rc4-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
        gfs2: Make sure FITRIM minlen is rounded up to fs block size
        gfs2: Make sure not to return short direct writes
        gfs2: Remove dead code in gfs2_file_read_iter
        gfs2: Fix gfs2_file_buffered_write endless loop workaround
        gfs2: Minor retry logic cleanup
        gfs2: Disable page faults during lockless buffered reads
        gfs2: Fix should_fault_in_pages() logic
        gfs2: Remove return value for gfs2_indirect_init
        gfs2: Initialize gh_error in gfs2_glock_nq
        gfs2: Make use of list_is_first
        gfs2: Switch lock order of inode and iopen glock
        gfs2: cancel timed-out glock requests
        gfs2: Expect -EBUSY after canceling dlm locking requests
        gfs2: gfs2_setattr_size error path fix
        gfs2: assign rgrp glock before compute_bitstructs
      3d198e42
    • Linus Torvalds's avatar
      Merge tag 'netfs-prep-20220318' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · f008b1d6
      Linus Torvalds authored
      Pull netfs updates from David Howells:
       "Netfs prep for write helpers.
      
        Having had a go at implementing write helpers and content encryption
        support in netfslib, it seems that the netfs_read_{,sub}request
        structs and the equivalent write request structs were almost the same
        and so should be merged, thereby requiring only one set of
        alloc/get/put functions and a common set of tracepoints.
      
        Merging the structs also has the advantage that if a bounce buffer is
        added to the request struct, a read operation can be performed to fill
        the bounce buffer, the contents of the buffer can be modified and then
        a write operation can be performed on it to send the data wherever it
        needs to go using the same request structure all the way through. The
        I/O handlers would then transparently perform any required crypto.
        This should make it easier to perform RMW cycles if needed.
      
        The potentially common functions and structs, however, by their names
        all proclaim themselves to be associated with the read side of things.
      
        The bulk of these changes alter this in the following ways:
      
         - Rename struct netfs_read_{,sub}request to netfs_io_{,sub}request.
      
         - Rename some enums, members and flags to make them more appropriate.
      
         - Adjust some comments to match.
      
         - Drop "read"/"rreq" from the names of common functions. For
           instance, netfs_get_read_request() becomes netfs_get_request().
      
         - The ->init_rreq() and ->issue_op() methods become ->init_request()
           and ->issue_read(). I've kept the latter as a read-specific
           function and in another branch added an ->issue_write() method.
      
        The driver source is then reorganised into a number of files:
      
              fs/netfs/buffered_read.c        Create read reqs to the pagecache
              fs/netfs/io.c                   Dispatchers for read and write reqs
              fs/netfs/main.c                 Some general miscellaneous bits
              fs/netfs/objects.c              Alloc, get and put functions
              fs/netfs/stats.c                Optional procfs statistics.
      
        and future development can be fitted into this scheme, e.g.:
      
              fs/netfs/buffered_write.c       Modify the pagecache
              fs/netfs/buffered_flush.c       Writeback from the pagecache
              fs/netfs/direct_read.c          DIO read support
              fs/netfs/direct_write.c         DIO write support
              fs/netfs/unbuffered_write.c     Write modifications directly back
      
        Beyond the above changes, there are also some changes that affect how
        things work:
      
         - Make fscache_end_operation() generally available.
      
         - In the netfs tracing header, generate enums from the symbol ->
           string mapping tables rather than manually coding them.
      
         - Add a struct for filesystems that uses netfslib to put into their
           inode wrapper structs to hold extra state that netfslib is
           interested in, such as the fscache cookie. This allows netfslib
           functions to be set in filesystem operation tables and jumped to
           directly without having to have a filesystem wrapper.
      
         - Add a member to the struct added above to track the remote inode
           length as that may differ if local modifications are buffered. We
           may need to supply an appropriate EOF pointer when storing data (in
           AFS for example).
      
         - Pass extra information to netfs_alloc_request() so that the
           ->init_request() hook can access it and retain information to
           indicate the origin of the operation.
      
         - Make the ->init_request() hook return an error, thereby allowing a
           filesystem that isn't allowed to cache an inode (ceph or cifs, for
           example) to skip readahead.
      
         - Switch to using refcount_t for subrequests and add tracepoints to
           log refcount changes for the request and subrequest structs.
      
         - Add a function to consolidate dispatching a read request. Similar
           code is used in three places and another couple are likely to be
           added in the future"
      
      Link: https://lore.kernel.org/all/2639515.1648483225@warthog.procyon.org.uk/
      
      * tag 'netfs-prep-20220318' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Maintain netfs_i_context::remote_i_size
        netfs: Keep track of the actual remote file size
        netfs: Split some core bits out into their own file
        netfs: Split fs/netfs/read_helper.c
        netfs: Rename read_helper.c to io.c
        netfs: Prepare to split read_helper.c
        netfs: Add a function to consolidate beginning a read
        netfs: Add a netfs inode context
        ceph: Make ceph_init_request() check caps on readahead
        netfs: Change ->init_request() to return an error code
        netfs: Refactor arguments for netfs_alloc_read_request
        netfs: Adjust the netfs_failure tracepoint to indicate non-subreq lines
        netfs: Trace refcounting on the netfs_io_subrequest struct
        netfs: Trace refcounting on the netfs_io_request struct
        netfs: Adjust the netfs_rreq tracepoint slightly
        netfs: Split netfs_io_* object handling out
        netfs: Finish off rename of netfs_read_request to netfs_io_request
        netfs: Rename netfs_read_*request to netfs_io_*request
        netfs: Generate enums from trace symbol mapping lists
        fscache: export fscache_end_operation()
      f008b1d6