From: Thomas Gleixner <tglx@linutronix.de>
To: Borislav Petkov <bp@alien8.de>
Cc: Jiang Liu <jiang.liu@linux.intel.com>,
linux-tip-commits@vger.kernel.org, matthias.bgg@gmail.com,
tony.luck@intel.com, benh@kernel.crashing.org,
linux-kernel@vger.kernel.org, hpa@zytor.com,
grant.likely@linaro.org, wangyijing@huawei.com,
marc.zyngier@arm.com, bhelgaas@google.com,
yingjoe.chen@mediatek.com, mingo@kernel.org
Subject: Re: [tip:irq/irqdomain] irqdomain: Introduce helper function irq_domain_add_hierarchy()
Date: Sat, 29 Nov 2014 21:42:30 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1411292112390.3961@nanos> (raw)
In-Reply-To: <20141129125319.GA6491@pd.tnic>
On Sat, 29 Nov 2014, Borislav Petkov wrote:
> So I'm seeing the lockdep splat below really early on an IVB laptop.
>
> Basically we're not supposed to do __GFP_FS allocations with IRQs off:
>
> 2737 /* We're only interested __GFP_FS allocations for now */
> 2738 if (!(gfp_mask & __GFP_FS))
> 2739 return;
> 2740
> 2741 /*
> 2742 * Oi! Can't be having __GFP_FS allocations with IRQs disabled.
> 2743 */
> 2744 if (DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))) <--- HERE!
> 2745 return;
> 2746
> 2747 mark_held_locks(curr, RECLAIM_FS);
> 2748 }
>
> Now, AFAICT, enable_IR_x2apic() disables interrupts and the whole init
> is done with IRQs off but down that path intel_setup_irq_remapping()
> calls irq_domain_add_hierarchy() and it does by default GFP_KERNEL
> allocations.
>
> The obvious fix is this and the machine boots fine with it. I'm not sure
> it is kosher though so I rather run it by people first:
>
> ---
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 7fac311057b8..c21a003b996a 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -46,14 +46,18 @@ struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
> void *host_data)
> {
> struct irq_domain *domain;
> + gfp_t gfp_flags = GFP_KERNEL;
> +
> + if (irqs_disabled())
> + gfp_flags = GFP_NOFS;
We want to use GFP_ATOMIC for that, but I really hate to do so. There
is no reason except for the early boot stage to call into this code
with interrupts disabled. And there we are covered by gfp_allowed_mask,
so that a GFP_KERNEL allocation can succeed.
I have no idea, why enable_IR_x2apic() has been bolted into
smp_prepare_cpus(). Probably just because.
There is no reason WHY this cannot be done in the early irq setup path
(at least nowadays with the allocators being available early), but
that is another area which needs some care and cleanup, but definitely
too late before the 3.19 merge window opens.
So we have to bite the bullet and apply something like this along with
a big fat comment WHY we are doing so and I'm tempted to wrap this
into a #ifdef CONFIG_X86 so that noone else thinks that calling this
code with interrupts disabled - except for the early boot stage - is a
brilliant idea.
Thanks,
tglx
next prev parent reply other threads:[~2014-11-29 20:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 14:23 [Patch V2 0/9] Refine generic/PCI MSI irqodmian interfaces Jiang Liu
2014-11-15 14:23 ` [Patch V2 1/9] PCI, MSI: Fix errors caused by commit e5f1a59c4e12 Jiang Liu
2014-11-15 14:24 ` [Patch V2 2/9] irqdomain: Use consistent prototype for irq_domain_free_irqs_* Jiang Liu
2014-11-15 14:24 ` [Patch V2 3/9] irqdomain: Implement a method to automatically call parent domain's alloc/free Jiang Liu
2014-11-23 18:11 ` [tip:irq/irqdomain] irqdomain: Implement a method to automatically call parent domains alloc/free tip-bot for Jiang Liu
2014-11-15 14:24 ` [Patch V2 4/9] irqdomain: Introduce helper function irq_domain_add_hierarchy() Jiang Liu
2014-11-23 18:11 ` [tip:irq/irqdomain] " tip-bot for Jiang Liu
2014-11-29 12:53 ` Borislav Petkov
2014-11-29 14:29 ` Jiang Liu
2014-11-29 14:56 ` Borislav Petkov
2014-11-29 15:21 ` Jiang Liu
2014-11-29 15:37 ` Borislav Petkov
2014-11-29 20:42 ` Thomas Gleixner [this message]
2014-11-30 12:37 ` [PATCH] irqdomain: Correct early allocation of irq domains with IRQs off Borislav Petkov
2014-12-01 9:45 ` [tip:x86/apic] " tip-bot for Borislav Petkov
2014-12-01 2:20 ` [tip:irq/irqdomain] irqdomain: Introduce helper function irq_domain_add_hierarchy() Jiang Liu
2014-11-15 14:24 ` [Patch V2 5/9] PCI, MSI: Introduce helpers to hide struct msi_desc implementation details Jiang Liu
2014-11-23 18:08 ` [tip:irq/irqdomain] PCI/MSI: " tip-bot for Jiang Liu
2014-11-15 14:24 ` [Patch V2 6/9] genirq: Introduce msi_domain_{alloc|free}_irqs() Jiang Liu
2014-11-23 18:13 ` [tip:irq/irqdomain] genirq: Introduce msi_domain_alloc/free_irqs( ) tip-bot for Jiang Liu
2014-11-15 14:24 ` [Patch V2 7/9] genirq: Provide default callbacks for msi_domain_ops Jiang Liu
2014-11-23 18:13 ` [tip:irq/irqdomain] " tip-bot for Jiang Liu
2014-11-15 14:24 ` [Patch V2 8/9] PCI, MSI: Refine irqdomain interfaces to simplify its usage Jiang Liu
2014-11-15 14:24 ` [Patch V2 9/9] PCI, MSI: Provide mechanism to alloc/free MSI/MSIX interrupt from irqdomain Jiang Liu
2014-11-23 18:14 ` [tip:irq/irqdomain] PCI/MSI: Provide mechanism to alloc/free MSI/ MSIX " tip-bot for Jiang Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.11.1411292112390.3961@nanos \
--to=tglx@linutronix.de \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=grant.likely@linaro.org \
--cc=hpa@zytor.com \
--cc=jiang.liu@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=mingo@kernel.org \
--cc=tony.luck@intel.com \
--cc=wangyijing@huawei.com \
--cc=yingjoe.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®