[PATCH 40/45] powerpc, irq: Use GFP_ATOMIC allocations in atomic context

Michael Ellerman michael at ellerman.id.au
Tue Jun 25 12:08:42 EST 2013


On Sun, Jun 23, 2013 at 07:17:00PM +0530, Srivatsa S. Bhat wrote:
> The function migrate_irqs() is called with interrupts disabled
> and hence its not safe to do GFP_KERNEL allocations inside it,
> because they can sleep. So change the gfp mask to GFP_ATOMIC.

OK so it gets there via:
  __stop_machine()
    take_cpu_down()
      __cpu_disable()
        smp_ops->cpu_disable()
          generic_cpu_disable()
            migrate_irqs()

> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index ea185e0..ca39bac 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -412,7 +412,7 @@ void migrate_irqs(void)
>  	cpumask_var_t mask;
>  	const struct cpumask *map = cpu_online_mask;
>  
> -	alloc_cpumask_var(&mask, GFP_KERNEL);
> +	alloc_cpumask_var(&mask, GFP_ATOMIC);

We're not checking for allocation failure, which we should be.

But this code is only used on powermac and 85xx, so it should probably
just be a TODO to fix this up to handle the failure.

cheers


More information about the Linuxppc-dev mailing list