1. 19 Aug, 2022 13 commits
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/kvm.h with the kernel sources · bf465ca8
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        8a061562 ("RISC-V: KVM: Add extensible CSR emulation framework")
        f5ecfee9 ("KVM: s390: resetting the Topology-Change-Report")
        450a5639 ("KVM: stats: Fix value for KVM_STATS_UNIT_MAX for boolean stats")
        1b870fa5 ("kvm: stats: tell userspace which values are boolean")
        db1c875e ("KVM: s390: add KVM_S390_ZPCI_OP to manage guest zPCI devices")
        94dfc73e ("treewide: uapi: Replace zero-length arrays with flexible-array members")
        084cc29f ("KVM: x86/MMU: Allow NX huge pages to be disabled on a per-vm basis")
        2f4073e0 ("KVM: VMX: Enable Notify VM exit")
        ed235117 ("KVM: x86: Extend KVM_{G,S}ET_VCPU_EVENTS to support pending triple fault")
        e9bf3acb ("KVM: s390: Add KVM_CAP_S390_PROTECTED_DUMP")
        8aba0958 ("KVM: s390: Add CPU dump functionality")
        0460eb35 ("KVM: s390: Add configuration dump functionality")
        fe9a93e0 ("KVM: s390: pv: Add query dump information")
        35d02493 ("KVM: s390: pv: Add query interface")
        c24a950e ("KVM, SEV: Add KVM_EXIT_SHUTDOWN metadata for SEV-ES")
        ffbb61d0 ("KVM: x86: Accept KVM_[GS]ET_TSC_KHZ as a VM ioctl.")
        661a20fa ("KVM: x86/xen: Advertise and document KVM_XEN_HVM_CONFIG_EVTCHN_SEND")
        fde0451b ("KVM: x86/xen: Support per-vCPU event channel upcall via local APIC")
        28d1629f ("KVM: x86/xen: Kernel acceleration for XENVER_version")
        53639526 ("KVM: x86/xen: handle PV timers oneshot mode")
        942c2490 ("KVM: x86/xen: Add KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID")
        2fd6df2f ("KVM: x86/xen: intercept EVTCHNOP_send from guests")
        35025735 ("KVM: x86/xen: Support direct injection of event channel events")
      
      That just rebuilds perf, as these patches add just an ioctl that is S390
      specific and may clash with other arches, so are so far being excluded
      in the harvester script:
      
        $ tools/perf/trace/beauty/kvm_ioctl.sh > before
        $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h
        $ tools/perf/trace/beauty/kvm_ioctl.sh > after
        $ diff -u before after
        $ grep 390 tools/perf/trace/beauty/kvm_ioctl.sh
        	egrep -v " ((ARM|PPC|S390)_|[GS]ET_(DEBUGREGS|PIT2|XSAVE|TSC_KHZ)|CREATE_SPAPR_TCE_64)" | \
        $
      
      This is also by now used by tools/testing/selftests/kvm/, a simple test
      build succeeded.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Anup Patel <anup@brainfault.org>
      Cc: Ben Gardon <bgardon@google.com>
      Cc: Chenyi Qiang <chenyi.qiang@intel.com>
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: David Woodhouse <dwmw@amazon.co.uk>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: João Martins <joao.m.martins@oracle.com>
      Cc: Matthew Rosato <mjrosato@linux.ibm.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Gonda <pgonda@google.com>
      Cc: Pierre Morel <pmorel@linux.ibm.com>
      Cc: Tao Xu <tao3.xu@intel.com>
      Link: https://lore.kernel.org/lkml/YvzuryClcn%2FvA0Gn@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bf465ca8
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · 54cd4cde
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        a913bde8 ("drm/i915: Update i915 uapi documentation")
        525e93f6 ("drm/i915/uapi: add NEEDS_CPU_ACCESS hint")
        141f733b ("drm/i915/uapi: expose the avail tracking")
        3f4309cb ("drm/i915/uapi: add probed_cpu_visible_size")
        a50794f2 ("uapi/drm/i915: Document memory residency and Flat-CCS capability of obj")
      
      That don't add any new ioctl, so no changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Matthew Auld <matthew.auld@intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
      Cc: Ramalingam C <ramalingam.c@intel.com>
      Link: http://lore.kernel.org/lkml/Yvzrp9RFIeEkb5fI@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54cd4cde
    • Arnaldo Carvalho de Melo's avatar
      tools headers cpufeatures: Sync with the kernel sources · 62ed93d1
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        2b129932 ("x86/speculation: Add RSB VM Exit protections")
        28a99e95 ("x86/amd: Use IBPB for firmware calls")
        4ad3278d ("x86/speculation: Disable RRSBA behavior")
        26aae8cc ("x86/cpu/amd: Enumerate BTC_NO")
        9756bba2 ("x86/speculation: Fill RSB on vmexit for IBRS")
        3ebc1700 ("x86/bugs: Add retbleed=ibpb")
        2dbb887e ("x86/entry: Add kernel IBRS implementation")
        6b80b59b ("x86/bugs: Report AMD retbleed vulnerability")
        a149180f ("x86: Add magic AMD return-thunk")
        15e67227 ("x86: Undo return-thunk damage")
        a883d624 ("x86/cpufeatures: Move RETPOLINE flags to word 11")
        aae99a7c ("x86/cpufeatures: Introduce x2AVIC CPUID bit")
        6f33a9da ("x86: Fix comment for X86_FEATURE_ZEN")
        51802186 ("x86/speculation/mmio: Enumerate Processor MMIO Stale Data bug")
      
      This only causes these perf files to be rebuilt:
      
        CC       /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
        CC       /tmp/build/perf/bench/mem-memset-x86-64-asm.o
      
      And addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Andrew Cooper <andrew.cooper3@citrix.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Daniel Sneddon <daniel.sneddon@linux.intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
      Cc: Wyes Karny <wyes.karny@amd.com>
      Link: https://lore.kernel.org/lkml/Yvznmu5oHv0ZDN2w@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      62ed93d1
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/fscrypt.h with the kernel sources · fabe0c61
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        6b2a51ff ("fscrypt: Add HCTR2 support for filename encryption")
      
      That don't result in any changes in tooling, just causes this to be
      rebuilt:
      
        CC      /tmp/build/perf-urgent/trace/beauty/sync_file_range.o
        LD      /tmp/build/perf-urgent/trace/beauty/perf-in.o
      
      addressing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fscrypt.h' differs from latest version at 'include/uapi/linux/fscrypt.h'
        diff -u tools/include/uapi/linux/fscrypt.h include/uapi/linux/fscrypt.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Huckleberry <nhuck@google.com>
      Link: https://lore.kernel.org/lkml/Yvzl8C7O1b+hf9GS@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fabe0c61
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 7f7f86a7
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        2b129932 ("x86/speculation: Add RSB VM Exit protections")
        4af184ee ("tools/power turbostat: dump secondary Turbo-Ratio-Limit")
        4ad3278d ("x86/speculation: Disable RRSBA behavior")
        d7caac99 ("x86/cpu/amd: Add Spectral Chicken")
        6ad0ad2b ("x86/bugs: Report Intel retbleed vulnerability")
        c59a1f10 ("KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS")
        465932db ("x86/cpu: Add new VMX feature, Tertiary VM-Execution control")
        027bbb88 ("KVM: x86/speculation: Disable Fill buffer clear within guests")
        51802186 ("x86/speculation/mmio: Enumerate Processor MMIO Stale Data bug")
      
      Addressing these tools/perf build warnings:
      
          diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
          Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
      
      That makes the beautification scripts to pick some new entries:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        --- before	2022-08-17 09:05:13.938246475 -0300
        +++ after	2022-08-17 09:05:22.221455851 -0300
        @@ -161,6 +161,7 @@
         	[0x0000048f] = "IA32_VMX_TRUE_EXIT_CTLS",
         	[0x00000490] = "IA32_VMX_TRUE_ENTRY_CTLS",
         	[0x00000491] = "IA32_VMX_VMFUNC",
        +	[0x00000492] = "IA32_VMX_PROCBASED_CTLS3",
         	[0x000004c1] = "IA32_PMC0",
         	[0x000004d0] = "IA32_MCG_EXT_CTL",
         	[0x00000560] = "IA32_RTIT_OUTPUT_BASE",
        @@ -212,6 +213,7 @@
         	[0x0000064D] = "PLATFORM_ENERGY_STATUS",
         	[0x0000064e] = "PPERF",
         	[0x0000064f] = "PERF_LIMIT_REASONS",
        +	[0x00000650] = "SECONDARY_TURBO_RATIO_LIMIT",
         	[0x00000658] = "PKG_WEIGHTED_CORE_C0_RES",
         	[0x00000659] = "PKG_ANY_CORE_C0_RES",
         	[0x0000065A] = "PKG_ANY_GFXE_C0_RES",
        $
      
      Now one can trace systemwide asking to see backtraces to where those
      MSRs are being read/written, see this example with a previous update:
      
        # perf trace -e msr:*_msr/max-stack=32/ --filter="msr>=IA32_U_CET && msr<=IA32_INT_SSP_TAB"
        ^C#
      
      If we use -v (verbose mode) we can see what it does behind the scenes:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr>=IA32_U_CET && msr<=IA32_INT_SSP_TAB"
        Using CPUID AuthenticAMD-25-21-0
        0x6a0
        0x6a8
        New filter for msr:read_msr: (msr>=0x6a0 && msr<=0x6a8) && (common_pid != 597499 && common_pid != 3313)
        0x6a0
        0x6a8
        New filter for msr:write_msr: (msr>=0x6a0 && msr<=0x6a8) && (common_pid != 597499 && common_pid != 3313)
        mmap size 528384B
        ^C#
      
      Example with a frequent msr:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
        Using CPUID AuthenticAMD-25-21-0
        0x48
        New filter for msr:read_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
        0x48
        New filter for msr:write_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
        mmap size 528384B
        Looking at the vmlinux_path (8 entries long)
        symsrc__init: build id mismatch for vmlinux.
        Using /proc/kcore for kernel data
        Using /proc/kallsyms for symbols
           0.000 Timer/2525383 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
                                             do_trace_write_msr ([kernel.kallsyms])
                                             do_trace_write_msr ([kernel.kallsyms])
                                             __switch_to_xtra ([kernel.kallsyms])
                                             __switch_to ([kernel.kallsyms])
                                             __schedule ([kernel.kallsyms])
                                             schedule ([kernel.kallsyms])
                                             futex_wait_queue_me ([kernel.kallsyms])
                                             futex_wait ([kernel.kallsyms])
                                             do_futex ([kernel.kallsyms])
                                             __x64_sys_futex ([kernel.kallsyms])
                                             do_syscall_64 ([kernel.kallsyms])
                                             entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
                                             __futex_abstimed_wait_common64 (/usr/lib64/libpthread-2.33.so)
           0.030 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
                                             do_trace_write_msr ([kernel.kallsyms])
                                             do_trace_write_msr ([kernel.kallsyms])
                                             __switch_to_xtra ([kernel.kallsyms])
                                             __switch_to ([kernel.kallsyms])
                                             __schedule ([kernel.kallsyms])
                                             schedule_idle ([kernel.kallsyms])
                                             do_idle ([kernel.kallsyms])
                                             cpu_startup_entry ([kernel.kallsyms])
                                             secondary_startup_64_no_verify ([kernel.kallsyms])
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Sneddon <daniel.sneddon@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Like Xu <like.xu@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Hoo <robert.hu@linux.intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: https://lore.kernel.org/lkml/YvzbT24m2o5U%2F7+q@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7f7f86a7
    • Arnaldo Carvalho de Melo's avatar
      perf beauty: Update copy of linux/socket.h with the kernel sources · cf1258ac
      Arnaldo Carvalho de Melo authored
      To pick the changes in:
      
        7fa875b8 ("net: copy from user before calling __copy_msghdr")
        ebe73a28 ("net: Allow custom iter handler in msghdr")
        7c701d92 ("skbuff: carry external ubuf_info in msghdr")
        c0424532 ("net: make __sys_accept4_file() static")
      
      That don't result in any changes in the tables generated from that
      header.
      
      This silences 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 Ahern <dsahern@kernel.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Dylan Yudaken <dylany@fb.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Pavel Begunkov <asml.silence@gmail.com>
      Cc: Yajun Deng <yajun.deng@linux.dev>
      Link: https://lore.kernel.org/lkml/YvzYs+F+Xzq8Hvvp@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cf1258ac
    • Ian Rogers's avatar
      perf cpumap: Fix alignment for masks in event encoding · b2f10cd4
      Ian Rogers authored
      A mask encoding of a cpu map is laid out as:
      
        u16 nr
        u16 long_size
        unsigned long mask[];
      
      However, the mask may be 8-byte aligned meaning there is a 4-byte pad
      after long_size. This means 32-bit and 64-bit builds see the mask as
      being at different offsets. On top of this the structure is in the byte
      data[] encoded as:
      
        u16 type
        char data[]
      
      This means the mask's struct isn't the required 4 or 8 byte aligned, but
      is offset by 2. Consequently the long reads and writes are causing
      undefined behavior as the alignment is broken.
      
      Fix the mask struct by creating explicit 32 and 64-bit variants, use a
      union to avoid data[] and casts; the struct must be packed so the
      layout matches the existing perf.data layout. Taking an address of a
      member of a packed struct breaks alignment so pass the packed
      perf_record_cpu_map_data to functions, so they can access variables with
      the right alignment.
      
      As the 64-bit version has 4 bytes of padding, optimizing writing to only
      write the 32-bit version.
      
      Committer notes:
      
      Disable warnings about 'packed' that break the build in some arches like
      riscv64, but just around that specific struct.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kees Kook <keescook@chromium.org>
      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>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220614143353.1559597-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b2f10cd4
    • Ian Rogers's avatar
      perf cpumap: Compute mask size in constant time · 28526478
      Ian Rogers authored
      perf_cpu_map__max() computes the cpumap's maximum value, no need to
      iterate over all values.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kees Kook <keescook@chromium.org>
      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>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220614143353.1559597-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      28526478
    • Ian Rogers's avatar
      perf cpumap: Synthetic events and const/static · 35ae6f09
      Ian Rogers authored
      Make the cpumap arguments const to make it clearer they are in rather
      than out arguments. Make two functions static and remove external
      declarations.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kees Kook <keescook@chromium.org>
      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>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220614143353.1559597-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      35ae6f09
    • Ian Rogers's avatar
      perf cpumap: Const map for max() · e989bc3d
      Ian Rogers authored
      Allows max() to be used with 'const struct perf_cpu_maps *'.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Kees Kook <keescook@chromium.org>
      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>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220614143353.1559597-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e989bc3d
    • Linus Torvalds's avatar
      Merge tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 4c2d0b03
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from netfilter.
      
        Current release - regressions:
      
         - tcp: fix cleanup and leaks in tcp_read_skb() (the new way BPF
           socket maps get data out of the TCP stack)
      
         - tls: rx: react to strparser initialization errors
      
         - netfilter: nf_tables: fix scheduling-while-atomic splat
      
         - net: fix suspicious RCU usage in bpf_sk_reuseport_detach()
      
        Current release - new code bugs:
      
         - mlxsw: ptp: fix a couple of races, static checker warnings and
           error handling
      
        Previous releases - regressions:
      
         - netfilter:
            - nf_tables: fix possible module reference underflow in error path
            - make conntrack helpers deal with BIG TCP (skbs > 64kB)
            - nfnetlink: re-enable conntrack expectation events
      
         - net: fix potential refcount leak in ndisc_router_discovery()
      
        Previous releases - always broken:
      
         - sched: cls_route: disallow handle of 0
      
         - neigh: fix possible local DoS due to net iface start/stop loop
      
         - rtnetlink: fix module refcount leak in rtnetlink_rcv_msg
      
         - sched: fix adding qlen to qcpu->backlog in gnet_stats_add_queue_cpu
      
         - virtio_net: fix endian-ness for RSS
      
         - dsa: mv88e6060: prevent crash on an unused port
      
         - fec: fix timer capture timing in `fec_ptp_enable_pps()`
      
         - ocelot: stats: fix races, integer wrapping and reading incorrect
           registers (the change of register definitions here accounts for
           bulk of the changed LoC in this PR)"
      
      * tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits)
        net: moxa: MAC address reading, generating, validity checking
        tcp: handle pure FIN case correctly
        tcp: refactor tcp_read_skb() a bit
        tcp: fix tcp_cleanup_rbuf() for tcp_read_skb()
        tcp: fix sock skb accounting in tcp_read_skb()
        igb: Add lock to avoid data race
        dt-bindings: Fix incorrect "the the" corrections
        net: genl: fix error path memory leak in policy dumping
        stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove()
        net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_xdp_run
        net/mlx5e: Allocate flow steering storage during uplink initialization
        net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats
        net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset
        net: mscc: ocelot: make struct ocelot_stat_layout array indexable
        net: mscc: ocelot: fix race between ndo_get_stats64 and ocelot_check_stats_work
        net: mscc: ocelot: turn stats_lock into a spinlock
        net: mscc: ocelot: fix address of SYS_COUNT_TX_AGING counter
        net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters
        net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
        net: dsa: don't warn in dsa_port_set_state_now() when driver doesn't support it
        ...
      4c2d0b03
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-next-6.0-rc2' of... · 90b6b686
      Linus Torvalds authored
      Merge tag 'linux-kselftest-next-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fix from Shuah Khan:
      
       - fix landlock test build regression
      
      * tag 'linux-kselftest-next-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/landlock: fix broken include of linux/landlock.h
      90b6b686
    • Linus Torvalds's avatar
      Merge tag 'trace-rtla-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 0de277d4
      Linus Torvalds authored
      Pull rtla tool fixes from Steven Rostedt:
       "Fixes for the Real-Time Linux Analysis tooling:
      
         - Fix tracer name in comments and prints
      
         - Fix setting up symlinks
      
         - Allow extra flags to be set in build
      
         - Consolidate and show all necessary libraries not found in build
           error"
      
      * tag 'trace-rtla-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        rtla: Consolidate and show all necessary libraries that failed for building
        tools/rtla: Build with EXTRA_{C,LD}FLAGS
        tools/rtla: Fix command symlinks
        rtla: Fix tracer name
      0de277d4
  2. 18 Aug, 2022 26 commits
  3. 17 Aug, 2022 1 commit
    • David Howells's avatar
      net: Fix suspicious RCU usage in bpf_sk_reuseport_detach() · fc4aaf9f
      David Howells authored
      bpf_sk_reuseport_detach() calls __rcu_dereference_sk_user_data_with_flags()
      to obtain the value of sk->sk_user_data, but that function is only usable
      if the RCU read lock is held, and neither that function nor any of its
      callers hold it.
      
      Fix this by adding a new helper, __locked_read_sk_user_data_with_flags()
      that checks to see if sk->sk_callback_lock() is held and use that here
      instead.
      
      Alternatively, making __rcu_dereference_sk_user_data_with_flags() use
      rcu_dereference_checked() might suffice.
      
      Without this, the following warning can be occasionally observed:
      
      =============================
      WARNING: suspicious RCU usage
      6.0.0-rc1-build2+ #563 Not tainted
      -----------------------------
      include/net/sock.h:592 suspicious rcu_dereference_check() usage!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 2, debug_locks = 1
      5 locks held by locktest/29873:
       #0: ffff88812734b550 (&sb->s_type->i_mutex_key#9){+.+.}-{3:3}, at: __sock_release+0x77/0x121
       #1: ffff88812f5621b0 (sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_close+0x1c/0x70
       #2: ffff88810312f5c8 (&h->lhash2[i].lock){+.+.}-{2:2}, at: inet_unhash+0x76/0x1c0
       #3: ffffffff83768bb8 (reuseport_lock){+...}-{2:2}, at: reuseport_detach_sock+0x18/0xdd
       #4: ffff88812f562438 (clock-AF_INET){++..}-{2:2}, at: bpf_sk_reuseport_detach+0x24/0xa4
      
      stack backtrace:
      CPU: 1 PID: 29873 Comm: locktest Not tainted 6.0.0-rc1-build2+ #563
      Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
      Call Trace:
       <TASK>
       dump_stack_lvl+0x4c/0x5f
       bpf_sk_reuseport_detach+0x6d/0xa4
       reuseport_detach_sock+0x75/0xdd
       inet_unhash+0xa5/0x1c0
       tcp_set_state+0x169/0x20f
       ? lockdep_sock_is_held+0x3a/0x3a
       ? __lock_release.isra.0+0x13e/0x220
       ? reacquire_held_locks+0x1bb/0x1bb
       ? hlock_class+0x31/0x96
       ? mark_lock+0x9e/0x1af
       __tcp_close+0x50/0x4b6
       tcp_close+0x28/0x70
       inet_release+0x8e/0xa7
       __sock_release+0x95/0x121
       sock_close+0x14/0x17
       __fput+0x20f/0x36a
       task_work_run+0xa3/0xcc
       exit_to_user_mode_prepare+0x9c/0x14d
       syscall_exit_to_user_mode+0x18/0x44
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: cf8c1e96 ("net: refactor bpf_sk_reuseport_detach()")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Hawkins Jiawei <yin31149@gmail.com>
      Link: https://lore.kernel.org/r/166064248071.3502205.10036394558814861778.stgit@warthog.procyon.org.ukSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fc4aaf9f