Re: PROBLEM: kernel crashes when running xfsdump since ~6.4

From: Nick Bowler
Date: Wed Jun 26 2024 - 09:34:56 EST


On 2024-06-26 06:51, Uladzislau Rezki wrote:
[...]
> Thank you for pointing this. Below is updated version with extra comment:

I checked that I can still reproduce the problem on 6.10-rc5 and with
this patch applied on top, xfsdump doesn't crash anymore.

> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 45e1506d58c3..03b82fb8ecd3 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2542,7 +2542,15 @@ static DEFINE_PER_CPU(struct vmap_block_queue, vmap_block_queue);
> static struct xarray *
> addr_to_vb_xa(unsigned long addr)
> {
> - int index = (addr / VMAP_BLOCK_SIZE) % num_possible_cpus();
> + int index = (addr / VMAP_BLOCK_SIZE) % nr_cpu_ids;
> +
> + /*
> + * Please note, nr_cpu_ids points on a highest set
> + * possible bit, i.e. we never invoke cpumask_next()
> + * if an index points on it which is nr_cpu_ids - 1.
> + */
> + if (!cpu_possible(index))
> + index = cpumask_next(index, cpu_possible_mask);
>
> return &per_cpu(vmap_block_queue, index).vmap_blocks;
> }

Thanks,
Nick