06 Dec, 2020

1 commit

  • Since insn.prefixes.nbytes can be bigger than the size of
    insn.prefixes.bytes[] when a prefix is repeated, the proper check must
    be

    insn.prefixes.bytes[i] != 0 and i < 4

    instead of using insn.prefixes.nbytes.

    Introduce a for_each_insn_prefix() macro for this purpose. Debugged by
    Kees Cook .

    [ bp: Massage commit message, sync with the respective header in tools/
    and drop "we". ]

    Fixes: 2b1444983508 ("uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints")
    Reported-by: syzbot+9b64b619f10f19d19a7c@syzkaller.appspotmail.com
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Borislav Petkov
    Reviewed-by: Srikar Dronamraju
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/160697103739.3146288.7437620795200799020.stgit@devnote2

    Masami Hiramatsu
     

13 Nov, 2020

1 commit

  • To bring in the change made in this cset:

    4d6ffa27b8e5116c ("x86/lib: Change .weak to SYM_FUNC_START_WEAK for arch/x86/lib/mem*_64.S")
    6dcc5627f6aec4cb ("x86/asm: Change all ENTRY+ENDPROC to SYM_FUNC_*")

    I needed to define SYM_FUNC_START_LOCAL() as SYM_L_GLOBAL as
    mem{cpy,set}_{orig,erms} are used by 'perf bench'.

    This silences these perf tools build warnings:

    Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
    diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
    Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
    diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Fangrui Song
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Jiri Slaby
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

03 Nov, 2020

4 commits

  • Some should cause changes in tooling, like the one adding LAST_EXCP, but
    the way it is structured end up not making that happen.

    The new SVM_EXIT_INVPCID should get used by arch/x86/util/kvm-stat.c,
    in the svm_exit_reasons table.

    The tools/perf/trace/beauty part has scripts to catch changes and
    automagically create tables, like tools/perf/trace/beauty/kvm_ioctl.sh,
    but changes are needed to make tools/perf/arch/x86/util/kvm-stat.c catch
    those automatically.

    These were handled by the existing scripts:

    $ 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
    --- before 2020-11-03 08:43:52.910728608 -0300
    +++ after 2020-11-03 08:44:04.273959984 -0300
    @@ -89,6 +89,7 @@
    [0xbf] = "SET_NESTED_STATE",
    [0xc0] = "CLEAR_DIRTY_LOG",
    [0xc1] = "GET_SUPPORTED_HV_CPUID",
    + [0xc6] = "X86_SET_MSR_FILTER",
    [0xe0] = "CREATE_DEVICE",
    [0xe1] = "SET_DEVICE_ATTR",
    [0xe2] = "GET_DEVICE_ATTR",
    $
    $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before
    $ cp include/uapi/linux/vhost.h tools/include/uapi/linux/vhost.h
    $
    $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after
    $ diff -u before after
    --- before 2020-11-03 08:45:55.522225198 -0300
    +++ after 2020-11-03 08:46:12.881578666 -0300
    @@ -37,4 +37,5 @@
    [0x71] = "VDPA_GET_STATUS",
    [0x73] = "VDPA_GET_CONFIG",
    [0x76] = "VDPA_GET_VRING_NUM",
    + [0x78] = "VDPA_GET_IOVA_RANGE",
    };
    $

    This addresses these perf build warnings:

    Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h'
    diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
    Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/sie.h' differs from latest version at 'arch/s390/include/uapi/asm/sie.h'
    diff -u tools/arch/s390/include/uapi/asm/sie.h arch/s390/include/uapi/asm/sie.h
    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
    Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/svm.h' differs from latest version at 'arch/x86/include/uapi/asm/svm.h'
    diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h
    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
    Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
    diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h

    Cc: Adrian Hunter
    Cc: Alexander Yarygin
    Cc: Borislav Petkov
    Cc: Christian Borntraeger
    Cc: Cornelia Huck
    Cc: David Ahern
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Joerg Roedel
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick up the changes in:

    29dcc60f6a19fb0a ("x86/boot/compressed/64: Add stage1 #VC handler")
    36e1be8ada994d50 ("perf/x86/amd/ibs: Fix raw sample data accumulation")
    59a854e2f3b90ad2 ("perf/x86/intel: Support TopDown metrics on Ice Lake")
    7b2c05a15d29d057 ("perf/x86/intel: Generic support for hardware TopDown metrics")
    99e40204e014e066 ("x86/msr: Move the F15h MSRs where they belong")
    b57de6cd16395be1 ("x86/sev-es: Add SEV-ES Feature Detection")
    ed7bde7a6dab521e ("cpufreq: intel_pstate: Allow enable/disable energy efficiency")
    f0f2f9feb4ee6f28 ("x86/msr-index: Define an IA32_PASID MSR")

    That cause these changes in tooling:

    $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
    $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
    $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
    $ diff -u before after
    --- before 2020-10-19 13:27:33.195274425 -0300
    +++ after 2020-10-19 13:27:44.144507610 -0300
    @@ -113,6 +113,8 @@
    [0x00000309] = "CORE_PERF_FIXED_CTR0",
    [0x0000030a] = "CORE_PERF_FIXED_CTR1",
    [0x0000030b] = "CORE_PERF_FIXED_CTR2",
    + [0x0000030c] = "CORE_PERF_FIXED_CTR3",
    + [0x00000329] = "PERF_METRICS",
    [0x00000345] = "IA32_PERF_CAPABILITIES",
    [0x0000038d] = "CORE_PERF_FIXED_CTR_CTRL",
    [0x0000038e] = "CORE_PERF_GLOBAL_STATUS",
    @@ -222,6 +224,7 @@
    [0x00000774] = "HWP_REQUEST",
    [0x00000777] = "HWP_STATUS",
    [0x00000d90] = "IA32_BNDCFGS",
    + [0x00000d93] = "IA32_PASID",
    [0x00000da0] = "IA32_XSS",
    [0x00000dc0] = "LBR_INFO_0",
    [0x00000ffc] = "IA32_BNDCFGS_RSVD",
    @@ -279,6 +282,7 @@
    [0xc0010115 - x86_AMD_V_KVM_MSRs_offset] = "VM_IGNNE",
    [0xc0010117 - x86_AMD_V_KVM_MSRs_offset] = "VM_HSAVE_PA",
    [0xc001011f - x86_AMD_V_KVM_MSRs_offset] = "AMD64_VIRT_SPEC_CTRL",
    + [0xc0010130 - x86_AMD_V_KVM_MSRs_offset] = "AMD64_SEV_ES_GHCB",
    [0xc0010131 - x86_AMD_V_KVM_MSRs_offset] = "AMD64_SEV",
    [0xc0010140 - x86_AMD_V_KVM_MSRs_offset] = "AMD64_OSVW_ID_LENGTH",
    [0xc0010141 - x86_AMD_V_KVM_MSRs_offset] = "AMD64_OSVW_STATUS",
    $

    Which causes these parts of tools/perf/ to be rebuilt:

    CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
    DESCEND plugins
    GEN /tmp/build/perf/python/perf.so
    INSTALL trace_plugins
    LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
    LD /tmp/build/perf/trace/beauty/perf-in.o
    LD /tmp/build/perf/perf-in.o
    LINK /tmp/build/perf/per

    At some point these should just be tables read by perf on demand.

    This addresses this perf tools build warning:

    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'

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Fenghua Yu
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Joerg Roedel
    Cc: Kan Liang
    Cc: Kim Phillips
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Cc: Srinivas Pandruvada
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick the changes from:

    ecac71816a1829c0 ("x86/paravirt: Use CONFIG_PARAVIRT_XXL instead of CONFIG_PARAVIRT")

    That don entail any changes in tooling, just addressing these perf tools
    build warning:

    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/required-features.h' differs from latest version at 'arch/x86/include/asm/required-features.h'
    diff -u tools/arch/x86/include/asm/required-features.h arch/x86/include/asm/required-features.h

    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Juergen Gross
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick the changes from:

    5866e9205b47a983 ("x86/cpu: Add hardware-enforced cache coherency as a CPUID feature")
    ff4f82816dff28ff ("x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions")
    360e7c5c4ca4fd8e ("x86/cpufeatures: Add SEV-ES CPU feature")
    18ec63faefb3fd31 ("x86/cpufeatures: Enumerate TSX suspend load address tracking instructions")
    e48cb1a3fb916500 ("x86/resctrl: Enumerate per-thread MBA controls")

    Which don't cause any changes in tooling, just addresses these build
    warnings:

    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
    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/disabled-features.h' differs from latest version at 'arch/x86/include/asm/disabled-features.h'
    diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Fenghua Yu
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Krish Sadhukhan
    Cc: Kyung Min Park
    Cc: Namhyung Kim
    Cc: Tom Lendacky
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

