1. 11 Sep, 2021 3 commits
  2. 10 Sep, 2021 15 commits
    • Arnaldo Carvalho de Melo's avatar
      perf bpf: Provide a weak btf__load_from_kernel_by_id() for older libbpf versions · 218e7b77
      Arnaldo Carvalho de Melo authored
      The btf__get_from_id() function was deprecated in favour of
      btf__load_from_kernel_by_id(), but it is still avaiable, so use it to
      provide a weak function btf__load_from_kernel_by_id() for older libbpf
      when building perf with LIBBPF_DYNAMIC=1, i.e. using the system's libbpf
      package.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      218e7b77
    • Arnaldo Carvalho de Melo's avatar
      tools include UAPI: Update linux/mount.h copy · 37ce9e4f
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        9ffb14ef ("move_mount: allow to add a mount into an existing group")
      
      That ends up adding support for the new MOVE_MOUNT_SET_GROUP move_mount
      flag.
      
        $ tools/perf/trace/beauty/move_mount_flags.sh > before
        $ cp include/uapi/linux/mount.h tools/include/uapi/linux/mount.h
        $ tools/perf/trace/beauty/move_mount_flags.sh > after
        $ diff -u before after
        --- before	2021-09-10 12:28:43.865279808 -0300
        +++ after	2021-09-10 12:28:50.183429184 -0300
        @@ -5,4 +5,5 @@
         	[ilog2(0x00000010) + 1] = "T_SYMLINKS",
         	[ilog2(0x00000020) + 1] = "T_AUTOMOUNTS",
         	[ilog2(0x00000040) + 1] = "T_EMPTY_PATH",
        +	[ilog2(0x00000100) + 1] = "SET_GROUP",
         };
        $
      
      So now one can use it in --filter expressions for tracepoints.
      
      This silences this perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/mount.h' differs from latest version at 'include/uapi/linux/mount.h'
        diff -u tools/include/uapi/linux/mount.h include/uapi/linux/mount.h
      
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      37ce9e4f
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Cover more flags in the move_mount syscall argument beautifier · 155ed9f1
      Arnaldo Carvalho de Melo authored
      Previously the regext expected MOVE_MOUNT_[FT]_*, but in the next patch
      a flag that doesn't match that expression will be added, MOVE_MOUNT_SET_GROUP
      
      To make this more future proof, take advantage of the fact that the only
      one we don't need to cover is MOVE_MOUNT__MASK and use MOVE_MOUNT_[^_]+_*_.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      155ed9f1
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/prctl.h with the kernel sources · 2c3ef25c
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        433c38f4 ("arm64: mte: change ASYNC and SYNC TCF settings into bitfields")
        e893bb1b ("x86, prctl: Hook L1D flushing in via prctl")
      
      That don't result in any changes in tooling:
      
        $ tools/perf/trace/beauty/prctl_option.sh > before
        $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
        $ tools/perf/trace/beauty/prctl_option.sh > after
        $ diff -u before after
        $
      
      Just silences this perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/prctl.h' differs from latest version at 'include/uapi/linux/prctl.h'
        diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
      
      Cc: Balbir Singh <sblbir@amazon.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Peter Collingbourne <pcc@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2c3ef25c
    • Arnaldo Carvalho de Melo's avatar
      tools include UAPI: Sync sound/asound.h copy with the kernel sources · f9f018e4
      Arnaldo Carvalho de Melo authored
      Picking the changes from:
      
        81be1093 ("ALSA: pcm: Add SNDRV_PCM_INFO_EXPLICIT_SYNC flag")
      
      Which entails no changes in the tooling side as it doesn't introduce new
      ioctls.
      
      To silence this perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/sound/asound.h' differs from latest version at 'include/uapi/sound/asound.h'
        diff -u tools/include/uapi/sound/asound.h include/uapi/sound/asound.h
      
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9f018e4
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · dfa00459
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        f95937cc ("KVM: stats: Support linear and logarithmic histogram statistics")
        f0376edb ("KVM: arm64: Add ioctl to fetch/store tags in a guest")
        ea7fc1bb ("KVM: arm64: Introduce MTE VM feature")
      
      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/, so that will
      pick the new KVM_STATS_TYPE_LINEAR_HIST and KVM_STATS_TYPE_LOG_HIST
      defines.
      
      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: Jing Zhang <jingzhangos@google.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Steven Price <steven.price@arm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dfa00459
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources · 03d6f3fe
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        61e5f69e ("KVM: x86: implement KVM_GUESTDBG_BLOCKIRQ")
      
      That just rebuilds kvm-stat.c on x86, no change in functionality.
      
      This silences these perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h'
        diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
      
      Cc: Maxim Levitsky <mlevitsk@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      03d6f3fe
    • Kim Phillips's avatar
      perf report: Add support to print a textual representation of IBS raw sample data · 291dcb98
      Kim Phillips authored
      Perf records IBS (Instruction Based Sampling) extra sample data when
      'perf record --raw-samples' is used with an IBS-compatible event, on a
      machine that supports IBS.  IBS support is indicated in
      CPUID_Fn80000001_ECX bit #10.
      
      Up until now, users have been able to see the extra sample data solely
      in raw hex format using 'perf report --dump-raw-trace'.  From there,
      users could decode the data either manually, or by using an external
      script.
      
      Enable the built-in 'perf report --dump-raw-trace' to do the decoding of
      the extra sample data bits, so manual or external script decoding isn't
      necessary.
      
      Example usage:
      
        $ sudo perf record -c 10000001 -a --raw-samples -e ibs_fetch/rand_en=1/,ibs_op/cnt_ctl=1/ -C 0,1 taskset -c 0,1 7za b -mmt2 | perf report --dump-raw-trace
      
      Stdout contains IBS Fetch samples, e.g.:
      
        ibs_fetch_ctl:	02170007ffffffff MaxCnt 1048560 Cnt 1048560 Lat     7 En 1 Val 1 Comp 1 IcMiss 0 PhyAddrValid 1 L1TlbPgSz 4KB L1TlbMiss 0 L2TlbMiss 0 RandEn 1 L2Miss 0
        IbsFetchLinAd:	000056016b2ead40
        IbsFetchPhysAd:	000000115cedfd40
        c_ibs_ext_ctl:	0000000000000000 IbsItlbRefillLat   0
      
      ..and IBS Op samples, e.g.:
      
        ibs_op_ctl:	0000009e009e8968 MaxCnt  10000000 En 1 Val 1 CntCtl 1=uOps CurCnt       158
        IbsOpRip:	000056016b2ea73d
        ibs_op_data:	00000000000b0002 CompToRetCtr     2 TagToRetCtr    11 BrnRet 0  RipInvalid 0 BrnFuse 0 Microcode 0
        ibs_op_data2:	0000000000000002 CacheHitSt 0=M-state RmtNode 0 DataSrc 2=Local node cache
        ibs_op_data3:	0000000000c60002 LdOp 0 StOp 1 DcL1TlbMiss 0 DcL2TlbMiss 0 DcL1TlbHit2M 0 DcL1TlbHit1G 0 DcL2TlbHit2M 0 DcMiss 0 DcMisAcc 0 DcWcMemAcc 0 DcUcMemAcc 0 DcLockedOp 0 DcMissNoMabAlloc 0 DcLinAddrValid 1 DcPhyAddrValid 1 DcL2TlbHit1G 0 L2Miss 0 SwPf 0 OpMemWidth  4 bytes OpDcMissOpenMemReqs  0 DcMissLat     0 TlbRefillLat     0
        IbsDCLinAd:	00007f133c319ce0
        IbsDCPhysAd:	0000000270485ce0
      
      Committer notes:
      
      Fixed up this:
      
        util/amd-sample-raw.c: In function ‘evlist__amd_sample_raw’:
        util/amd-sample-raw.c:125:42: error: ‘ bytes’ directive output may be truncated writing 6 bytes into a region of size between 4 and 7 [-Werror=format-truncation=]
          125 |                          " OpMemWidth %2d bytes", 1 << (reg.op_mem_width - 1));
              |                                          ^~~~~~
        In file included from /usr/include/stdio.h:866,
                         from util/amd-sample-raw.c:7:
        /usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 21 and 24 bytes into a destination of size 21
           71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
              |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           72 |                                    __glibc_objsize (__s), __fmt,
              |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           73 |                                    __va_arg_pack ());
              |                                    ~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      As that %2d won't limit the number of chars to 2, just state that 2 is
      the minimal width:
      
        $ cat printf.c
        #include <stdio.h>
        #include <stdlib.h>
      
        int main(int argc, char *argv[])
        {
        	char bf[64];
        	int len = snprintf(bf, sizeof(bf), "%2d", atoi(argv[1]));
      
        	printf("strlen(%s): %u\n", bf, len);
      
        	return 0;
        }
        $ ./printf 1
        strlen( 1): 2
        $ ./printf 12
        strlen(12): 2
        $ ./printf 123
        strlen(123): 3
        $ ./printf 1234
        strlen(1234): 4
        $ ./printf 12345
        strlen(12345): 5
        $ ./printf 123456
        strlen(123456): 6
        $
      
      And since we probably don't want that output to be truncated, just
      assume the worst case, as the compiler did, and add a few more chars to
      that buffer.
      
      Also use sizeof(var) instead of sizeof(dup-of-wanted-format-string) to
      avoid bugs when changing one but not the other.
      
      I also had to change this:
      
        -#include <asm/amd-ibs.h>
        +#include "../../arch/x86/include/asm/amd-ibs.h"
      
      To make it build on other architectures, just like intel-pt does.
      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@redhat.com>
      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/20210817221509.88391-4-kim.phillips@amd.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      291dcb98
    • Kim Phillips's avatar
      perf report: Add tools/arch/x86/include/asm/amd-ibs.h · dde994dd
      Kim Phillips authored
      This is a tools/-side patch for the patch that adds the original copy
      of the IBS header file, in arch/x86/include/asm/.
      
      We also add an entry to check-headers.sh, so future changes continue
      to be copied.
      
      Committer notes:
      
      Had to add this
      
        -#include <asm/msr-index.h>
        +#include "msr-index.h"
      
      And change the check-headers.sh entry to ignore this line when diffing
      with the original kernel header.
      
      This is needed so that we can use 'perf report' on a perf.data with IBS
      data on a !x86 system, i.e. building on ARM fails without this as there
      is no asm/msr-index.h there.
      
      This was done on the next patch in this series and is done for things
      like Intel PT and ARM CoreSight.
      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@redhat.com>
      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/20210817221509.88391-3-kim.phillips@amd.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dde994dd
    • Kim Phillips's avatar
      perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings · 9fe8895a
      Kim Phillips authored
      To be used by IBS raw data display: It needs the recorder's cpuid in
      order to determine which errata workarounds to apply to the data, and
      the pmu_mappings are needed in order to figure out which PMU sample
      type is IBS Fetch vs. IBS Op.
      
      When not available from perf.data, we assume local operation, and
      retrieve cpuid and pmu mappings directly from the running system.
      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@redhat.com>
      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/20210817221509.88391-2-kim.phillips@amd.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9fe8895a
    • Remi Bernon's avatar
      perf symbol: Look for ImageBase in PE file to compute .text offset · d2930ede
      Remi Bernon authored
      Instead of using the file offset in the debug file.
      
      This fixes a regression from 00a34234 ("perf symbols: Make
      dso__load_bfd_symbols() load PE files from debug cache only"), causing
      incorrect symbol resolution when debug file have been stripped from
      non-debug sections (in which case its .text section is empty and doesn't
      have any file position).
      
      The debug files could also be created with a different file alignment,
      and have different file positions from the mmap-ed binary, or have the
      section reordered.
      
      This instead looks for the file image base, using the corresponding bfd
      *ABS* symbols. As PE symbols only have 4 bytes, it also needs to keep
      .text section vma high bits.
      Signed-off-by: default avatarRemi Bernon <rbernon@codeweavers.com>
      Fixes: 00a34234 ("perf symbols: Make dso__load_bfd_symbols() load PE files from debug cache only")
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Nicholas Fraser <nfraser@codeweavers.com>
      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/20210909192637.4139125-1-rbernon@codeweavers.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d2930ede
    • Michael Petlan's avatar
      perf scripts python: Fix passing arguments to stackcollapse report · 51ae7fa6
      Michael Petlan authored
      The '--' prevented arguments from being passed to the script, such as:
      
        $ perf script report stackcollapse -i my_perf.data
      Signed-off-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      LPU-Reference: 20200427142327.21172-1-mpetlan@redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      51ae7fa6
    • Michael Petlan's avatar
      perf test: Fix bpf test sample mismatch reporting · 3e11300c
      Michael Petlan authored
      When the expected sample count in the condition changed, the message
      needs to be changed too, otherwise we'll get:
      
        0x1001f2091d8: mmap mask[0]:
        BPF filter result incorrect, expected 56, got 56 samples
      
      Fixes: 4b04e0de ("perf test: Fix basic bpf filtering test")
      Signed-off-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Link: https //lore.kernel.org/r/20210805160611.5542-1-mpetlan@redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3e11300c
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync files changed by new process_mrelease syscall and the... · 64f45351
      Arnaldo Carvalho de Melo authored
      tools headers UAPI: Sync files changed by new process_mrelease syscall and the removal of some compat entry points
      
      To pick the changes in these csets:
      
        59ab844e ("compat: remove some compat entry points")
        dce49103 ("mm: wire up syscall process_mrelease")
        b48c7236 ("exit/bdflush: Remove the deprecated bdflush system call")
      
      That add support for this new syscall in tools such as 'perf trace'.
      
      For instance, this is now possible:
      
        # perf trace -v -e process_mrelease
        event qualifier tracepoint filter: (common_pid != 19351 && common_pid != 9112) && (id == 448)
        ^C#
      
      That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ grep process_mrelease tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        448    common  process_mrelease            sys_process_mrelease
        $
      
      This addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/powerpc/entry/syscalls/syscall.tbl' differs from latest version at 'arch/powerpc/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/s390/entry/syscalls/syscall.tbl' differs from latest version at 'arch/s390/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl' differs from latest version at 'arch/mips/kernel/syscalls/syscall_n64.tbl'
        diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      64f45351
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Update copy of linux/socket.h with the kernel sources · bb91de44
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
      Fixes: d32f89da ("net: add accept helper not installing fd")
      Fixes: bc49d816 ("mctp: Add MCTP base")
      
      This automagically adds support for the AF_MCTP protocol domain:
      
        $ 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	2021-09-06 11:57:14.972747200 -0300
        +++ after	2021-09-06 11:57:30.541920222 -0300
        @@ -44,4 +44,5 @@
         	[42] = "QIPCRTR",
         	[43] = "SMC",
         	[44] = "XDP",
        +	[45] = "MCTP",
         };
        $
      
      This will allow 'perf trace' to translate 45 into "MCTP" as is done with
      the other domains:
      
        # perf trace -e socket*
           0.000 chronyd/1029 socket(family: INET, type: DGRAM|CLOEXEC|NONBLOCK, protocol: IP) = 4
        ^C#
      
      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: David S. Miller <davem@davemloft.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Jeremy Kerr <jk@codeconstruct.com.au>
      Cc: Pavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bb91de44
  3. 09 Sep, 2021 22 commits
    • Linus Torvalds's avatar
      Merge tag '5.15-rc-ksmbd-part2' of git://git.samba.org/ksmbd · bf9f243f
      Linus Torvalds authored
      Pull ksmbd fixes from Steve French:
      
       - various fixes pointed out by coverity, and a minor cleanup patch
      
       - id mapping and ownership fixes
      
       - an smbdirect fix
      
      * tag '5.15-rc-ksmbd-part2' of git://git.samba.org/ksmbd:
        ksmbd: fix control flow issues in sid_to_id()
        ksmbd: fix read of uninitialized variable ret in set_file_basic_info
        ksmbd: add missing assignments to ret on ndr_read_int64 read calls
        ksmbd: add validation for ndr read/write functions
        ksmbd: remove unused ksmbd_file_table_flush function
        ksmbd: smbd: fix dma mapping error in smb_direct_post_send_data
        ksmbd: Reduce error log 'speed is unknown' to debug
        ksmbd: defer notify_change() call
        ksmbd: remove setattr preparations in set_file_basic_info()
        ksmbd: ensure error is surfaced in set_file_basic_info()
        ndr: fix translation in ndr_encode_posix_acl()
        ksmbd: fix translation in sid_to_id()
        ksmbd: fix subauth 0 handling in sid_to_id()
        ksmbd: fix translation in acl entries
        ksmbd: fix translation in ksmbd_acls_fattr()
        ksmbd: fix translation in create_posix_rsp_buf()
        ksmbd: fix translation in smb2_populate_readdir_entry()
        ksmbd: fix lookup on idmapped mounts
      bf9f243f
    • Linus Torvalds's avatar
      Merge tag 'for-5.15-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 8dde2086
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - fix max_inline mount option limit on 64k page system
      
       - lockdep fixes:
           - update bdev time in a safer way
           - move bdev put outside of sb write section when removing device
           - fix possible deadlock when mounting seed/sprout filesystem
      
       - zoned mode: fix split extent accounting
      
       - minor include fixup
      
      * tag 'for-5.15-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: zoned: fix double counting of split ordered extent
        btrfs: fix lockdep warning while mounting sprout fs
        btrfs: delay blkdev_put until after the device remove
        btrfs: update the bdev time directly when closing
        btrfs: use correct header for div_u64 in misc.h
        btrfs: fix upper limit for max_inline for page size 64K
      8dde2086
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · ae79394a
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A collection of small fixes that have been gathered before rc1,
        including a few regression fixes for the problem in the previous pull
        request"
      
      * tag 'sound-fix-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: gus: Fix repeated probe for ISA interwave card
        ALSA: gus: Fix repeated probes of snd_gus_create()
        ALSA: vx222: fix null-ptr-deref
        ASoC: rockchip: i2s: Fix concurrency between tx/rx
        ASoC: mt8195: correct the dts parsing logic about DPTX and HDMITX
        ASoC: Intel: boards: Fix CONFIG_SND_SOC_SDW_MOCKUP select
        ASoC: dt-bindings: fsl_rpmsg: Add compatible string for i.MX8ULP
        ALSA: usb-audio: Add registration quirk for JBL Quantum 800
        ASoC: rt5682: fix headset background noise when S3 state
        ASoC: dt-bindings: mt8195: remove dependent headers in the example
        ASoC: mediatek: SND_SOC_MT8195 should depend on ARCH_MEDIATEK
        ASoC: samsung: s3c24xx_simtec: fix spelling mistake "devicec" -> "device"
        ASoC: audio-graph: respawn Platform Support
        ASoC: mediatek: mt8195: add MTK_PMIC_WRAP dependency
      ae79394a
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml · d6c338a7
      Linus Torvalds authored
      Pull UML updates from Richard Weinberger:
      
       - Support for VMAP_STACK
      
       - Support for splice_write in hostfs
      
       - Fixes for virt-pci
      
       - Fixes for virtio_uml
      
       - Various fixes
      
      * tag 'for-linus-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
        um: fix stub location calculation
        um: virt-pci: fix uapi documentation
        um: enable VMAP_STACK
        um: virt-pci: don't do DMA from stack
        hostfs: support splice_write
        um: virtio_uml: fix memory leak on init failures
        um: virtio_uml: include linux/virtio-uml.h
        lib/logic_iomem: fix sparse warnings
        um: make PCI emulation driver init/exit static
      d6c338a7
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 35776f10
      Linus Torvalds authored
      Pull ARM development updates from Russell King:
      
       - Rename "mod_init" and "mod_exit" so that initcall debug output is
         actually useful (Randy Dunlap)
      
       - Update maintainers entries for linux-arm-kernel to indicate it is
         moderated for non-subscribers (Randy Dunlap)
      
       - Move install rules to arch/arm/Makefile (Masahiro Yamada)
      
       - Drop unnecessary ARCH_NR_GPIOS definition (Linus Walleij)
      
       - Don't warn about atags_to_fdt() stack size (David Heidelberg)
      
       - Speed up unaligned copy_{from,to}_kernel_nofault (Arnd Bergmann)
      
       - Get rid of set_fs() usage (Arnd Bergmann)
      
       - Remove checks for GCC prior to v4.6 (Geert Uytterhoeven)
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 9118/1: div64: Remove always-true __div64_const32_is_OK() duplicate
        ARM: 9117/1: asm-generic: div64: Remove always-true __div64_const32_is_OK()
        ARM: 9116/1: unified: Remove check for gcc < 4
        ARM: 9110/1: oabi-compat: fix oabi epoll sparse warning
        ARM: 9113/1: uaccess: remove set_fs() implementation
        ARM: 9112/1: uaccess: add __{get,put}_kernel_nofault
        ARM: 9111/1: oabi-compat: rework fcntl64() emulation
        ARM: 9114/1: oabi-compat: rework sys_semtimedop emulation
        ARM: 9108/1: oabi-compat: rework epoll_wait/epoll_pwait emulation
        ARM: 9107/1: syscall: always store thread_info->abi_syscall
        ARM: 9109/1: oabi-compat: add epoll_pwait handler
        ARM: 9106/1: traps: use get_kernel_nofault instead of set_fs()
        ARM: 9115/1: mm/maccess: fix unaligned copy_{from,to}_kernel_nofault
        ARM: 9105/1: atags_to_fdt: don't warn about stack size
        ARM: 9103/1: Drop ARCH_NR_GPIOS definition
        ARM: 9102/1: move theinstall rules to arch/arm/Makefile
        ARM: 9100/1: MAINTAINERS: mark all linux-arm-kernel@infradead list as moderated
        ARM: 9099/1: crypto: rename 'mod_init' & 'mod_exit' functions to be module-specific
      35776f10
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 43175623
      Linus Torvalds authored
      Pull more tracing updates from Steven Rostedt:
      
       - Add migrate-disable counter to tracing header
      
       - Fix error handling in event probes
      
       - Fix missed unlock in osnoise in error path
      
       - Fix merge issue with tools/bootconfig
      
       - Clean up bootconfig data when init memory is removed
      
       - Fix bootconfig to loop only on subkeys
      
       - Have kernel command lines override bootconfig options
      
       - Increase field counts for synthetic events
      
       - Have histograms dynamic allocate event elements to save space
      
       - Fixes in testing and documentation
      
      * tag 'trace-v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing/boot: Fix to loop on only subkeys
        selftests/ftrace: Exclude "(fault)" in testing add/remove eprobe events
        tracing: Dynamically allocate the per-elt hist_elt_data array
        tracing: synth events: increase max fields count
        tools/bootconfig: Show whole test command for each test case
        bootconfig: Fix missing return check of xbc_node_compose_key function
        tools/bootconfig: Fix tracing_on option checking in ftrace2bconf.sh
        docs: bootconfig: Add how to use bootconfig for kernel parameters
        init/bootconfig: Reorder init parameter from bootconfig and cmdline
        init: bootconfig: Remove all bootconfig data when the init memory is removed
        tracing/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
        tracing: Fix some alloc_event_probe() error handling bugs
        tracing: Add migrate-disabled counter to tracing output.
      43175623
    • Linus Torvalds's avatar
      Merge tag 's390-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · f154c806
      Linus Torvalds authored
      Pull more s390 updates from Heiko Carstens:
       "Except for the xpram device driver removal it is all about fixes and
        cleanups.
      
         - Fix topology update on cpu hotplug, so notifiers see expected
           masks. This bug was uncovered with SCHED_CORE support.
      
         - Fix stack unwinding so that the correct number of entries are
           omitted like expected by common code. This fixes KCSAN selftests.
      
         - Add kmemleak annotation to stack_alloc to avoid false positive
           kmemleak warnings.
      
         - Avoid layering violation in common I/O code and don't unregister
           subchannel from child-drivers.
      
         - Remove xpram device driver for which no real use case exists since
           the kernel is 64 bit only. Also all hypervisors got required
           support removed in the meantime, which means the xpram device
           driver is dead code.
      
         - Fix -ENODEV handling of clp_get_state in our PCI code.
      
         - Enable KFENCE in debug defconfig.
      
         - Cleanup hugetlbfs s390 specific Kconfig dependency.
      
         - Quite a lot of trivial fixes to get rid of "W=1" warnings, and and
           other simple cleanups"
      
      * tag 's390-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        hugetlbfs: s390 is always 64bit
        s390/ftrace: remove incorrect __va usage
        s390/zcrypt: remove incorrect kernel doc indicators
        scsi: zfcp: fix kernel doc comments
        s390/sclp: add __nonstring annotation
        s390/hmcdrv_ftp: fix kernel doc comment
        s390: remove xpram device driver
        s390/pci: read clp_list_pci_req only once
        s390/pci: fix clp_get_state() handling of -ENODEV
        s390/cio: fix kernel doc comment
        s390/ctrlchar: fix kernel doc comment
        s390/con3270: use proper type for tasklet function
        s390/cpum_cf: move array from header to C file
        s390/mm: fix kernel doc comments
        s390/topology: fix topology information when calling cpu hotplug notifiers
        s390/unwind: use current_frame_address() to unwind current task
        s390/configs: enable CONFIG_KFENCE in debug_defconfig
        s390/entry: make oklabel within CHKSTG macro local
        s390: add kmemleak annotation in stack_alloc()
        s390/cio: dont unregister subchannel from child-drivers
      f154c806
    • Linus Torvalds's avatar
      Merge branch 'work.gfs2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 7b871c77
      Linus Torvalds authored
      Pull gfs2 setattr updates from Al Viro:
       "Make it possible for filesystems to use a generic 'may_setattr()' and
        switch gfs2 to using it"
      
      * 'work.gfs2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        gfs2: Switch to may_setattr in gfs2_setattr
        fs: Move notify_change permission checks into may_setattr
      7b871c77
    • Linus Torvalds's avatar
      Merge branch 'work.init' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · e2e694b9
      Linus Torvalds authored
      Pull root filesystem type handling updates from Al Viro:
       "Teach init/do_mounts.c to handle non-block filesystems, hopefully
        preventing even more special-cased kludges (such as root=/dev/nfs,
        etc)"
      
      * 'work.init' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fs: simplify get_filesystem_list / get_all_fs_names
        init: allow mounting arbitrary non-blockdevice filesystems as root
        init: split get_fs_names
      e2e694b9
    • Linus Torvalds's avatar
      Merge branch 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 7b7699c0
      Linus Torvalds authored
      Pull iov_iter fixes from Al Viro:
       "Fixes for io-uring handling of iov_iter reexpands"
      
      * 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        io_uring: reexpand under-reexpanded iters
        iov_iter: track truncated size
      7b7699c0
    • Linus Torvalds's avatar
      Merge tag 'cxl-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl · 70868a18
      Linus Torvalds authored
      Pull CXL (Compute Express Link) updates from Dan Williams:
      
       - Fix detection of CXL host bridges to filter out disabled ACPI0016
         devices in the ACPI DSDT.
      
       - Fix kernel lockdown integration to disable raw commands when raw PCI
         access is disabled.
      
       - Fix a broken debug message.
      
       - Add support for "Get Partition Info". I.e. enumerate the split
         between volatile and persistent capacity on bi-modal CXL memory
         expanders.
      
       - Re-factor the core by subject area. This is a work in progress.
      
       - Prepare libnvdimm to understand CXL labels in addition to EFI labels.
         This is a work in progress.
      
      * tag 'cxl-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (25 commits)
        cxl/registers: Fix Documentation warning
        cxl/pmem: Fix Documentation warning
        cxl/uapi: Fix defined but not used warnings
        cxl/pci: Fix debug message in cxl_probe_regs()
        cxl/pci: Fix lockdown level
        cxl/acpi: Do not add DSDT disabled ACPI0016 host bridge ports
        libnvdimm/labels: Add claim class helpers
        libnvdimm/labels: Add type-guid helpers
        libnvdimm/labels: Add blk special cases for nlabel and position helpers
        libnvdimm/labels: Add blk isetcookie set / validation helpers
        libnvdimm/labels: Add a checksum calculation helper
        libnvdimm/labels: Introduce label setter helpers
        libnvdimm/labels: Add isetcookie validation helper
        libnvdimm/labels: Introduce getters for namespace label fields
        cxl/mem: Adjust ram/pmem range to represent DPA ranges
        cxl/mem: Account for partitionable space in ram/pmem ranges
        cxl/pci: Store memory capacity values
        cxl/pci: Simplify register setup
        cxl/pci: Ignore unknown register block types
        cxl/core: Move memdev management to core
        ...
      70868a18
    • Linus Torvalds's avatar
      Merge tag 'libnvdimm-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · 2e5fd489
      Linus Torvalds authored
      Pull libnvdimm updates from Dan Williams:
      
       - Fix a race condition in the teardown path of raw mode pmem
         namespaces.
      
       - Cleanup the code that filesystems use to detect filesystem-dax
         capabilities of their underlying block device.
      
      * tag 'libnvdimm-for-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        dax: remove bdev_dax_supported
        xfs: factor out a xfs_buftarg_is_dax helper
        dax: stub out dax_supported for !CONFIG_FS_DAX
        dax: remove __generic_fsdax_supported
        dax: move the dax_read_lock() locking into dax_supported
        dax: mark dax_get_by_host static
        dm: use fs_dax_get_by_bdev instead of dax_get_by_host
        dax: stop using bdevname
        fsdax: improve the FS_DAX Kconfig description and help text
        libnvdimm/pmem: Fix crash triggered when I/O in-flight during unbind
      2e5fd489
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 4b105f4a
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "I don't usually send a second PR in the merge window, but the fix to
        mlx5 is significant enough that it should start going through the
        process ASAP. Along with it comes some of the usual -rc stuff that
        would normally wait for a -rc2 or so.
      
        Summary:
      
        Important error case regression fixes in mlx5:
      
         - Wrong size used when computing the error path smaller allocation
           request leads to corruption
      
         - Confusing but ultimately harmless alignment mis-calculation
      
        Static checker warning fixes:
      
         - NULL pointer subtraction in qib
      
         - kcalloc in bnxt_re
      
         - Missing static on global variable in hfi1"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        IB/hfi1: make hist static
        RDMA/bnxt_re: Prefer kcalloc over open coded arithmetic
        IB/qib: Fix null pointer subtraction compiler warning
        RDMA/mlx5: Fix xlt_chunk_align calculation
        RDMA/mlx5: Fix number of allocated XLT entries
      4b105f4a
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine · 0aa25160
      Linus Torvalds authored
      Pull dmaengine updates from Vinod Koul:
       "New drivers/devices
         - Support for Renesas RZ/G2L dma controller
         - New driver for AMD PTDMA controller
      
        Updates:
         - Big pile of idxd updates
         - Updates for Altera driver, stm32-dma, dw etc"
      
      * tag 'dmaengine-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: (83 commits)
        dmaengine: sh: fix some NULL dereferences
        dmaengine: sh: Fix unused initialization of pointer lmdesc
        MAINTAINERS: Fix AMD PTDMA DRIVER entry
        dmaengine: ptdma: remove PT_OFFSET to avoid redefnition
        dmaengine: ptdma: Add debugfs entries for PTDMA
        dmaengine: ptdma: register PTDMA controller as a DMA resource
        dmaengine: ptdma: Initial driver for the AMD PTDMA
        dmaengine: fsl-dpaa2-qdma: Fix spelling mistake "faile" -> "failed"
        dmaengine: idxd: remove interrupt disable for dev_lock
        dmaengine: idxd: remove interrupt disable for cmd_lock
        dmaengine: idxd: fix setting up priv mode for dwq
        dmaengine: xilinx_dma: Set DMA mask for coherent APIs
        dmaengine: ti: k3-psil-j721e: Add entry for CSI2RX
        dmaengine: sh: Add DMAC driver for RZ/G2L SoC
        dmaengine: Extend the dma_slave_width for 128 bytes
        dt-bindings: dma: Document RZ/G2L bindings
        dmaengine: ioat: depends on !UML
        dmaengine: idxd: set descriptor allocation size to threshold for swq
        dmaengine: idxd: make submit failure path consistent on desc freeing
        dmaengine: idxd: remove interrupt flag for completion list spinlock
        ...
      0aa25160
    • Linus Torvalds's avatar
      Merge branches 'akpm' and 'akpm-hotfixes' (patches from Andrew) · a3fa7a10
      Linus Torvalds authored
      Merge yet more updates and hotfixes from Andrew Morton:
       "Post-linux-next material, based upon latest upstream to catch the
        now-merged dependencies:
      
         - 10 patches.
      
           Subsystems affected by this patch series: mm (vmstat and migration)
           and compat.
      
        And bunch of hotfixes, mostly cc:stable:
      
         - 8 patches.
      
           Subsystems affected by this patch series: mm (hmm, hugetlb, vmscan,
           pagealloc, pagemap, kmemleak, mempolicy, and memblock)"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        arch: remove compat_alloc_user_space
        compat: remove some compat entry points
        mm: simplify compat numa syscalls
        mm: simplify compat_sys_move_pages
        kexec: avoid compat_alloc_user_space
        kexec: move locking into do_kexec_load
        mm: migrate: change to use bool type for 'page_was_mapped'
        mm: migrate: fix the incorrect function name in comments
        mm: migrate: introduce a local variable to get the number of pages
        mm/vmstat: protect per cpu variables with preempt disable on RT
      
      * emailed hotfixes from Andrew Morton <akpm@linux-foundation.org>:
        nds32/setup: remove unused memblock_region variable in setup_memory()
        mm/mempolicy: fix a race between offset_il_node and mpol_rebind_task
        mm/kmemleak: allow __GFP_NOLOCKDEP passed to kmemleak's gfp
        mmap_lock: change trace and locking order
        mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype
        mm,vmscan: fix divide by zero in get_scan_count
        mm/hugetlb: initialize hugetlb_usage in mm_init
        mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
      a3fa7a10
    • Mike Rapoport's avatar
      nds32/setup: remove unused memblock_region variable in setup_memory() · ddb13122
      Mike Rapoport authored
      kernel test robot reports unused variable warning:
      
         arch/nds32/kernel/setup.c:247:26: warning: Unused variable: region
         [unusedVariable]
          struct memblock_region *region;
                                  ^
      
      Remove the unused variable.
      
      Link: https://lkml.kernel.org/r/20210712125218.28951-1-rppt@kernel.orgSigned-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ddb13122
    • yanghui's avatar
      mm/mempolicy: fix a race between offset_il_node and mpol_rebind_task · 276aeee1
      yanghui authored
      Servers happened below panic:
      
        Kernel version:5.4.56
        BUG: unable to handle page fault for address: 0000000000002c48
        RIP: 0010:__next_zones_zonelist+0x1d/0x40
        Call Trace:
          __alloc_pages_nodemask+0x277/0x310
          alloc_page_interleave+0x13/0x70
          handle_mm_fault+0xf99/0x1390
          __do_page_fault+0x288/0x500
          do_page_fault+0x30/0x110
          page_fault+0x3e/0x50
      
      The reason for the panic is that MAX_NUMNODES is passed in the third
      parameter in __alloc_pages_nodemask(preferred_nid).  So access to
      zonelist->zoneref->zone_idx in __next_zones_zonelist will cause a panic.
      
      In offset_il_node(), first_node() returns nid from pol->v.nodes, after
      this other threads may chang pol->v.nodes before next_node().  This race
      condition will let next_node return MAX_NUMNODES.  So put pol->nodes in
      a local variable.
      
      The race condition is between offset_il_node and cpuset_change_task_nodemask:
      
        CPU0:                                     CPU1:
        alloc_pages_vma()
          interleave_nid(pol,)
            offset_il_node(pol,)
              first_node(pol->v.nodes)            cpuset_change_task_nodemask
                              //nodes==0xc          mpol_rebind_task
                                                      mpol_rebind_policy
                                                        mpol_rebind_nodemask(pol,nodes)
                              //nodes==0x3
              next_node(nid, pol->v.nodes)//return MAX_NUMNODES
      
      Link: https://lkml.kernel.org/r/20210906034658.48721-1-yanghui.def@bytedance.comSigned-off-by: default avataryanghui <yanghui.def@bytedance.com>
      Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.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>
      276aeee1
    • Naohiro Aota's avatar
      mm/kmemleak: allow __GFP_NOLOCKDEP passed to kmemleak's gfp · 79d37050
      Naohiro Aota authored
      In a memory pressure situation, I'm seeing the lockdep WARNING below.
      Actually, this is similar to a known false positive which is already
      addressed by commit 6dcde60e ("xfs: more lockdep whackamole with
      kmem_alloc*").
      
      This warning still persists because it's not from kmalloc() itself but
      from an allocation for kmemleak object.  While kmalloc() itself suppress
      the warning with __GFP_NOLOCKDEP, gfp_kmemleak_mask() is dropping the
      flag for the kmemleak's allocation.
      
      Allow __GFP_NOLOCKDEP to be passed to kmemleak's allocation, so that the
      warning for it is also suppressed.
      
        ======================================================
        WARNING: possible circular locking dependency detected
        5.14.0-rc7-BTRFS-ZNS+ #37 Not tainted
        ------------------------------------------------------
        kswapd0/288 is trying to acquire lock:
        ffff88825ab45df0 (&xfs_nondir_ilock_class){++++}-{3:3}, at: xfs_ilock+0x8a/0x250
      
        but task is already holding lock:
        ffffffff848cc1e0 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x5/0x30
      
        which lock already depends on the new lock.
      
        the existing dependency chain (in reverse order) is:
      
        -> #1 (fs_reclaim){+.+.}-{0:0}:
               fs_reclaim_acquire+0x112/0x160
               kmem_cache_alloc+0x48/0x400
               create_object.isra.0+0x42/0xb10
               kmemleak_alloc+0x48/0x80
               __kmalloc+0x228/0x440
               kmem_alloc+0xd3/0x2b0
               kmem_alloc_large+0x5a/0x1c0
               xfs_attr_copy_value+0x112/0x190
               xfs_attr_shortform_getvalue+0x1fc/0x300
               xfs_attr_get_ilocked+0x125/0x170
               xfs_attr_get+0x329/0x450
               xfs_get_acl+0x18d/0x430
               get_acl.part.0+0xb6/0x1e0
               posix_acl_xattr_get+0x13a/0x230
               vfs_getxattr+0x21d/0x270
               getxattr+0x126/0x310
               __x64_sys_fgetxattr+0x1a6/0x2a0
               do_syscall_64+0x3b/0x90
               entry_SYSCALL_64_after_hwframe+0x44/0xae
      
        -> #0 (&xfs_nondir_ilock_class){++++}-{3:3}:
               __lock_acquire+0x2c0f/0x5a00
               lock_acquire+0x1a1/0x4b0
               down_read_nested+0x50/0x90
               xfs_ilock+0x8a/0x250
               xfs_can_free_eofblocks+0x34f/0x570
               xfs_inactive+0x411/0x520
               xfs_fs_destroy_inode+0x2c8/0x710
               destroy_inode+0xc5/0x1a0
               evict+0x444/0x620
               dispose_list+0xfe/0x1c0
               prune_icache_sb+0xdc/0x160
               super_cache_scan+0x31e/0x510
               do_shrink_slab+0x337/0x8e0
               shrink_slab+0x362/0x5c0
               shrink_node+0x7a7/0x1a40
               balance_pgdat+0x64e/0xfe0
               kswapd+0x590/0xa80
               kthread+0x38c/0x460
               ret_from_fork+0x22/0x30
      
        other info that might help us debug this:
         Possible unsafe locking scenario:
               CPU0                    CPU1
               ----                    ----
          lock(fs_reclaim);
                                       lock(&xfs_nondir_ilock_class);
                                       lock(fs_reclaim);
          lock(&xfs_nondir_ilock_class);
      
         *** DEADLOCK ***
        3 locks held by kswapd0/288:
         #0: ffffffff848cc1e0 (fs_reclaim){+.+.}-{0:0}, at: __fs_reclaim_acquire+0x5/0x30
         #1: ffffffff848a08d8 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0x269/0x5c0
         #2: ffff8881a7a820e8 (&type->s_umount_key#60){++++}-{3:3}, at: super_cache_scan+0x5a/0x510
      
      Link: https://lkml.kernel.org/r/20210907055659.3182992-1-naohiro.aota@wdc.comSigned-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: "Darrick J . Wong" <djwong@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      79d37050
    • Liam Howlett's avatar
      mmap_lock: change trace and locking order · 10994316
      Liam Howlett authored
      Print to the trace log before releasing the lock to avoid racing with
      other trace log printers of the same lock type.
      
      Link: https://lkml.kernel.org/r/20210903022041.1843024-1-Liam.Howlett@oracle.comSigned-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
      Suggested-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Michel Lespinasse <walken.cr@gmail.com>
      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>
      10994316
    • Miaohe Lin's avatar
      mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype · 053cfda1
      Miaohe Lin authored
      If it's not prepared to free unref page, the pcp page migratetype is
      unset.  Thus we will get rubbish from get_pcppage_migratetype() and
      might list_del(&page->lru) again after it's already deleted from the list
      leading to grumble about data corruption.
      
      Link: https://lkml.kernel.org/r/20210902115447.57050-1-linmiaohe@huawei.com
      Fixes: df1acc85 ("mm/page_alloc: avoid conflating IRQs disabled with zone->lock")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.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>
      053cfda1
    • Rik van Riel's avatar
      mm,vmscan: fix divide by zero in get_scan_count · 32d4f4b7
      Rik van Riel authored
      Commit f56ce412 ("mm: memcontrol: fix occasional OOMs due to
      proportional memory.low reclaim") introduced a divide by zero corner
      case when oomd is being used in combination with cgroup memory.low
      protection.
      
      When oomd decides to kill a cgroup, it will force the cgroup memory to
      be reclaimed after killing the tasks, by writing to the memory.max file
      for that cgroup, forcing the remaining page cache and reclaimable slab
      to be reclaimed down to zero.
      
      Previously, on cgroups with some memory.low protection that would result
      in the memory being reclaimed down to the memory.low limit, or likely
      not at all, having the page cache reclaimed asynchronously later.
      
      With f56ce412 the oomd write to memory.max tries to reclaim all the
      way down to zero, which may race with another reclaimer, to the point of
      ending up with the divide by zero below.
      
      This patch implements the obvious fix.
      
      Link: https://lkml.kernel.org/r/20210826220149.058089c6@imladris.surriel.com
      Fixes: f56ce412 ("mm: memcontrol: fix occasional OOMs due to proportional memory.low reclaim")
      Signed-off-by: default avatarRik van Riel <riel@surriel.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarChris Down <chris@chrisdown.name>
      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>
      32d4f4b7
    • Liu Zixian's avatar
      mm/hugetlb: initialize hugetlb_usage in mm_init · 13db8c50
      Liu Zixian authored
      After fork, the child process will get incorrect (2x) hugetlb_usage.  If
      a process uses 5 2MB hugetlb pages in an anonymous mapping,
      
      	HugetlbPages:	   10240 kB
      
      and then forks, the child will show,
      
      	HugetlbPages:	   20480 kB
      
      The reason for double the amount is because hugetlb_usage will be copied
      from the parent and then increased when we copy page tables from parent
      to child.  Child will have 2x actual usage.
      
      Fix this by adding hugetlb_count_init in mm_init.
      
      Link: https://lkml.kernel.org/r/20210826071742.877-1-liuzixian4@huawei.com
      Fixes: 5d317b2b ("mm: hugetlb: proc: add HugetlbPages field to /proc/PID/status")
      Signed-off-by: default avatarLiu Zixian <liuzixian4@huawei.com>
      Reviewed-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.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>
      13db8c50