diff mbox

irqdomain breaks ap4 boot

Message ID 20120809042844.GF1614@linux-sh.org (mailing list archive)
State Superseded
Headers show

Commit Message

Paul Mundt Aug. 9, 2012, 4:28 a.m. UTC
On Fri, Aug 03, 2012 at 02:00:40PM +0900, Paul Mundt wrote:
> On Thu, Aug 02, 2012 at 02:50:26AM -0700, kuninori.morimoto.gx@renesas.com wrote:
> > 
> > Hi Paul
> > 
> > I noticed that sh irqdomain commit breaks mackerel boot.
> > below is "git bisect" result and kernel log
> > 
> > ------- log -----------------------------
> > ...
> > NR_IRQS:16 nr_irqs:16 16
> > intc: Registered controller 'sh7372-intca' with 108 IRQs
> > intc: Registered controller 'sh7372-intca-irq-lo' with 16 IRQs
> > intc: can't get irq_desc for 0
> > intc: can't get irq_desc for 1
> > intc: can't get irq_desc for 2
> > intc: can't get irq_desc for 3
> > intc: can't get irq_desc for 4
> > intc: can't get irq_desc for 5
> > intc: can't get irq_desc for 6
> > intc: can't get irq_desc for 7
> > intc: can't get irq_desc for 8
> > intc: can't get irq_desc for 9
> > intc: can't get irq_desc for 10
> > intc: can't get irq_desc for 11
> > intc: can't get irq_desc for 12
> > intc: can't get irq_desc for 13
> > intc: can't get irq_desc for 14
> > intc: can't get irq_desc for 15
> > intc: Registered controller 'sh7372-intca-irq-hi' with 16 IRQs
> 
> Great, it's ARM's silly NR_IRQS_LEGACY getting in the way, and we don't
> seem to have any ability to simply not pre-allocate IRQs given that ARM's
> machine_desc lamely doesn't allow 0 as a valid nr_irqs initializer even
> on sparseirq configurations.
> 
> It's not entirely obvious why you are tripping up on this though, as we
> should already gracefully handle the -EEXIST case.
> 
> I'll have a bit of a think over how to fix it properly.

Ok, it's fixed now. We were previously handling the -EEXIST case but were
getting tripped up by moving the irq_desc allocation in to the irq domain
code and not handling the failure case for pre-allocated vectors with
sparseirq.

I'll send this off for -rc2:

---

commit 1026023705b0baa2b37df2a0d1da0022fc7b985e
Author: Paul Mundt <lethal@linux-sh.org>
Date:   Thu Aug 9 12:59:40 2012 +0900

    sh: intc: Handle domain association for sparseirq pre-allocated vectors.
    
    Presently it's assumed that the irqdomain code handles the irq_desc
    allocation for us, but this isn't necessarily the case when we've
    pre-allocated IRQs via sparseirq. Previously we had a -EEXIST check in
    the code that attempted to trap these cases and simply update them
    in-place, but this behaviour was inadvertently lost in the transition to
    irqdomains.
    
    This simply restores the previous behaviour, first attempting to let the
    irqdomain core fetch the allocation for us, and falling back to an
    in-place domain association in the extant IRQ case. Fixes up regressions
    on platforms that pre-allocate legacy IRQs (specifically ARM-based
    SH-Mobile platforms, as SH stopped pre-allocating vectors some time ago).
    
    Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kuninori Morimoto Aug. 9, 2012, 4:53 a.m. UTC | #1
Hi Paul

Thank you for your hard work

> commit 1026023705b0baa2b37df2a0d1da0022fc7b985e
> Author: Paul Mundt <lethal@linux-sh.org>
> Date:   Thu Aug 9 12:59:40 2012 +0900
> 
>     sh: intc: Handle domain association for sparseirq pre-allocated vectors.
>     
>     Presently it's assumed that the irqdomain code handles the irq_desc
>     allocation for us, but this isn't necessarily the case when we've
>     pre-allocated IRQs via sparseirq. Previously we had a -EEXIST check in
>     the code that attempted to trap these cases and simply update them
>     in-place, but this behaviour was inadvertently lost in the transition to
>     irqdomains.
>     
>     This simply restores the previous behaviour, first attempting to let the
>     irqdomain core fetch the allocation for us, and falling back to an
>     in-place domain association in the extant IRQ case. Fixes up regressions
>     on platforms that pre-allocate legacy IRQs (specifically ARM-based
>     SH-Mobile platforms, as SH stopped pre-allocating vectors some time ago).
>     
>     Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>     Signed-off-by: Paul Mundt <lethal@linux-sh.org>

This patch solved mackerel board crush bug on linus/master


Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Aug. 10, 2012, 6:10 a.m. UTC | #2
Hi Paul

