Message ID | 20130623134657.19094.93687.stgit@srivatsabhat.in.ibm.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2013-06-25 at 12:08 +1000, Michael Ellerman wrote: > 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. And what can we do if they fail ? Cheers, Ben. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jun 25, 2013 at 12:13:04PM +1000, Benjamin Herrenschmidt wrote: > On Tue, 2013-06-25 at 12:08 +1000, Michael Ellerman wrote: > > 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. > > And what can we do if they fail ? Fail up the chain and not unplug the CPU presumably. cheers -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2013-06-25 at 12:58 +1000, Michael Ellerman wrote: > On Tue, Jun 25, 2013 at 12:13:04PM +1000, Benjamin Herrenschmidt wrote: > > On Tue, 2013-06-25 at 12:08 +1000, Michael Ellerman wrote: > > > 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. > > > > And what can we do if they fail ? > > Fail up the chain and not unplug the CPU presumably. BTW. Isn't Srivatsa series removing the need to stop_machine() for unplug ? That should mean we should be able to use GFP_KERNEL no ? Cheers, Ben. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 06/25/2013 08:43 AM, Benjamin Herrenschmidt wrote: > On Tue, 2013-06-25 at 12:58 +1000, Michael Ellerman wrote: >> On Tue, Jun 25, 2013 at 12:13:04PM +1000, Benjamin Herrenschmidt wrote: >>> On Tue, 2013-06-25 at 12:08 +1000, Michael Ellerman wrote: >>>> 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. >>> >>> And what can we do if they fail ? >> >> Fail up the chain and not unplug the CPU presumably. > > BTW. Isn't Srivatsa series removing the need to stop_machine() for > unplug ? Yes. That should mean we should be able to use GFP_KERNEL no ? No, because whatever code was being executed in stop_machine() context would still be executed with interrupts disabled. So allocations that can sleep would continue to be forbidden in this path. In the CPU unplug sequence, the CPU_DYING notifications (and the surrounding code) is guaranteed to be run: a. _on_ the CPU going offline b. with interrupts disabled on that CPU. My patchset will retain these guarantees even after removing stop_machine(). And these are required for the correct execution of the code in this path, since they rely on these semantics. So I guess I'll retain the patch as it is. Thank you! Regards, Srivatsa S. Bhat -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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); for_each_irq_desc(irq, desc) { struct irq_data *data;
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. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Ian Munsie <imunsie@au1.ibm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Michael Ellerman <michael@ellerman.id.au> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> --- arch/powerpc/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html