Re: [PATCH v3] s390/cpum_cf: Handle CPU hotplug via prepare/dead callbacks

Heiko Carstens <[email protected]>
Newsgroups org.kernel.vger.linux-s390
Message-ID <[email protected]>
On Tue, Aug 11, 2026 at 03:39:01PM +0200, Thomas Richter wrote:
> The command 'perf stat -e cycles -- <command>' crashes the kernel
> when CPUs are hotplug added during that run.
...
> Fixes: 9b9cf3c77e7e ("s390/cpum_cf: rework PER_CPU_DEFINE of struct cpu_cf_events")
> Cc: <[email protected]> # v6.5+
> Signed-off-by: Thomas Richter <[email protected]>
> Suggested-by: Heiko Carstens <[email protected]>
> Suggested-by: Christian Borntraeger <[email protected]>
> ---
>  arch/s390/kernel/perf_cpum_cf.c | 215 +++++++++++++++++++++-----------
>  1 file changed, 142 insertions(+), 73 deletions(-)
...
> @@ -167,12 +170,14 @@ static void cpum_cf_reset_cpu(void *flags)
>  }
>  
>  /* Free per CPU data when the last event is removed. */
> -static void cpum_cf_free_root(void)
> +static void cpum_cf_free_root(unsigned int num)
>  {
> -	if (!refcount_dec_and_test(&cpu_cf_root.refcnt))
> +	struct cpu_cf_ptr __percpu *p = cpu_cf_root.cfptr;
> +
> +	if (!refcount_sub_and_test(num, &cpu_cf_root.refcnt))
>  		return;
> -	free_percpu(cpu_cf_root.cfptr);
>  	cpu_cf_root.cfptr = NULL;
> +	free_percpu(p);

This appears to be an unrelated fix. But anyway:

Acked-by: Heiko Carstens <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.