Re: [Patch v3 11/22] perf/x86/intel: Allocate arch-PEBS buffer and initialize PEBS_BASE MSR

Peter Zijlstra
2025-04-15T13:48:35Z

On Tue, Apr 15, 2025 at 11:44:17AM +0000, Dapeng Mi wrote:

> +void fini_arch_pebs_buf_on_cpu(int cpu)
> +{
> + if (!x86_pmu.arch_pebs)
> + return;
> +
> + release_pebs_buffer(cpu);
> + wrmsr_on_cpu(cpu, MSR_IA32_PEBS_BASE, 0, 0);
> +}

So first we free the pages, and then we tell the hardware to not write
into them again.

What could possibly go wrong :-)