Re: [PATCH 3/6] perf/x86/intel/pt: Stop tracing at syscore shutdown
From: Adrian Hunter
Date: Mon Nov 02 2026 - 13:44:55 EST
On 02/11/2026 19:45, Andi Kleen wrote:
> On Mon, Nov 02, 2026 at 06:27:30PM +0200, Adrian Hunter wrote:
>> On 02/11/2026 18:15, Andi Kleen wrote:
>>>> +
>>>> +/*
>>>> + * Tracing must not continue into a kexec'ed kernel, which may reuse the
>>>> + * trace buffer memory, so stop tracing on all CPUs and prevent it from
>>>> + * being started again. Events are left in place, but record nothing more.
>>>> + */
>>>> +static void pt_syscore_shutdown(void *data)
>>>> +{
>>>> + WRITE_ONCE(pt_shutdown, true);
>>>> + on_each_cpu(pt_shutdown_cpu, NULL, 1);
>>>
>>> I don't think adding more and more broadcast NMIs to the panic path
>>> is a good idea. It's always a very big hammer and a risky operation
>>> that risks breaking the actual dump. panic reallhy needs to be
>>> simple and reliable, and this is the total opposite.
>>
>> Is pt_syscore_shutdown() called on a panic path? I can't find a way.
>
> It's called from kexec which can be called from panic.
Normal kexec goes via kernel_kexec(), which calls syscore_shutdown().
Panic has its own path to machine_kexec(): __crash_kexec() ->
machine_crash_shutdown() -> machine_kexec(), which doesn't call
syscore_shutdown(). On that path PT is already stopped by
cpu_emergency_stop_pt().