15 Oct, 2020

3 commits

  • We will not allow unitialized anon mmaps, but we need this define
    to prevent build errors, e.g. the debian foot package.

    Suggested-by: John David Anglin
    Signed-off-by: Helge Deller

    Helge Deller
     
  • Pull x86 SEV-ES support from Borislav Petkov:
    "SEV-ES enhances the current guest memory encryption support called SEV
    by also encrypting the guest register state, making the registers
    inaccessible to the hypervisor by en-/decrypting them on world
    switches. Thus, it adds additional protection to Linux guests against
    exfiltration, control flow and rollback attacks.

    With SEV-ES, the guest is in full control of what registers the
    hypervisor can access. This is provided by a guest-host exchange
    mechanism based on a new exception vector called VMM Communication
    Exception (#VC), a new instruction called VMGEXIT and a shared
    Guest-Host Communication Block which is a decrypted page shared
    between the guest and the hypervisor.

    Intercepts to the hypervisor become #VC exceptions in an SEV-ES guest
    so in order for that exception mechanism to work, the early x86 init
    code needed to be made able to handle exceptions, which, in itself,
    brings a bunch of very nice cleanups and improvements to the early
    boot code like an early page fault handler, allowing for on-demand
    building of the identity mapping. With that, !KASLR configurations do
    not use the EFI page table anymore but switch to a kernel-controlled
    one.

    The main part of this series adds the support for that new exchange
    mechanism. The goal has been to keep this as much as possibly separate
    from the core x86 code by concentrating the machinery in two
    SEV-ES-specific files:

    arch/x86/kernel/sev-es-shared.c
    arch/x86/kernel/sev-es.c

    Other interaction with core x86 code has been kept at minimum and
    behind static keys to minimize the performance impact on !SEV-ES
    setups.

    Work by Joerg Roedel and Thomas Lendacky and others"

    * tag 'x86_seves_for_v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (73 commits)
    x86/sev-es: Use GHCB accessor for setting the MMIO scratch buffer
    x86/sev-es: Check required CPU features for SEV-ES
    x86/efi: Add GHCB mappings when SEV-ES is active
    x86/sev-es: Handle NMI State
    x86/sev-es: Support CPU offline/online
    x86/head/64: Don't call verify_cpu() on starting APs
    x86/smpboot: Load TSS and getcpu GDT entry before loading IDT
    x86/realmode: Setup AP jump table
    x86/realmode: Add SEV-ES specific trampoline entry point
    x86/vmware: Add VMware-specific handling for VMMCALL under SEV-ES
    x86/kvm: Add KVM-specific VMMCALL handling under SEV-ES
    x86/paravirt: Allow hypervisor-specific VMMCALL handling under SEV-ES
    x86/sev-es: Handle #DB Events
    x86/sev-es: Handle #AC Events
    x86/sev-es: Handle VMMCALL Events
    x86/sev-es: Handle MWAIT/MWAITX Events
    x86/sev-es: Handle MONITOR/MONITORX Events
    x86/sev-es: Handle INVD Events
    x86/sev-es: Handle RDPMC Events
    x86/sev-es: Handle RDTSC(P) Events
    ...

    Linus Torvalds
     
  • Pull objtool updates from Ingo Molnar:
    "Most of the changes are cleanups and reorganization to make the
    objtool code more arch-agnostic. This is in preparation for non-x86
    support.

    Other changes:

    - KASAN fixes

    - Handle unreachable trap after call to noreturn functions better

    - Ignore unreachable fake jumps

    - Misc smaller fixes & cleanups"

    * tag 'objtool-core-2020-10-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
    perf build: Allow nested externs to enable BUILD_BUG() usage
    objtool: Allow nested externs to enable BUILD_BUG()
    objtool: Permit __kasan_check_{read,write} under UACCESS
    objtool: Ignore unreachable trap after call to noreturn functions
    objtool: Handle calling non-function symbols in other sections
    objtool: Ignore unreachable fake jumps
    objtool: Remove useless tests before save_reg()
    objtool: Decode unwind hint register depending on architecture
    objtool: Make unwind hint definitions available to other architectures
    objtool: Only include valid definitions depending on source file type
    objtool: Rename frame.h -> objtool.h
    objtool: Refactor jump table code to support other architectures
    objtool: Make relocation in alternative handling arch dependent
    objtool: Abstract alternative special case handling
    objtool: Move macros describing structures to arch-dependent code
    objtool: Make sync-check consider the target architecture
    objtool: Group headers to check in a single list
    objtool: Define 'struct orc_entry' only when needed
    objtool: Skip ORC entry creation for non-text sections
    objtool: Move ORC logic out of check()
    ...

    Linus Torvalds
     

06 Oct, 2020

1 commit

  • In reaction to a proposal to introduce a memcpy_mcsafe_fast()
    implementation Linus points out that memcpy_mcsafe() is poorly named
    relative to communicating the scope of the interface. Specifically what
    addresses are valid to pass as source, destination, and what faults /
    exceptions are handled.

    Of particular concern is that even though x86 might be able to handle
    the semantics of copy_mc_to_user() with its common copy_user_generic()
    implementation other archs likely need / want an explicit path for this
    case:

    On Fri, May 1, 2020 at 11:28 AM Linus Torvalds wrote:
    >
    > On Thu, Apr 30, 2020 at 6:21 PM Dan Williams wrote:
    > >
    > > However now I see that copy_user_generic() works for the wrong reason.
    > > It works because the exception on the source address due to poison
    > > looks no different than a write fault on the user address to the
    > > caller, it's still just a short copy. So it makes copy_to_user() work
    > > for the wrong reason relative to the name.
    >
    > Right.
    >
    > And it won't work that way on other architectures. On x86, we have a
    > generic function that can take faults on either side, and we use it
    > for both cases (and for the "in_user" case too), but that's an
    > artifact of the architecture oddity.
    >
    > In fact, it's probably wrong even on x86 - because it can hide bugs -
    > but writing those things is painful enough that everybody prefers
    > having just one function.

    Replace a single top-level memcpy_mcsafe() with either
    copy_mc_to_user(), or copy_mc_to_kernel().

    Introduce an x86 copy_mc_fragile() name as the rename for the
    low-level x86 implementation formerly named memcpy_mcsafe(). It is used
    as the slow / careful backend that is supplanted by a fast
    copy_mc_generic() in a follow-on patch.

    One side-effect of this reorganization is that separating copy_mc_64.S
    to its own file means that perf no longer needs to track dependencies
    for its memcpy_64.S benchmarks.

    [ bp: Massage a bit. ]

    Signed-off-by: Dan Williams
    Signed-off-by: Borislav Petkov
    Reviewed-by: Tony Luck
    Acked-by: Michael Ellerman
    Cc:
    Link: http://lore.kernel.org/r/CAHk-=wjSqtXAqfUJxFtWNwmguFASTgB0dz1dT3V-78Quiezqbg@mail.gmail.com
    Link: https://lkml.kernel.org/r/160195561680.2163339.11574962055305783722.stgit@dwillia2-desk3.amr.corp.intel.com

    Dan Williams
     

10 Sep, 2020

1 commit

  • Unwind hints are useful to provide objtool with information about stack
    states in non-standard functions/code.

    While the type of information being provided might be very arch
    specific, the mechanism to provide the information can be useful for
    other architectures.

    Move the relevant unwint hint definitions for all architectures to
    see.

    [ jpoimboe: REGS_IRET -> REGS_PARTIAL ]

    Signed-off-by: Julien Thierry
    Signed-off-by: Josh Poimboeuf

    Julien Thierry
     

08 Sep, 2020

1 commit

  • The inat-tables.c file has some arrays in it that contain pointers to
    other arrays. These pointers need to be relocated when the kernel
    image is moved to a different location.

    The pre-decompression boot-code has no support for applying ELF
    relocations, so initialize these arrays at runtime in the
    pre-decompression code to make sure all pointers are correctly
    initialized.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Borislav Petkov
    Acked-by: Masami Hiramatsu
    Link: https://lkml.kernel.org/r/20200907131613.12703-8-joro@8bytes.org

    Joerg Roedel
     

12 Aug, 2020

1 commit

  • To pick the changes in:

    23a60f834406 ("s390/kvm: diagnose 0x318 sync and reset")

    None of them trigger any changes in tooling, this time this is just to silence
    these perf build warnings:

    Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h'
    diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/include/uapi/asm/kvm.h

    Cc: Adrian Hunter
    Cc: Christian Borntraeger
    Cc: Collin Walling
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

11 Aug, 2020

1 commit

  • Pull perf tools updates from Arnaldo Carvalho de Melo:
    "New features:

    - Introduce controlling how 'perf stat' and 'perf record' works via a
    control file descriptor, allowing starting with events configured
    but disabled until commands are received via the control file
    descriptor. This allows, for instance for tools such as Intel VTune
    to make further use of perf as its Linux platform driver.

    - Improve 'perf record' to to register in a perf.data file header the
    clockid used to help later correlate things like syslog files and
    perf events recorded.

    - Add basic syscall and find_next_bit benchmarks to 'perf bench'.

    - Allow using computed metrics in calculating other metrics. For
    instance:

    {
    .metric_expr = "l2_rqsts.demand_data_rd_hit + l2_rqsts.pf_hit + l2_rqsts.rfo_hit",
    .metric_name = "DCache_L2_All_Hits",
    },
    {
    .metric_expr = "max(l2_rqsts.all_demand_data_rd - l2_rqsts.demand_data_rd_hit, 0) + l2_rqsts.pf_miss + l2_rqsts.rfo_miss",
    .metric_name = "DCache_L2_All_Miss",
    },
    {
    .metric_expr = "dcache_l2_all_hits + dcache_l2_all_miss",
    .metric_name = "DCache_L2_All",
    }

    - Add suport for 'd_ratio', '>' and ' enumerators to be 64 bits
    perf data: Add support to store time of day in CTF data conversion
    perf tools: Move clockid_res_ns under clock struct
    perf header: Store clock references for -k/--clockid option
    perf tools: Add clockid_name function
    perf clockid: Move parse_clockid() to new clockid object
    tools lib traceevent: Handle possible strdup() error in tep_add_plugin_path() API
    libtraceevent: Fixed description of tep_add_plugin_path() API
    libtraceevent: Fixed type in PRINT_FMT_STING
    libtraceevent: Fixed broken indentation in parse_ip4_print_args()
    libtraceevent: Improve error handling of tep_plugin_add_option() API
    ...

    Linus Torvalds
     

08 Aug, 2020

2 commits

  • Pull powerpc updates from Michael Ellerman:

    - Add support for (optionally) using queued spinlocks & rwlocks.

    - Support for a new faster system call ABI using the scv instruction on
    Power9 or later.

    - Drop support for the PROT_SAO mmap/mprotect flag as it will be
    unsupported on Power10 and future processors, leaving us with no way
    to implement the functionality it requests. This risks breaking
    userspace, though we believe it is unused in practice.

    - A bug fix for, and then the removal of, our custom stack expansion
    checking. We now allow stack expansion up to the rlimit, like other
    architectures.

    - Remove the remnants of our (previously disabled) topology update
    code, which tried to react to NUMA layout changes on virtualised
    systems, but was prone to crashes and other problems.

    - Add PMU support for Power10 CPUs.

    - A change to our signal trampoline so that we don't unbalance the link
    stack (branch return predictor) in the signal delivery path.

    - Lots of other cleanups, refactorings, smaller features and so on as
    usual.

    Thanks to: Abhishek Goel, Alastair D'Silva, Alexander A. Klimov, Alexey
    Kardashevskiy, Alistair Popple, Andrew Donnellan, Aneesh Kumar K.V, Anju
    T Sudhakar, Anton Blanchard, Arnd Bergmann, Athira Rajeev, Balamuruhan
    S, Bharata B Rao, Bill Wendling, Bin Meng, Cédric Le Goater, Chris
    Packham, Christophe Leroy, Christoph Hellwig, Daniel Axtens, Dan
    Williams, David Lamparter, Desnes A. Nunes do Rosario, Erhard F., Finn
    Thain, Frederic Barrat, Ganesh Goudar, Gautham R. Shenoy, Geoff Levand,
    Greg Kurz, Gustavo A. R. Silva, Hari Bathini, Harish, Imre Kaloz, Joel
    Stanley, Joe Perches, John Crispin, Jordan Niethe, Kajol Jain, Kamalesh
    Babulal, Kees Cook, Laurent Dufour, Leonardo Bras, Li RongQing, Madhavan
    Srinivasan, Mahesh Salgaonkar, Mark Cave-Ayland, Michal Suchanek, Milton
    Miller, Mimi Zohar, Murilo Opsfelder Araujo, Nathan Chancellor, Nathan
    Lynch, Naveen N. Rao, Nayna Jain, Nicholas Piggin, Oliver O'Halloran,
    Palmer Dabbelt, Pedro Miraglia Franco de Carvalho, Philippe Bergheaud,
    Pingfan Liu, Pratik Rajesh Sampat, Qian Cai, Qinglang Miao, Randy
    Dunlap, Ravi Bangoria, Sachin Sant, Sam Bobroff, Sandipan Das, Santosh
    Sivaraj, Satheesh Rajendran, Shirisha Ganta, Sourabh Jain, Srikar
    Dronamraju, Stan Johnson, Stephen Rothwell, Thadeu Lima de Souza
    Cascardo, Thiago Jung Bauermann, Tom Lane, Vaibhav Jain, Vladis Dronov,
    Wei Yongjun, Wen Xiong, YueHaibing.

    * tag 'powerpc-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (337 commits)
    selftests/powerpc: Fix pkey syscall redefinitions
    powerpc: Fix circular dependency between percpu.h and mmu.h
    powerpc/powernv/sriov: Fix use of uninitialised variable
    selftests/powerpc: Skip vmx/vsx/tar/etc tests on older CPUs
    powerpc/40x: Fix assembler warning about r0
    powerpc/papr_scm: Add support for fetching nvdimm 'fuel-gauge' metric
    powerpc/papr_scm: Fetch nvdimm performance stats from PHYP
    cpuidle: pseries: Fixup exit latency for CEDE(0)
    cpuidle: pseries: Add function to parse extended CEDE records
    cpuidle: pseries: Set the latency-hint before entering CEDE
    selftests/powerpc: Fix online CPU selection
    powerpc/perf: Consolidate perf_callchain_user_[64|32]()
    powerpc/pseries/hotplug-cpu: Remove double free in error path
    powerpc/pseries/mobility: Add pr_debug() for device tree changes
    powerpc/pseries/mobility: Set pr_fmt()
    powerpc/cacheinfo: Warn if cache object chain becomes unordered
    powerpc/cacheinfo: Improve diagnostics about malformed cache lists
    powerpc/cacheinfo: Use name@unit instead of full DT path in debug messages
    powerpc/cacheinfo: Set pr_fmt()
    powerpc: fix function annotations to avoid section mismatch warnings with gcc-10
    ...

    Linus Torvalds
     
  • Pull RISC-V updates from Palmer Dabbelt:
    "We have a lot of new kernel features for this merge window:

    - ARCH_SUPPORTS_ATOMIC_RMW, to allow OSQ locks to be enabled

    - The ability to enable NO_HZ_FULL

    - Support for enabling kcov, kmemleak, stack protector, and VM
    debugging

    - JUMP_LABEL support

    There are also a handful of cleanups"

    * tag 'riscv-for-linus-5.9-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (24 commits)
    riscv: disable stack-protector for vDSO
    RISC-V: Fix build warning for smpboot.c
    riscv: fix build warning of mm/pageattr
    riscv: Fix build warning for mm/init
    RISC-V: Setup exception vector early
    riscv: Select ARCH_HAS_DEBUG_VM_PGTABLE
    riscv: Use generic pgprot_* macros from
    mm: pgtable: Make generic pgprot_* macros available for no-MMU
    riscv: Cleanup unnecessary define in asm-offset.c
    riscv: Add jump-label implementation
    riscv: Support R_RISCV_ADD64 and R_RISCV_SUB64 relocs
    Replace HTTP links with HTTPS ones: RISC-V
    riscv: Add STACKPROTECTOR supported
    riscv: Fix typo in asm/hwcap.h uapi header
    riscv: Add kmemleak support
    riscv: Allow building with kcov coverage
    riscv: Enable context tracking
    riscv: Support irq_work via self IPIs
    riscv: Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT
    riscv: Fixup lockdep_assert_held with wrong param cpu_running
    ...

    Linus Torvalds
     

07 Aug, 2020

4 commits

  • Added support for supported regs which are new in power10 ( MMCR3,
    SIER2, SIER3 ) to sample_reg_mask in the tool side to use with `-I?`
    option. Also added PVR check to send extended mask for power10 at kernel
    while capturing extended regs in each sample.

    Signed-off-by: Athira Jajeev
    Reviewed-by: Kajol Jain
    Reviewed-by: Ravi Bangoria
    Tested-by: Ravi Bangoria
    Cc: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Michael Ellerman
    Cc: Michael Neuling
    Cc: Ravi Bangoria
    Cc: linuxppc-dev@lists.ozlabs.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Athira Rajeev
     
  • Add extended regs to sample_reg_mask in the tool side to use with `-I?`
    option. Perf tools side uses extended mask to display the platform
    supported register names (with -I? option) to the user and also send
    this mask to the kernel to capture the extended registers in each
    sample. Hence decide the mask value based on the processor version.

    Currently definitions for `mfspr`, `SPRN_PVR` are part of
    `arch/powerpc/util/header.c`. Move this to a header file so that these
    definitions can be re-used in other source files as well.

    Signed-off-by: Anju T Sudhakar
    Reviewed-by: Kajol Jain
    Reviewed-by: Madhavan Srinivasan
    Reviewed--by: Ravi Bangoria
    Tested-by: Ravi Bangoria
    Cc: Jiri Olsa
    Cc: Michael Ellerman
    Cc: Michael Neuling
    Cc: Ravi Bangoria
    Cc: linuxppc-dev@lists.ozlabs.org
    [Decide extended mask at run time based on platform]
    Signed-off-by: Athira Jajeev
    Signed-off-by: Arnaldo Carvalho de Melo

    Anju T Sudhakar
     
  • To pick up the changes from:

    85b23fbc7d88 ("x86/cpufeatures: Add enumeration for SERIALIZE instruction")
    bd657aa3dd85 ("x86/cpufeatures: Add Architectural LBRs feature bit")
    fbd5969d1ff2 ("x86/cpufeatures: Mark two free bits in word 3")

    These should't cause any changes in tooling, it just gets rebuilt by
    including those headers:

    CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
    CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o
    LD /tmp/build/perf/bench/perf-in.o
    LD /tmp/build/perf/perf-in.o
    LINK /tmp/build/perf/perf

    And silences 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
    Cc: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Kan Liang
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Ricardo Neri
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick up the changes in:

    d6a162a41bfd x86/msr-index: Add bunch of MSRs for Arch LBR
    ed7bde7a6dab cpufreq: intel_pstate: Allow enable/disable energy efficiency
    99e40204e014 (tip/x86/cleanups) x86/msr: Move the F15h MSRs where they belong
    1068ed4547ad x86/msr: Lift AMD family 0x15 power-specific MSRs
    5cde265384ca (tag: perf-core-2020-06-01) perf/x86/rapl: Add AMD Fam17h RAPL support

    Addressing these tools/perf build warnings:

    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 2020-08-07 08:45:18.801298854 -0300
    +++ after 2020-08-07 08:45:28.654456422 -0300
    @@ -271,6 +271,8 @@
    [0xc0010062 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PERF_CTL",
    [0xc0010063 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PERF_STATUS",
    [0xc0010064 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PSTATE_DEF_BASE",
    + [0xc001007a - x86_AMD_V_KVM_MSRs_offset] = "F15H_CU_PWR_ACCUMULATOR",
    + [0xc001007b - x86_AMD_V_KVM_MSRs_offset] = "F15H_CU_MAX_PWR_ACCUMULATOR",
    [0xc0010112 - x86_AMD_V_KVM_MSRs_offset] = "K8_TSEG_ADDR",
    [0xc0010113 - x86_AMD_V_KVM_MSRs_offset] = "K8_TSEG_MASK",
    [0xc0010114 - x86_AMD_V_KVM_MSRs_offset] = "VM_CR",
    $

    And this gets rebuilt:

    CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
    INSTALL trace_plugins
    LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
    LD /tmp/build/perf/trace/beauty/perf-in.o
    LD /tmp/build/perf/perf-in.o
    LINK /tmp/build/perf/perf

    Now one can trace systemwide asking to see backtraces to where those
    MSRs are being read/written with:

    # perf trace -e msr:*_msr/max-stack=32/ --filter="msr==F15H_CU_PWR_ACCUMULATOR || msr==F15H_CU_MAX_PWR_ACCUMULATOR"
    ^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==F15H_CU_PWR_ACCUMULATOR || msr==F15H_CU_MAX_PWR_ACCUMULATOR"
    Using CPUID GenuineIntel-6-8E-A
    0xc001007a
    0xc001007b
    New filter for msr:read_msr: (msr==0xc001007a || msr==0xc001007b) && (common_pid != 2448054 && common_pid != 2782)
    0xc001007a
    0xc001007b
    New filter for msr:write_msr: (msr==0xc001007a || msr==0xc001007b) && (common_pid != 2448054 && common_pid != 2782)
    mmap size 528384B
    ^C#

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Kan Liang
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Cc: Srinivas Pandruvada
    Cc: Stephane Eranian
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

31 Jul, 2020

1 commit

  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `\bxmlns\b`:
    For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Palmer Dabbelt

    Alexander A. Klimov
     

22 Jul, 2020

1 commit

  • Power ISA v3.1 has added new performance monitoring unit (PMU) special
    purpose registers (SPRs). They are:

    Monitor Mode Control Register 3 (MMCR3)
    Sampled Instruction Event Register A (SIER2)
    Sampled Instruction Event Register B (SIER3)

    Add support to save/restore these new SPRs while entering/exiting
    guest. Also include changes to support KVM_REG_PPC_MMCR3/SIER2/SIER3.
    Add new SPRs to KVM API documentation.

    Signed-off-by: Athira Rajeev
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/1594996707-3727-6-git-send-email-atrajeev@linux.vnet.ibm.com

    Athira Rajeev
     

17 Jul, 2020

1 commit

  • To pick up the changes from:

    83d31e5271ac ("KVM: nVMX: fixes for preemption timer migration")

    That don't entail changes in tooling.

    This silences these tools/perf build warnings:

    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: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

03 Jul, 2020

1 commit

  • To bring in the change made in this cset:

    e3a9e681adb7 ("x86/entry: Fixup bad_iret vs noinstr")

    This doesn't cause any functional changes to tooling, just a rebuild.

    Addresses this perf build warning:

    Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
    diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S

    Cc: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

18 Jun, 2020

1 commit

  • To pick up the changes in:

    7e5b3c267d25 ("x86/speculation: Add Special Register Buffer Data Sampling (SRBDS) mitigation")

    Addressing these tools/perf build warnings:

    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
    diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
    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

    With this one will be able to use these new AMD MSRs in filters, by
    name, e.g.:

    # perf trace -e msr:* --filter "msr==IA32_MCU_OPT_CTRL"
    ^C#

    Using -v we can see how it sets up the tracepoint filters, converting
    from the string in the filter to the numeric value:

    # perf trace -v -e msr:* --filter "msr==IA32_MCU_OPT_CTRL"
    Using CPUID GenuineIntel-6-8E-A
    0x123
    New filter for msr:read_msr: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
    0x123
    New filter for msr:write_msr: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
    0x123
    New filter for msr:rdpmc: (msr==0x123) && (common_pid != 335 && common_pid != 30344)
    mmap size 528384B
    ^C#

    The updating process shows how this affects tooling in more detail:

    $ diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
    --- tools/arch/x86/include/asm/msr-index.h 2020-06-03 10:36:09.959910238 -0300
    +++ arch/x86/include/asm/msr-index.h 2020-06-17 10:04:20.235052901 -0300
    @@ -128,6 +128,10 @@
    #define TSX_CTRL_RTM_DISABLE BIT(0) /* Disable RTM feature */
    #define TSX_CTRL_CPUID_CLEAR BIT(1) /* Disable TSX enumeration */

    +/* SRBDS support */
    +#define MSR_IA32_MCU_OPT_CTRL 0x00000123
    +#define RNGDS_MITG_DIS BIT(0)
    +
    #define MSR_IA32_SYSENTER_CS 0x00000174
    #define MSR_IA32_SYSENTER_ESP 0x00000175
    #define MSR_IA32_SYSENTER_EIP 0x00000176
    $ set -o vi
    $ 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 2020-06-17 10:05:49.653114752 -0300
    +++ after 2020-06-17 10:06:01.777258731 -0300
    @@ -51,6 +51,7 @@
    [0x0000011e] = "IA32_BBL_CR_CTL3",
    [0x00000120] = "IDT_MCR_CTRL",
    [0x00000122] = "IA32_TSX_CTRL",
    + [0x00000123] = "IA32_MCU_OPT_CTRL",
    [0x00000140] = "MISC_FEATURES_ENABLES",
    [0x00000174] = "IA32_SYSENTER_CS",
    [0x00000175] = "IA32_SYSENTER_ESP",
    $

    The related change to cpu-features.h affects this:

    CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
    CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o

    This shouldn't be affecting that 'perf bench' entry:

    $ find tools/perf/ -type f | xargs grep SRBDS
    $

    Cc: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Mark Gross
    Cc: Namhyung Kim
    Cc: Thomas Gleixner
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

09 Jun, 2020

2 commits

  • To pick the changes in:

    f97f5a56f597 ("x86/kvm/hyper-v: Add support for synthetic debugger interface")
    850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration")
    2c4c41325540 ("KVM: x86: Print symbolic names of VMX VM-Exit flags in traces")
    cc440cdad5b7 ("KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE")
    f7d31e65368a ("x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit")
    72de5fa4c161 ("KVM: x86: announce KVM_FEATURE_ASYNC_PF_INT")
    acd05785e48c ("kvm: add capability for halt polling")
    3ecad8c2c1ff ("docs: fix broken references for ReST files that moved around")

    That do not result in any change in tooling, as the additions are not
    being used in any table generator.

    This silences these 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
    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
    Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/vmx.h' differs from latest version at 'arch/x86/include/uapi/asm/vmx.h'
    diff -u tools/arch/x86/include/uapi/asm/vmx.h arch/x86/include/uapi/asm/vmx.h

    Cc: Adrian Hunter
    Cc: David Matlack
    Cc: Jiri Olsa
    Cc: Jon Doron
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Cc: Peter Shier
    Cc: Sean Christopherson
    Cc: Vitaly Kuznetsov
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick up the change in:

    700d3a5a664d ("x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long"")

    That doesn't trigger any changes in tooling and silences this perf build
    warning:

    Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h'
    diff -u tools/arch/x86/include/uapi/asm/unistd.h arch/x86/include/uapi/asm/unistd.h

    Cc: Adrian Hunter
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

07 Jun, 2020

1 commit

  • Pull arch/sh updates from Rich Felker:
    "Fix for arch/sh build regression with newer binutils, removal of SH5,
    fixes for module exports, and misc cleanup"

    * tag 'sh-for-5.8' of git://git.libc.org/linux-sh:
    sh: remove sh5 support
    sh: add missing EXPORT_SYMBOL() for __delay
    sh: Convert ins[bwl]/outs[bwl] macros to inline functions
    sh: Convert iounmap() macros to inline functions
    sh: Add missing DECLARE_EXPORT() for __ashiftrt_r4_xx
    sh: configs: Cleanup old Kconfig IO scheduler options
    arch/sh: vmlinux.scr
    sh: Replace CONFIG_MTD_M25P80 with CONFIG_MTD_SPI_NOR in sh7757lcr_defconfig
    sh: sh4a: Bring back tmu3_device early device

    Linus Torvalds
     

05 Jun, 2020

1 commit

  • Pull perf tooling updates from Arnaldo Carvalho de Melo:
    "These are additional changes to the perf tools, on top of what Ingo
    already submitted.

    - Further Intel PT call-trace fixes

    - Improve SELinux docs and tool warnings

    - Fix race at exit in 'perf record' using eventfd.

    - Add missing build tests to the default set of 'make -C tools/perf
    build-test'

    - Sync msr-index.h getting new AMD MSRs to decode and filter in 'perf
    trace'.

    - Fix fallback to libaudit in 'perf trace' for arches not using
    per-arch *.tbl files.

    - Fixes for 'perf ftrace'.

    - Fixes and improvements for the 'perf stat' metrics.

    - Use dummy event to get PERF_RECORD_{FORK,MMAP,etc} while
    synthesizing those metadata events for pre-existing threads.

    - Fix leaks detected using clang tooling.

    - Improvements to PMU event metric testing.

    - Report summary for 'perf stat' interval mode at the end, summing up
    all the intervals.

    - Improve pipe mode, i.e. this now works as expected, continuously
    dumping samples:

    # perf record -g -e raw_syscalls:sys_enter | perf --no-pager script

    - Fixes for event grouping, detecting incompatible groups such as:

    # perf stat -e '{cycles,power/energy-cores/}' -v
    WARNING: group events cpu maps do not match, disabling group:
    anon group { power/energy-cores/, cycles }
    power/energy-cores/: 0
    cycles: 0-7

    - Fixes for 'perf probe': blacklist address checking, number of
    kretprobe instances, etc.

    - JIT processing improvements and fixes plus the addition of a 'perf
    test' entry for the java demangler.

    - Add support for synthesizing first/last level cache, TLB and remove
    access events from HW tracing in the auxtrace code, first to use is
    ARM SPE.

    - Vendor events updates and fixes, including for POWER9 and Intel.

    - Allow using ~/.perfconfig for removing the ',' separators in 'perf
    stat' output.

    - Opt-in support for libpfm4"

    * tag 'perf-tools-2020-06-02' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (120 commits)
    perf tools: Remove some duplicated includes
    perf symbols: Fix kernel maps for kcore and eBPF
    tools arch x86: Sync the msr-index.h copy with the kernel sources
    perf stat: Ensure group is defined on top of the same cpu mask
    perf libdw: Fix off-by 1 relative directory includes
    perf arm-spe: Support synthetic events
    perf auxtrace: Add four itrace options
    perf tools: Move arm-spe-pkt-decoder.h/c to the new dir
    perf test: Initialize memory in dwarf-unwind
    perf tests: Don't tail call optimize in unwind test
    tools compiler.h: Add attribute to disable tail calls
    perf build: Add a LIBPFM4=1 build test entry
    perf tools: Add optional support for libpfm4
    perf tools: Correct license on jsmn JSON parser
    perf jit: Fix inaccurate DWARF line table
    perf jvmti: Remove redundant jitdump line table entries
    perf build: Add NO_SDT=1 to the default set of build tests
    perf build: Add NO_LIBCRYPTO=1 to the default set of build tests
    perf build: Add NO_SYSCALL_TABLE=1 to the build tests
    perf build: Remove libaudit from the default feature checks
    ...

    Linus Torvalds
     

04 Jun, 2020

1 commit

  • Pull kvm updates from Paolo Bonzini:
    "ARM:
    - Move the arch-specific code into arch/arm64/kvm

    - Start the post-32bit cleanup

    - Cherry-pick a few non-invasive pre-NV patches

    x86:
    - Rework of TLB flushing

    - Rework of event injection, especially with respect to nested
    virtualization

    - Nested AMD event injection facelift, building on the rework of
    generic code and fixing a lot of corner cases

    - Nested AMD live migration support

    - Optimization for TSC deadline MSR writes and IPIs

    - Various cleanups

    - Asynchronous page fault cleanups (from tglx, common topic branch
    with tip tree)

    - Interrupt-based delivery of asynchronous "page ready" events (host
    side)

    - Hyper-V MSRs and hypercalls for guest debugging

    - VMX preemption timer fixes

    s390:
    - Cleanups

    Generic:
    - switch vCPU thread wakeup from swait to rcuwait

    The other architectures, and the guest side of the asynchronous page
    fault work, will come next week"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (256 commits)
    KVM: selftests: fix rdtsc() for vmx_tsc_adjust_test
    KVM: check userspace_addr for all memslots
    KVM: selftests: update hyperv_cpuid with SynDBG tests
    x86/kvm/hyper-v: Add support for synthetic debugger via hypercalls
    x86/kvm/hyper-v: enable hypercalls regardless of hypercall page
    x86/kvm/hyper-v: Add support for synthetic debugger interface
    x86/hyper-v: Add synthetic debugger definitions
    KVM: selftests: VMX preemption timer migration test
    KVM: nVMX: Fix VMX preemption timer migration
    x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit
    KVM: x86/pmu: Support full width counting
    KVM: x86/pmu: Tweak kvm_pmu_get_msr to pass 'struct msr_data' in
    KVM: x86: announce KVM_FEATURE_ASYNC_PF_INT
    KVM: x86: acknowledgment mechanism for async pf page ready notifications
    KVM: x86: interrupt based APF 'page ready' event delivery
    KVM: introduce kvm_read_guest_offset_cached()
    KVM: rename kvm_arch_can_inject_async_page_present() to kvm_arch_can_dequeue_async_page_present()
    KVM: x86: extend struct kvm_vcpu_pv_apf_data with token info
    Revert "KVM: async_pf: Fix #DF due to inject "Page not Present" and "Page Ready" exceptions simultaneously"
    KVM: VMX: Replace zero-length array with flexible-array
    ...

    Linus Torvalds
     

02 Jun, 2020

3 commits

  • To pick up the changes in:

    5cde265384ca ("perf/x86/rapl: Add AMD Fam17h RAPL support")

    Addressing this tools/perf build warning:

    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
    diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h

    With this one will be able to use these new AMD MSRs in filters, by
    name, e.g.:

    # perf trace -e msr:* --filter="msr==AMD_PKG_ENERGY_STATUS || msr==AMD_RAPL_POWER_UNIT"

    Just like it is now possible with other MSRs:

    [root@five ~]# uname -a
    Linux five 5.5.17-200.fc31.x86_64 #1 SMP Mon Apr 13 15:29:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    [root@five ~]# grep 'model name' -m1 /proc/cpuinfo
    model name : AMD Ryzen 5 3600X 6-Core Processor
    [root@five ~]#
    [root@five ~]# perf trace -e msr:*/max-stack=16/ --filter="msr==AMD_PERF_CTL" --max-events=2
    0.000 kworker/1:1-ev/2327824 msr:write_msr(msr: AMD_PERF_CTL, val: 2)
    do_trace_write_msr ([kernel.kallsyms])
    do_trace_write_msr ([kernel.kallsyms])
    [0xffffffffc01d71c3] ([acpi_cpufreq])
    [0] ([unknown])
    __cpufreq_driver_target ([kernel.kallsyms])
    od_dbs_update ([kernel.kallsyms])
    dbs_work_handler ([kernel.kallsyms])
    process_one_work ([kernel.kallsyms])
    worker_thread ([kernel.kallsyms])
    kthread ([kernel.kallsyms])
    ret_from_fork ([kernel.kallsyms])
    8.597 kworker/2:2-ev/2338099 msr:write_msr(msr: AMD_PERF_CTL, val: 2)
    do_trace_write_msr ([kernel.kallsyms])
    do_trace_write_msr ([kernel.kallsyms])
    [0] ([unknown])
    [0] ([unknown])
    __cpufreq_driver_target ([kernel.kallsyms])
    od_dbs_update ([kernel.kallsyms])
    dbs_work_handler ([kernel.kallsyms])
    process_one_work ([kernel.kallsyms])
    worker_thread ([kernel.kallsyms])
    kthread ([kernel.kallsyms])
    ret_from_fork ([kernel.kallsyms])
    [root@five ~]#

    Longer explanation with what happens in the perf build process,
    automatically after this is made in synch with the kernel sources:

    $ make -C tools/perf O=/tmp/build/perf install-bin

    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
    diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h

    make: Leaving directory '/home/acme/git/perf/tools/perf'
    $
    $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
    $
    $ diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
    --- tools/arch/x86/include/asm/msr-index.h 2020-06-02 10:46:36.217782288 -0300
    +++ arch/x86/include/asm/msr-index.h 2020-05-28 10:41:23.313794627 -0300
    @@ -301,6 +301,9 @@
    #define MSR_PP1_ENERGY_STATUS 0x00000641
    #define MSR_PP1_POLICY 0x00000642

    +#define MSR_AMD_PKG_ENERGY_STATUS 0xc001029b
    +#define MSR_AMD_RAPL_POWER_UNIT 0xc0010299
    +
    /* Config TDP MSRs */
    #define MSR_CONFIG_TDP_NOMINAL 0x00000648
    #define MSR_CONFIG_TDP_LEVEL_1 0x00000649
    $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
    $
    $ make -C tools/perf O=/tmp/build/perf install-bin

    CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
    LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
    LD /tmp/build/perf/trace/beauty/perf-in.o
    LD /tmp/build/perf/perf-in.o
    LINK /tmp/build/perf/perf

    make: Leaving directory '/home/acme/git/perf/tools/perf'
    $
    $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
    $ diff -u before after
    --- before 2020-06-02 10:47:08.486334348 -0300
    +++ after 2020-06-02 10:47:33.075008948 -0300
    @@ -286,6 +286,8 @@
    [0xc0010240 - x86_AMD_V_KVM_MSRs_offset] = "F15H_NB_PERF_CTL",
    [0xc0010241 - x86_AMD_V_KVM_MSRs_offset] = "F15H_NB_PERF_CTR",
    [0xc0010280 - x86_AMD_V_KVM_MSRs_offset] = "F15H_PTSC",
    + [0xc0010299 - x86_AMD_V_KVM_MSRs_offset] = "AMD_RAPL_POWER_UNIT",
    + [0xc001029b - x86_AMD_V_KVM_MSRs_offset] = "AMD_PKG_ENERGY_STATUS",
    [0xc00102f0 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN_CTL",
    [0xc00102f1 - x86_AMD_V_KVM_MSRs_offset] = "AMD_PPIN",
    };
    $

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Cc: Wang Nan
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Pull objtool updates from Ingo Molnar:
    "There are a lot of objtool changes in this cycle, all across the map:

    - Speed up objtool significantly, especially when there are large
    number of sections

    - Improve objtool's understanding of special instructions such as
    IRET, to reduce the number of annotations required

    - Implement 'noinstr' validation

    - Do baby steps for non-x86 objtool use

    - Simplify/fix retpoline decoding

    - Add vmlinux validation

    - Improve documentation

    - Fix various bugs and apply smaller cleanups"

    * tag 'objtool-core-2020-06-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (54 commits)
    objtool: Enable compilation of objtool for all architectures
    objtool: Move struct objtool_file into arch-independent header
    objtool: Exit successfully when requesting help
    objtool: Add check_kcov_mode() to the uaccess safelist
    samples/ftrace: Fix asm function ELF annotations
    objtool: optimize add_dead_ends for split sections
    objtool: use gelf_getsymshndx to handle >64k sections
    objtool: Allow no-op CFI ops in alternatives
    x86/retpoline: Fix retpoline unwind
    x86: Change {JMP,CALL}_NOSPEC argument
    x86: Simplify retpoline declaration
    x86/speculation: Change FILL_RETURN_BUFFER to work with objtool
    objtool: Add support for intra-function calls
    objtool: Move the IRET hack into the arch decoder
    objtool: Remove INSN_STACK
    objtool: Make handle_insn_ops() unconditional
    objtool: Rework allocating stack_ops on decode
    objtool: UNWIND_HINT_RET_OFFSET should not check registers
    objtool: is_fentry_call() crashes if call has no destination
    x86,smap: Fix smap_{save,restore}() alternatives
    ...

    Linus Torvalds
     
  • sh5 never became a product and has probably never really worked.

    Remove it by recursively deleting all associated Kconfig options
    and all corresponding files.

    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Rich Felker

    Arnd Bergmann
     

01 Jun, 2020

1 commit


26 May, 2020

1 commit

  • Revert

    45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")

    and add a comment to discourage someone else from making the same
    mistake again.

    It turns out that some user code fails to compile if __X32_SYSCALL_BIT
    is unsigned long. See, for example [1] below.

    [ bp: Massage and do the same thing in the respective tools/ header. ]

    Fixes: 45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")
    Reported-by: Thorsten Glaser
    Signed-off-by: Andy Lutomirski
    Signed-off-by: Borislav Petkov
    Cc: stable@kernel.org
    Link: [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294
    Link: https://lkml.kernel.org/r/92e55442b744a5951fdc9cfee10badd0a5f7f828.1588983892.git.luto@kernel.org

    Andy Lutomirski
     

22 Apr, 2020

2 commits

  • The SAVE/RESTORE hints are now unused; remove them.

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Miroslav Benes
    Reviewed-by: Alexandre Chartre
    Acked-by: Josh Poimboeuf
    Link: https://lkml.kernel.org/r/20200416115118.926738768@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Normally objtool ensures a function keeps the stack layout invariant.
    But there is a useful exception, it is possible to stuff the return
    stack in order to 'inject' a 'call':

    push $fun
    ret

    In this case the invariant mentioned above is violated.

    Add an objtool HINT to annotate this and allow a function exit with a
    modified stack frame.

    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: Miroslav Benes
    Reviewed-by: Alexandre Chartre
    Acked-by: Josh Poimboeuf
    Link: https://lkml.kernel.org/r/20200416115118.690601403@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

14 Apr, 2020

2 commits

  • To pick up the changes from:

    077168e241ec ("x86/mce/amd: Add PPIN support for AMD MCE")
    753039ef8b2f ("x86/cpu/amd: Call init_amd_zn() om Family 19h processors too")
    6650cdd9a8cc ("x86/split_lock: Enable split lock detection by kernel")

    These don't cause any changes in tooling, just silences 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
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Borislav Petkov
    Cc: Kim Phillips
    Cc: Peter Zijlstra (Intel)
    Cc: Wei Huang
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To pick up the changes in:

    6650cdd9a8cc ("x86/split_lock: Enable split lock detection by kernel")

    Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
    diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h

    Which causes these changes in tooling:

    $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
    $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
    $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
    $ diff -u before after
    --- before 2020-04-01 12:11:14.789344795 -0300
    +++ after 2020-04-01 12:11:56.907798879 -0300
    @@ -10,6 +10,7 @@
    [0x00000029] = "KNC_EVNTSEL1",
    [0x0000002a] = "IA32_EBL_CR_POWERON",
    [0x0000002c] = "EBC_FREQUENCY_ID",
    + [0x00000033] = "TEST_CTRL",
    [0x00000034] = "SMI_COUNT",
    [0x0000003a] = "IA32_FEAT_CTL",
    [0x0000003b] = "IA32_TSC_ADJUST",
    @@ -27,6 +28,7 @@
    [0x000000c2] = "IA32_PERFCTR1",
    [0x000000cd] = "FSB_FREQ",
    [0x000000ce] = "PLATFORM_INFO",
    + [0x000000cf] = "IA32_CORE_CAPS",
    [0x000000e2] = "PKG_CST_CONFIG_CONTROL",
    [0x000000e7] = "IA32_MPERF",
    [0x000000e8] = "IA32_APERF",
    $

    $ make -C tools/perf O=/tmp/build/perf install-bin

    CC /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
    LD /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
    LD /tmp/build/perf/trace/beauty/perf-in.o
    LD /tmp/build/perf/perf-in.o
    LINK /tmp/build/perf/perf

    Now one can do:

    perf trace -e msr:* --filter=msr==IA32_CORE_CAPS

    or:

    perf trace -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'

    And see only those MSRs being accessed via:

    # perf trace -v -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
    New filter for msr:read_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
    New filter for msr:write_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
    New filter for msr:rdpmc: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra (Intel)
    Link: https://lore.kernel.org/lkml/20200401153325.GC12534@kernel.org/
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

03 Apr, 2020

1 commit

  • Pull kvm updates from Paolo Bonzini:
    "ARM:
    - GICv4.1 support

    - 32bit host removal

    PPC:
    - secure (encrypted) using under the Protected Execution Framework
    ultravisor

    s390:
    - allow disabling GISA (hardware interrupt injection) and protected
    VMs/ultravisor support.

    x86:
    - New dirty bitmap flag that sets all bits in the bitmap when dirty
    page logging is enabled; this is faster because it doesn't require
    bulk modification of the page tables.

    - Initial work on making nested SVM event injection more similar to
    VMX, and less buggy.

    - Various cleanups to MMU code (though the big ones and related
    optimizations were delayed to 5.8). Instead of using cr3 in
    function names which occasionally means eptp, KVM too has
    standardized on "pgd".

    - A large refactoring of CPUID features, which now use an array that
    parallels the core x86_features.

    - Some removal of pointer chasing from kvm_x86_ops, which will also
    be switched to static calls as soon as they are available.

    - New Tigerlake CPUID features.

    - More bugfixes, optimizations and cleanups.

    Generic:
    - selftests: cleanups, new MMU notifier stress test, steal-time test

    - CSV output for kvm_stat"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (277 commits)
    x86/kvm: fix a missing-prototypes "vmread_error"
    KVM: x86: Fix BUILD_BUG() in __cpuid_entry_get_reg() w/ CONFIG_UBSAN=y
    KVM: VMX: Add a trampoline to fix VMREAD error handling
    KVM: SVM: Annotate svm_x86_ops as __initdata
    KVM: VMX: Annotate vmx_x86_ops as __initdata
    KVM: x86: Drop __exit from kvm_x86_ops' hardware_unsetup()
    KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection
    KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes
    KVM: VMX: Configure runtime hooks using vmx_x86_ops
    KVM: VMX: Move hardware_setup() definition below vmx_x86_ops
    KVM: x86: Move init-only kvm_x86_ops to separate struct
    KVM: Pass kvm_init()'s opaque param to additional arch funcs
    s390/gmap: return proper error code on ksm unsharing
    KVM: selftests: Fix cosmetic copy-paste error in vm_mem_region_move()
    KVM: Fix out of range accesses to memslots
    KVM: X86: Micro-optimize IPI fastpath delay
    KVM: X86: Delay read msr data iff writes ICR MSR
    KVM: PPC: Book3S HV: Add a capability for enabling secure guests
    KVM: arm64: GICv4.1: Expose HW-based SGIs in debugfs
    KVM: arm64: GICv4.1: Allow non-trapping WFI when using HW SGIs
    ...

    Linus Torvalds