1. 09 Sep, 2022 3 commits
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v6.0-2022-09-08' of... · d8a450a8
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v6.0-2022-09-08' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix per-thread mmaps for multi-threaded targets, noticed with
         'perf top --pid' with multithreaded targets
      
       - Fix synthesis failure warnings in 'perf record'
      
       - Fix L2 Topdown metrics disappearance for raw events in 'perf stat'
      
       - Fix out of bound access in some CPU masks
      
       - Fix segfault if there is no CPU PMU table and a metric is sought,
         noticed when building with NO_JEVENTS=1
      
       - Skip dummy event attr check in 'perf script' fixing nonsensical
         warning about UREGS attribute not set, as 'dummy' events have no
         samples
      
       - Fix 'iregs' field handling with dummy events on hybrid systems in
         'perf script'
      
       - Prevent potential memory leak in c2c_he_zalloc() in 'perf c2c'
      
       - Don't install data files with x permissions
      
       - Fix types for print format in dlfilter-show-cycles
      
       - Switch deprecated openssl MD5_* functions to new EVP API in 'genelf'
      
       - Remove redundant word 'contention' in 'perf lock' help message
      
      * tag 'perf-tools-fixes-for-v6.0-2022-09-08' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf record: Fix synthesis failure warnings
        perf tools: Don't install data files with x permissions
        perf script: Fix Cannot print 'iregs' field for hybrid systems
        perf lock: Remove redundant word 'contention' in help message
        perf dlfilter dlfilter-show-cycles: Fix types for print format
        libperf evlist: Fix per-thread mmaps for multi-threaded targets
        perf c2c: Prevent potential memory leak in c2c_he_zalloc()
        perf genelf: Switch deprecated openssl MD5_* functions to new EVP API
        tools/perf: Fix out of bound access to cpu mask array
        perf affinity: Fix out of bound access to "sched_cpus" mask
        perf stat: Fix L2 Topdown metrics disappear for raw events
        perf script: Skip dummy event attr check
        perf metric: Return early if no CPU PMU table exists
      d8a450a8
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 460a75a6
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Do not stop trace events in modules if TAINT_TEST is set
      
       - Do not clobber mount options when tracefs is mounted a second time
      
       - Prevent crash of kprobes in gate area
      
       - Add static annotation to some non global functions
      
       - Add some entries into the MAINTAINERS file
      
       - Fix check of event_mutex held when accessing trigger list
      
       - Add some __init/__exit annotations
      
       - Fix reporting of what called hardirq_{enable,disable}_ip function
      
      * tag 'trace-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracefs: Only clobber mode/uid/gid on remount if asked
        kprobes: Prohibit probes in gate area
        rv/reactor: add __init/__exit annotations to module init/exit funcs
        tracing: Fix to check event_mutex is held while accessing trigger list
        tracing: hold caller_addr to hardirq_{enable,disable}_ip
        tracepoint: Allow trace events in modules with TAINT_TEST
        MAINTAINERS: add scripts/tracing/ to TRACING
        MAINTAINERS: Add Runtime Verification (RV) entry
        rv/monitors: Make monitor's automata definition static
      460a75a6
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-fixes-6.0-rc4' of... · f448dda8
      Linus Torvalds authored
      Merge tag 'asm-generic-fixes-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
      
      Pull SOFTIRQ_ON_OWN_STACK rework from Arnd Bergmann:
       "Just one fixup patch, reworking the softirq_on_own_stack logic for
        preempt-rt kernels as discussed in
      
          https://lore.kernel.org/all/CAHk-=wgZSD3W2y6yczad2Am=EfHYyiPzTn3CfXxrriJf9i5W5w@mail.gmail.com/"
      
      * tag 'asm-generic-fixes-6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig.
      f448dda8
  2. 08 Sep, 2022 16 commits
    • Brian Norris's avatar
      tracefs: Only clobber mode/uid/gid on remount if asked · 47311db8
      Brian Norris authored
      Users may have explicitly configured their tracefs permissions; we
      shouldn't overwrite those just because a second mount appeared.
      
      Only clobber if the options were provided at mount time.
      
      Note: the previous behavior was especially surprising in the presence of
      automounted /sys/kernel/debug/tracing/.
      
      Existing behavior:
      
        ## Pre-existing status: tracefs is 0755.
        # stat -c '%A' /sys/kernel/tracing/
        drwxr-xr-x
      
        ## (Re)trigger the automount.
        # umount /sys/kernel/debug/tracing
        # stat -c '%A' /sys/kernel/debug/tracing/.
        drwx------
      
        ## Unexpected: the automount changed mode for other mount instances.
        # stat -c '%A' /sys/kernel/tracing/
        drwx------
      
      New behavior (after this change):
      
        ## Pre-existing status: tracefs is 0755.
        # stat -c '%A' /sys/kernel/tracing/
        drwxr-xr-x
      
        ## (Re)trigger the automount.
        # umount /sys/kernel/debug/tracing
        # stat -c '%A' /sys/kernel/debug/tracing/.
        drwxr-xr-x
      
        ## Expected: the automount does not change other mount instances.
        # stat -c '%A' /sys/kernel/tracing/
        drwxr-xr-x
      
      Link: https://lkml.kernel.org/r/20220826174353.2.Iab6e5ea57963d6deca5311b27fb7226790d44406@changeid
      
      Cc: stable@vger.kernel.org
      Fixes: 4282d606 ("tracefs: Add new tracefs file system")
      Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      47311db8
    • Christian A. Ehrhardt's avatar
      kprobes: Prohibit probes in gate area · 1efda38d
      Christian A. Ehrhardt authored
      The system call gate area counts as kernel text but trying
      to install a kprobe in this area fails with an Oops later on.
      To fix this explicitly disallow the gate area for kprobes.
      
      Found by syzkaller with the following reproducer:
      perf_event_open$cgroup(&(0x7f00000001c0)={0x6, 0x80, 0x0, 0x0, 0x0, 0x0, 0x80ffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @perf_config_ext={0x0, 0xffffffffff600000}}, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0x0)
      
      Sample report:
      BUG: unable to handle page fault for address: fffffbfff3ac6000
      PGD 6dfcb067 P4D 6dfcb067 PUD 6df8f067 PMD 6de4d067 PTE 0
      Oops: 0000 [#1] PREEMPT SMP KASAN NOPTI
      CPU: 0 PID: 21978 Comm: syz-executor.2 Not tainted 6.0.0-rc3-00363-g7726d4c3-dirty #6
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      RIP: 0010:__insn_get_emulate_prefix arch/x86/lib/insn.c:91 [inline]
      RIP: 0010:insn_get_emulate_prefix arch/x86/lib/insn.c:106 [inline]
      RIP: 0010:insn_get_prefixes.part.0+0xa8/0x1110 arch/x86/lib/insn.c:134
      Code: 49 be 00 00 00 00 00 fc ff df 48 8b 40 60 48 89 44 24 08 e9 81 00 00 00 e8 e5 4b 39 ff 4c 89 fa 4c 89 f9 48 c1 ea 03 83 e1 07 <42> 0f b6 14 32 38 ca 7f 08 84 d2 0f 85 06 10 00 00 48 89 d8 48 89
      RSP: 0018:ffffc900088bf860 EFLAGS: 00010246
      RAX: 0000000000040000 RBX: ffffffff9b9bebc0 RCX: 0000000000000000
      RDX: 1ffffffff3ac6000 RSI: ffffc90002d82000 RDI: ffffc900088bf9e8
      RBP: ffffffff9d630001 R08: 0000000000000000 R09: ffffc900088bf9e8
      R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
      R13: ffffffff9d630000 R14: dffffc0000000000 R15: ffffffff9d630000
      FS:  00007f63eef63640(0000) GS:ffff88806d000000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: fffffbfff3ac6000 CR3: 0000000029d90005 CR4: 0000000000770ef0
      PKRU: 55555554
      Call Trace:
       <TASK>
       insn_get_prefixes arch/x86/lib/insn.c:131 [inline]
       insn_get_opcode arch/x86/lib/insn.c:272 [inline]
       insn_get_modrm+0x64a/0x7b0 arch/x86/lib/insn.c:343
       insn_get_sib+0x29a/0x330 arch/x86/lib/insn.c:421
       insn_get_displacement+0x350/0x6b0 arch/x86/lib/insn.c:464
       insn_get_immediate arch/x86/lib/insn.c:632 [inline]
       insn_get_length arch/x86/lib/insn.c:707 [inline]
       insn_decode+0x43a/0x490 arch/x86/lib/insn.c:747
       can_probe+0xfc/0x1d0 arch/x86/kernel/kprobes/core.c:282
       arch_prepare_kprobe+0x79/0x1c0 arch/x86/kernel/kprobes/core.c:739
       prepare_kprobe kernel/kprobes.c:1160 [inline]
       register_kprobe kernel/kprobes.c:1641 [inline]
       register_kprobe+0xb6e/0x1690 kernel/kprobes.c:1603
       __register_trace_kprobe kernel/trace/trace_kprobe.c:509 [inline]
       __register_trace_kprobe+0x26a/0x2d0 kernel/trace/trace_kprobe.c:477
       create_local_trace_kprobe+0x1f7/0x350 kernel/trace/trace_kprobe.c:1833
       perf_kprobe_init+0x18c/0x280 kernel/trace/trace_event_perf.c:271
       perf_kprobe_event_init+0xf8/0x1c0 kernel/events/core.c:9888
       perf_try_init_event+0x12d/0x570 kernel/events/core.c:11261
       perf_init_event kernel/events/core.c:11325 [inline]
       perf_event_alloc.part.0+0xf7f/0x36a0 kernel/events/core.c:11619
       perf_event_alloc kernel/events/core.c:12059 [inline]
       __do_sys_perf_event_open+0x4a8/0x2a00 kernel/events/core.c:12157
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f63ef7efaed
      Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f63eef63028 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
      RAX: ffffffffffffffda RBX: 00007f63ef90ff80 RCX: 00007f63ef7efaed
      RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 00000000200001c0
      RBP: 00007f63ef86019c R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000
      R13: 0000000000000002 R14: 00007f63ef90ff80 R15: 00007f63eef43000
       </TASK>
      Modules linked in:
      CR2: fffffbfff3ac6000
      ---[ end trace 0000000000000000 ]---
      RIP: 0010:__insn_get_emulate_prefix arch/x86/lib/insn.c:91 [inline]
      RIP: 0010:insn_get_emulate_prefix arch/x86/lib/insn.c:106 [inline]
      RIP: 0010:insn_get_prefixes.part.0+0xa8/0x1110 arch/x86/lib/insn.c:134
      Code: 49 be 00 00 00 00 00 fc ff df 48 8b 40 60 48 89 44 24 08 e9 81 00 00 00 e8 e5 4b 39 ff 4c 89 fa 4c 89 f9 48 c1 ea 03 83 e1 07 <42> 0f b6 14 32 38 ca 7f 08 84 d2 0f 85 06 10 00 00 48 89 d8 48 89
      RSP: 0018:ffffc900088bf860 EFLAGS: 00010246
      RAX: 0000000000040000 RBX: ffffffff9b9bebc0 RCX: 0000000000000000
      RDX: 1ffffffff3ac6000 RSI: ffffc90002d82000 RDI: ffffc900088bf9e8
      RBP: ffffffff9d630001 R08: 0000000000000000 R09: ffffc900088bf9e8
      R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
      R13: ffffffff9d630000 R14: dffffc0000000000 R15: ffffffff9d630000
      FS:  00007f63eef63640(0000) GS:ffff88806d000000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: fffffbfff3ac6000 CR3: 0000000029d90005 CR4: 0000000000770ef0
      PKRU: 55555554
      ==================================================================
      
      Link: https://lkml.kernel.org/r/20220907200917.654103-1-lk@c--e.de
      
      cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
      cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      cc: "David S. Miller" <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarChristian A. Ehrhardt <lk@c--e.de>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      1efda38d
    • Adrian Hunter's avatar
      perf record: Fix synthesis failure warnings · faf59ec8
      Adrian Hunter authored
      Some calls to synthesis functions set err < 0 but only warn about the
      failure and continue.  However they do not set err back to zero, relying
      on subsequent code to do that.
      
      That changed with the introduction of option --synth. When --synth=no
      subsequent functions that set err back to zero are not called.
      
      Fix by setting err = 0 in those cases.
      
      Example:
      
       Before:
      
         $ perf record --no-bpf-event --synth=all -o /tmp/huh uname
         Couldn't synthesize bpf events.
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.014 MB /tmp/huh (7 samples) ]
         $ perf record --no-bpf-event --synth=no -o /tmp/huh uname
         Couldn't synthesize bpf events.
      
       After:
      
         $ perf record --no-bpf-event --synth=no -o /tmp/huh uname
         Couldn't synthesize bpf events.
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.014 MB /tmp/huh (7 samples) ]
      
      Fixes: 41b740b6 ("perf record: Add --synth option")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220907162458.72817-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      faf59ec8
    • Jiri Slaby's avatar
      perf tools: Don't install data files with x permissions · 0a9eaf61
      Jiri Slaby authored
      install(1), by default, installs with rwxr-xr-x permissions. Modify
      perf's Makefile to pass '-m 644' when installing:
      
        * Documentation/tips.txt
        * examples/bpf/*
        * perf-completion.sh
        * perf_dlfilter.h header
        * scripts/perl/Perf-Trace-Util/lib/Perf/Trace/*
        * scripts/perl/*.pl
        * tests/attr/*
        * tests/attr.py
        * tests/shell/lib/*.sh
        * trace/strace/groups/*
      
      All those are supposed to be non-executable. Either they are not scripts
      at all, or they don't have shebang.
      
      Signed-off-by: <jslaby@suse.cz>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220908060426.9619-1-jslaby@suse.czSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a9eaf61
    • Zhengjun Xing's avatar
      perf script: Fix Cannot print 'iregs' field for hybrid systems · 82b2425f
      Zhengjun Xing authored
      Commit b91e5492 ("perf record: Add a dummy event on hybrid
      systems to collect metadata records") adds a dummy event on hybrid
      systems to fix the symbol "unknown" issue when the workload is created
      in a P-core but runs on an E-core. The added dummy event will cause
      "perf script -F iregs" to fail. Dummy events do not have "iregs"
      attribute set, so when we do evsel__check_attr, the "iregs" attribute
      check will fail, so the issue happened.
      
      The following commit [1] has fixed a similar issue by skipping the attr
      check for the dummy event because it does not have any samples anyway. It
      works okay for the normal mode, but the issue still happened when running
      the test in the pipe mode. In the pipe mode, it calls process_attr() which
      still checks the attr for the dummy event. This commit fixed the issue by
      skipping the attr check for the dummy event in the API evsel__check_attr,
      Otherwise, we have to patch everywhere when evsel__check_attr() is called.
      
      Before:
      
        #./perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf script -F iregs |head -5
        Samples for 'dummy:HG' event do not have IREGS attribute set. Cannot print 'iregs' field.
        0x120 [0x90]: failed to process type: 64
        #
      
      After:
      
        # ./perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf script -F iregs |head -5
        ABI:2    CX:0x55b8efa87000    DX:0x55b8efa7e000    DI:0xffffba5e625efbb0    R8:0xffff90e51f8ae100
        ABI:2    CX:0x7f1dae1e4000    DX:0xd0    DI:0xffff90e18c675ac0    R8:0x71
        ABI:2    CX:0xcc0    DX:0x1    DI:0xffff90e199880240    R8:0x0
        ABI:2    CX:0xffff90e180dd7500    DX:0xffff90e180dd7500    DI:0xffff90e180043500    R8:0x1
        ABI:2    CX:0x50    DX:0xffff90e18c583bd0    DI:0xffff90e1998803c0    R8:0x58
        #
      
      [1]https://lore.kernel.org/lkml/20220831124041.219925-1-jolsa@kernel.org/
      
      Fixes: b91e5492 ("perf record: Add a dummy event on hybrid systems to collect metadata records")
      Suggested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarXing Zhengjun <zhengjun.xing@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220908070030.3455164-1-zhengjun.xing@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      82b2425f
    • Yang Jihong's avatar
      perf lock: Remove redundant word 'contention' in help message · 3705a6ef
      Yang Jihong authored
      Before:
        # perf lock -h
      
         Usage: perf lock [<options>] {record|report|script|info|contention|contention}
      
            -D, --dump-raw-trace  dump raw trace in ASCII
            -f, --force           don't complain, do it
            -i, --input <file>    input file name
            -v, --verbose         be more verbose (show symbol address, etc)
                --kallsyms <file>
                                  kallsyms pathname
                --vmlinux <file>  vmlinux pathname
      
      After:
        # perf lock -h
      
         Usage: perf lock [<options>] {record|report|script|info|contention}
      
            -D, --dump-raw-trace  dump raw trace in ASCII
            -f, --force           don't complain, do it
            -i, --input <file>    input file name
            -v, --verbose         be more verbose (show symbol address, etc)
                --kallsyms <file>
                                  kallsyms pathname
                --vmlinux <file>  vmlinux pathname
      
      Fixes: 528b9cab ("perf lock: Add 'contention' subcommand")
      Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220908014854.151203-1-yangjihong1@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3705a6ef
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 50635787
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "Several fixes that came in since the merge window, the major one being
        a fix for the spi-mux driver which was broken by the performance
        optimisations due to it peering inside the core's data structures more
        than it should"
      
      * tag 'spi-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi: Fix queue hang if previous transfer failed
        spi: mux: Fix mux interaction with fast path optimisations
        spi: cadence-quadspi: Disable irqs during indirect reads
        spi: bitbang: Fix lsb-first Rx
      50635787
    • Linus Torvalds's avatar
      Merge tag 'regulator-fix-v6.0-rc4' of... · c5e68c4f
      Linus Torvalds authored
      Merge tag 'regulator-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
      
      Pull regulator fixes from Mark Brown:
       "One core fix here improving the error handling on enable failure, plus
        smaller fixes for the pfuze100 drive and the SPMI DT bindings"
      
      * tag 'regulator-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: Fix qcom,spmi-regulator schema
        regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe()
        regulator: core: Clean up on enable failure
      c5e68c4f
    • Linus Torvalds's avatar
      Merge tag 'regmap-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap · b1d27aa3
      Linus Torvalds authored
      Pull regmap fix from Mark Brown:
       "A fix for how we handle controller constraints on SPI message sizes,
        only impacting systems with SPI controllers with very low limits like
        the AMD controller used in the Steam Deck"
      
      * tag 'regmap-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
        regmap: spi: Reserve space for register address/padding
      b1d27aa3
    • Adrian Hunter's avatar
      perf dlfilter dlfilter-show-cycles: Fix types for print format · 1706623e
      Adrian Hunter authored
      Avoid compiler warning about format %llu that expects long long unsigned
      int but argument has type __u64.
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Fixes: c3afd6e5 ("perf dlfilter: Add dlfilter-show-cycles")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220905074735.4513-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1706623e
    • Adrian Hunter's avatar
      libperf evlist: Fix per-thread mmaps for multi-threaded targets · 7864d8f7
      Adrian Hunter authored
      The offending commit removed mmap_per_thread(), which did not consider
      the different set-output rules for per-thread mmaps i.e. in the per-thread
      case set-output is used for file descriptors of the same thread not the
      same cpu.
      
      This was not immediately noticed because it only happens with
      multi-threaded targets and we do not have a test for that yet.
      
      Reinstate mmap_per_thread() expanding it to cover also system-wide per-cpu
      events i.e. to continue to allow the mixing of per-thread and per-cpu
      mmaps.
      
      Debug messages (with -vv) show the file descriptors that are opened with
      sys_perf_event_open. New debug messages are added (needs -vvv) that show
      also which file descriptors are mmapped and which are redirected with
      set-output.
      
      In the per-cpu case (cpu != -1) file descriptors for the same CPU are
      set-output to the first file descriptor for that CPU.
      
      In the per-thread case (cpu == -1) file descriptors for the same thread are
      set-output to the first file descriptor for that thread.
      
      Example (process 17489 has 2 threads):
      
       Before (but with new debug prints):
      
         $ perf record --no-bpf-event -vvv --per-thread -p 17489
         <SNIP>
         sys_perf_event_open: pid 17489  cpu -1  group_fd -1  flags 0x8 = 5
         sys_perf_event_open: pid 17490  cpu -1  group_fd -1  flags 0x8 = 6
         <SNIP>
         libperf: idx 0: mmapping fd 5
         libperf: idx 0: set output fd 6 -> 5
         failed to mmap with 22 (Invalid argument)
      
       After:
      
         $ perf record --no-bpf-event -vvv --per-thread -p 17489
         <SNIP>
         sys_perf_event_open: pid 17489  cpu -1  group_fd -1  flags 0x8 = 5
         sys_perf_event_open: pid 17490  cpu -1  group_fd -1  flags 0x8 = 6
         <SNIP>
         libperf: mmap_per_thread: nr cpu values (may include -1) 1 nr threads 2
         libperf: idx 0: mmapping fd 5
         libperf: idx 1: mmapping fd 6
         <SNIP>
         [ perf record: Woken up 2 times to write data ]
         [ perf record: Captured and wrote 0.018 MB perf.data (15 samples) ]
      
      Per-cpu example (process 20341 has 2 threads, same as above):
      
         $ perf record --no-bpf-event -vvv -p 20341
         <SNIP>
         sys_perf_event_open: pid 20341  cpu 0  group_fd -1  flags 0x8 = 5
         sys_perf_event_open: pid 20342  cpu 0  group_fd -1  flags 0x8 = 6
         sys_perf_event_open: pid 20341  cpu 1  group_fd -1  flags 0x8 = 7
         sys_perf_event_open: pid 20342  cpu 1  group_fd -1  flags 0x8 = 8
         sys_perf_event_open: pid 20341  cpu 2  group_fd -1  flags 0x8 = 9
         sys_perf_event_open: pid 20342  cpu 2  group_fd -1  flags 0x8 = 10
         sys_perf_event_open: pid 20341  cpu 3  group_fd -1  flags 0x8 = 11
         sys_perf_event_open: pid 20342  cpu 3  group_fd -1  flags 0x8 = 12
         sys_perf_event_open: pid 20341  cpu 4  group_fd -1  flags 0x8 = 13
         sys_perf_event_open: pid 20342  cpu 4  group_fd -1  flags 0x8 = 14
         sys_perf_event_open: pid 20341  cpu 5  group_fd -1  flags 0x8 = 15
         sys_perf_event_open: pid 20342  cpu 5  group_fd -1  flags 0x8 = 16
         sys_perf_event_open: pid 20341  cpu 6  group_fd -1  flags 0x8 = 17
         sys_perf_event_open: pid 20342  cpu 6  group_fd -1  flags 0x8 = 18
         sys_perf_event_open: pid 20341  cpu 7  group_fd -1  flags 0x8 = 19
         sys_perf_event_open: pid 20342  cpu 7  group_fd -1  flags 0x8 = 20
         <SNIP>
         libperf: mmap_per_cpu: nr cpu values 8 nr threads 2
         libperf: idx 0: mmapping fd 5
         libperf: idx 0: set output fd 6 -> 5
         libperf: idx 1: mmapping fd 7
         libperf: idx 1: set output fd 8 -> 7
         libperf: idx 2: mmapping fd 9
         libperf: idx 2: set output fd 10 -> 9
         libperf: idx 3: mmapping fd 11
         libperf: idx 3: set output fd 12 -> 11
         libperf: idx 4: mmapping fd 13
         libperf: idx 4: set output fd 14 -> 13
         libperf: idx 5: mmapping fd 15
         libperf: idx 5: set output fd 16 -> 15
         libperf: idx 6: mmapping fd 17
         libperf: idx 6: set output fd 18 -> 17
         libperf: idx 7: mmapping fd 19
         libperf: idx 7: set output fd 20 -> 19
         <SNIP>
         [ perf record: Woken up 7 times to write data ]
         [ perf record: Captured and wrote 0.020 MB perf.data (17 samples) ]
      
      Fixes: ae4f8ae1 ("libperf evlist: Allow mixing per-thread and per-cpu mmaps")
      Reported-by: default avatarTomáš Trnka <trnka@scm.com>
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216441Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220905114209.8389-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7864d8f7
    • Linus Torvalds's avatar
      Merge tag 'net-6.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 26b12249
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from rxrpc, netfilter, wireless and bluetooth
        subtrees.
      
        Current release - regressions:
      
         - skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
      
         - bluetooth: fix regression preventing ACL packet transmission
      
        Current release - new code bugs:
      
         - dsa: microchip: fix kernel oops on ksz8 switches
      
         - dsa: qca8k: fix NULL pointer dereference for
           of_device_get_match_data
      
        Previous releases - regressions:
      
         - netfilter: clean up hook list when offload flags check fails
      
         - wifi: mt76: fix crash in chip reset fail
      
         - rxrpc: fix ICMP/ICMP6 error handling
      
         - ice: fix DMA mappings leak
      
         - i40e: fix kernel crash during module removal
      
        Previous releases - always broken:
      
         - ipv6: sr: fix out-of-bounds read when setting HMAC data.
      
         - tcp: TX zerocopy should not sense pfmemalloc status
      
         - sch_sfb: don't assume the skb is still around after
           enqueueing to child
      
         - netfilter: drop dst references before setting
      
         - wifi: wilc1000: fix DMA on stack objects
      
         - rxrpc: fix an insufficiently large sglist in
           rxkad_verify_packet_2()
      
         - fec: use a spinlock to guard `fep->ptp_clk_on`
      
        Misc:
      
         - usb: qmi_wwan: add Quectel RM520N"
      
      * tag 'net-6.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (50 commits)
        sch_sfb: Also store skb len before calling child enqueue
        net: phy: lan87xx: change interrupt src of link_up to comm_ready
        net/smc: Fix possible access to freed memory in link clear
        net: ethernet: mtk_eth_soc: check max allowed hash in mtk_ppe_check_skb
        net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM
        net: ethernet: mtk_eth_soc: fix typo in __mtk_foe_entry_clear
        net: dsa: felix: access QSYS_TAG_CONFIG under tas_lock in vsc9959_sched_speed_set
        net: dsa: felix: disable cut-through forwarding for frames oversized for tc-taprio
        net: dsa: felix: tc-taprio intervals smaller than MTU should send at least one packet
        net: usb: qmi_wwan: add Quectel RM520N
        net: dsa: qca8k: fix NULL pointer dereference for of_device_get_match_data
        tcp: fix early ETIMEDOUT after spurious non-SACK RTO
        stmmac: intel: Simplify intel_eth_pci_remove()
        net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()
        ipv6: sr: fix out-of-bounds read when setting HMAC data.
        bonding: accept unsolicited NA message
        bonding: add all node mcast address when slave up
        bonding: use unspecified address if no available link local address
        wifi: use struct_group to copy addresses
        wifi: mac80211_hwsim: check length for virtio packets
        ...
      26b12249
    • Linus Torvalds's avatar
      fs: only do a memory barrier for the first set_buffer_uptodate() · 2f79cdfe
      Linus Torvalds authored
      Commit d4252071 ("add barriers to buffer_uptodate and
      set_buffer_uptodate") added proper memory barriers to the buffer head
      BH_Uptodate bit, so that anybody who tests a buffer for being up-to-date
      will be guaranteed to actually see initialized state.
      
      However, that commit didn't _just_ add the memory barrier, it also ended
      up dropping the "was it already set" logic that the BUFFER_FNS() macro
      had.
      
      That's conceptually the right thing for a generic "this is a memory
      barrier" operation, but in the case of the buffer contents, we really
      only care about the memory barrier for the _first_ time we set the bit,
      in that the only memory ordering protection we need is to avoid anybody
      seeing uninitialized memory contents.
      
      Any other access ordering wouldn't be about the BH_Uptodate bit anyway,
      and would require some other proper lock (typically BH_Lock or the folio
      lock).  A reader that races with somebody invalidating the buffer head
      isn't an issue wrt the memory ordering, it's a serialization issue.
      
      Now, you'd think that the buffer head operations don't matter in this
      day and age (and I certainly thought so), but apparently some loads
      still end up being heavy users of buffer heads.  In particular, the
      kernel test robot reported that not having this bit access optimization
      in place caused a noticeable direct IO performance regression on ext4:
      
        fxmark.ssd_ext4_no_jnl_DWTL_54_directio.works/sec -26.5% regression
      
      although you presumably need a fast disk and a lot of cores to actually
      notice.
      
      Link: https://lore.kernel.org/all/Yw8L7HTZ%2FdE2%2Fo9C@xsang-OptiPlex-9020/Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Tested-by: default avatarFengwei Yin <fengwei.yin@intel.com>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2f79cdfe
    • Linus Torvalds's avatar
      Merge tag 'efi-urgent-for-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi · f280b987
      Linus Torvalds authored
      Pull EFI fixes from Ard Biesheuvel:
       "A couple of low-priority EFI fixes:
      
         - prevent the randstruct plugin from re-ordering EFI protocol
           definitions
      
         - fix a use-after-free in the capsule loader
      
         - drop unused variable"
      
      * tag 'efi-urgent-for-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
        efi: capsule-loader: Fix use-after-free in efi_capsule_write
        efi/x86: libstub: remove unused variable
        efi: libstub: Disable struct randomization
      f280b987
    • Toke Høiland-Jørgensen's avatar
      sch_sfb: Also store skb len before calling child enqueue · 2f09707d
      Toke Høiland-Jørgensen authored
      Cong Wang noticed that the previous fix for sch_sfb accessing the queued
      skb after enqueueing it to a child qdisc was incomplete: the SFB enqueue
      function was also calling qdisc_qstats_backlog_inc() after enqueue, which
      reads the pkt len from the skb cb field. Fix this by also storing the skb
      len, and using the stored value to increment the backlog after enqueueing.
      
      Fixes: 9efd2329 ("sch_sfb: Don't assume the skb is still around after enqueueing to child")
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@toke.dk>
      Acked-by: default avatarCong Wang <cong.wang@bytedance.com>
      Link: https://lore.kernel.org/r/20220905192137.965549-1-toke@toke.dkSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      2f09707d
    • Arun Ramadoss's avatar
      net: phy: lan87xx: change interrupt src of link_up to comm_ready · 5382033a
      Arun Ramadoss authored
      Currently phy link up/down interrupt is enabled using the
      LAN87xx_INTERRUPT_MASK register. In the lan87xx_read_status function,
      phy link is determined using the T1_MODE_STAT_REG register comm_ready bit.
      comm_ready bit is set using the loc_rcvr_status & rem_rcvr_status.
      Whenever the phy link is up, LAN87xx_INTERRUPT_SOURCE link_up bit is set
      first but comm_ready bit takes some time to set based on local and
      remote receiver status.
      As per the current implementation, interrupt is triggered using link_up
      but the comm_ready bit is still cleared in the read_status function. So,
      link is always down.  Initially tested with the shared interrupt
      mechanism with switch and internal phy which is working, but after
      implementing interrupt controller it is not working.
      It can fixed either by updating the read_status function to read from
      LAN87XX_INTERRUPT_SOURCE register or enable the interrupt mask for
      comm_ready bit. But the validation team recommends the use of comm_ready
      for link detection.
      This patch fixes by enabling the comm_ready bit for link_up in the
      LAN87XX_INTERRUPT_MASK_2 register (MISC Bank) and link_down in
      LAN87xx_INTERRUPT_MASK register.
      
      Fixes: 8a1b415d ("net: phy: added ethtool master-slave configuration support")
      Signed-off-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20220905152750.5079-1-arun.ramadoss@microchip.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      5382033a
  3. 07 Sep, 2022 19 commits
  4. 06 Sep, 2022 2 commits