> >     sh: intc: Handle domain association for sparseirq pre-allocated vectors.
> >     
> >     Presently it's assumed that the irqdomain code handles the irq_desc
> >     allocation for us, but this isn't necessarily the case when we've
> >     pre-allocated IRQs via sparseirq. Previously we had a -EEXIST check in
> >     the code that attempted to trap these cases and simply update them
> >     in-place, but this behaviour was inadvertently lost in the transition to
> >     irqdomains.
> >     
> >     This simply restores the previous behaviour, first attempting to let the
> >     irqdomain core fetch the allocation for us, and falling back to an
> >     in-place domain association in the extant IRQ case. Fixes up regressions
> >     on platforms that pre-allocate legacy IRQs (specifically ARM-based
> >     SH-Mobile platforms, as SH stopped pre-allocating vectors some time ago).
> >     
> >     Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >     Signed-off-by: Paul Mundt <lethal@linux-sh.org>
> 
> This patch solved mackerel board crush bug on linus/master

ecovec/armadillo/marzen board were OK on this patch,
but kzm9g board still has problem.
I'm using "linus/master + paul/sh-latest"

================= kernel log ============================-
....
Preemptible hierarchical RCU implementation.                                    
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.                    
NR_IRQS:16 nr_irqs:16 16                                                        
intc: Registered controller 'sh73a0-intcs' with 77 IRQs                         
intc: Registered controller 'sh73a0-intca-irq-pins' with 32 IRQs                
------------[ cut here ]------------                                            
WARNING: at /opt/usr/src/WORK/morimoto/gitlinux/linux-2.6/kernel/irq/irqdomain.)
error: irq_desc already associated; irq=552 hwirq=0x228                         
Modules linked in:                                                              
Backtrace:                                                                      
[<c0012358>] (dump_backtrace+0x0/0x10c) from [<c02e7e1c>] (dump_stack+0x18/0x1c)
 r6:c00655ec r5:00000009 r4:c03e9ed8 r3:c0404908                                
[<c02e7e04>] (dump_stack+0x0/0x1c) from [<c001cecc>] (warn_slowpath_common+0x54)
[<c001ce78>] (warn_slowpath_common+0x0/0x6c) from [<c001cf88>] (warn_slowpath_f)
 r8:00000228 r7:c03de574 r6:00000228 r5:00000000 r4:de8029c0                    
r3:00000009                                                                     
[<c001cf50>] (warn_slowpath_fmt+0x0/0x40) from [<c00655ec>] (irq_domain_associa)
 r3:00000228 r2:c037fb49                                                        
[<c006557c>] (irq_domain_associate_many+0x0/0x1b8) from [<c03d48a4>] (register_)
[<c03d4360>] (register_intc_controller+0x0/0x984) from [<c03c6e68>] (sh73a0_ini)
[<c03c6e04>] (sh73a0_init_irq+0x0/0x1c0) from [<c03c261c>] (init_IRQ+0x1c/0x24) 
 r7:c08a90c0 r6:c03dd774 r5:c03e8000 r4:c041ba80                                
[<c03c2600>] (init_IRQ+0x0/0x24) from [<c03c1744>] (start_kernel+0x19c/0x2a0)   
[<c03c15a8>] (start_kernel+0x0/0x2a0) from [<41008040>] (0x41008040)            
 r7:c03f3b4c r6:c03dd770 r5:c03f047c r4:10c5387d                                
---[ end trace 1b75b31a2719ed1c ]---                                            
intc: domain association failure                        

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 2374468..32c26d7 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -324,8 +324,16 @@  int __init register_intc_controller(struct intc_desc *desc)
 
 		res = irq_create_identity_mapping(d->domain, irq);
 		if (unlikely(res)) {
-			pr_err("can't get irq_desc for %d\n", irq);
-			continue;
+			if (res == -EEXIST) {
+				res = irq_domain_associate(d->domain, irq, irq);
+				if (unlikely(res)) {
+					pr_err("domain association failure\n");
+					continue;
+				}
+			} else {
+				pr_err("can't identity map IRQ %d\n", irq);
+				continue;
+			}
 		}
 
 		intc_irq_xlate_set(irq, vect->enum_id, d);
@@ -345,8 +353,19 @@  int __init register_intc_controller(struct intc_desc *desc)
 			 */
 			res = irq_create_identity_mapping(d->domain, irq2);
 			if (unlikely(res)) {
-				pr_err("can't get irq_desc for %d\n", irq2);
-				continue;
+				if (res == -EEXIST) {
+					res = irq_domain_associate(d->domain,
+								   irq, irq);
+					if (unlikely(res)) {
+						pr_err("domain association "
+						       "failure\n");
+						continue;
+					}
+				} else {
+					pr_err("can't identity map IRQ %d\n",
+					       irq);
+					continue;
+				}
 			}
 
 			vect2->enum_id = 0;