]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf/x86/intel: Ensure LBRs are disabled when a CPU is starting
authorSean Christopherson <seanjc@google.com>
Fri, 31 Jan 2025 01:07:21 +0000 (17:07 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 12:50:01 +0000 (13:50 +0100)
commitd00438789b496e938aabbaa9efea927b32a9940e
tree547846415cacf7cf8ed3b2086b73cf19fb341220
parent0105b41790675457c79ea4f5721905526709daf8
perf/x86/intel: Ensure LBRs are disabled when a CPU is starting

commit c631a2de7ae48d50434bdc205d901423f8577c65 upstream.

Explicitly clear DEBUGCTL.LBR when a CPU is starting, prior to purging the
LBR MSRs themselves, as at least one system has been found to transfer
control to the kernel with LBRs enabled (it's unclear whether it's a BIOS
flaw or a CPU goof).  Because the kernel preserves the original DEBUGCTL,
even when toggling LBRs, leaving DEBUGCTL.LBR as is results in running
with LBRs enabled at all times.

Closes: https://lore.kernel.org/all/c9d8269bff69f6359731d758e3b1135dedd7cc61.camel@redhat.com
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20250131010721.470503-1-seanjc@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/events/intel/core.c
arch/x86/include/asm/msr-index.h