Skip to contentSkip to conversation

Compile-time bug, and problem with PPC440 ethernet

Xenomai-core Steven A. Falco 2 participants 9 messages Jun 16, 2008 – Jun 26, 2008 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I am building kernel 2.6.25.4 from DENX with Xenomai 2.4.4 for PPC440EPx (sequoia development board).

The kernel tries to use DHCP to obtain network settings. With IPIPE disabled, this works perfectly. However, when I enable IPIPE, the board sends packets ok, but does not receive packets - I can see the DHCP with a sniffer, but the development board does not receive them.

Also, in order to disable IPIPE, I had to patch kernel/time/tick-common.c around line 168. It is missing an ifdef:

kernel/time/tick-common.c +2 -0
index 58bfacf..3a735b8 100644
@@ -163,9 +163,11 @@ static void tick_setup_device(struct tick_device *td,
 
        td->evtdev = newdev;
 
+#ifdef CONFIG_IPIPE
        /* I-pipe: derive global tick IRQ from CPU 0 */
        if (cpu == 0)
                ipipe_update_tick_evtdev(newdev);
+#endif
 
        /*
         * When the device is not per cpu, pin the interrupt to the

If anyone has suggestions as to why IPIPE is blocking received ethernet packets, I'd appreciate it.

Steve

#1 lore raw

A bit more info: Interrupt numbers are 0x15 (txeob) and 0x16 (rxeob). I've added some printk, and at the point where the DHCP message is sent out, I get:

DHCP: sending class identifier "hydra_temp"
stalled stage <- printed in __ipipe_walk_pipeline
(see below)
__ipipe_grab_irq 15 <- printed at the beginning of
__ipipe_grab_irq
ready to walk 15 <- printed at the finalize:, before
__ipipe_walk_pipeline is called
stalled stage <- printed in __ipipe_walk_pipeline
(see below)
__ipipe_grab_irq 16 <- printed at the beginning of
__ipipe_grab_irq
ready to walk 16 <- printed at the finalize:, before
__ipipe_walk_pipeline is called
stalled stage <- see below
stalled stage <- etc
ipipe_cpudom_var != 0
next_domain == this_domain
stalled stage

So, while I don't pretend to understand this yet, it looks like the interrupts are coming into ipipe, but perhaps not getting delivered for some reason?

Steve

void __ipipe_walk_pipeline(struct list_head *pos)

{
    struct ipipe_domain *this_domain = ipipe_current_domain, *next_domain;

    while (pos != &__ipipe_pipeline) {

        next_domain = list_entry(pos, struct ipipe_domain, p_link);

        if (test_bit(IPIPE_STALL_FLAG, &ipipe_cpudom_var(next_domain,
status))) {
            printk("stalled stage\n");
            break;    /* Stalled stage -- do not go further. */
        }

        if (ipipe_cpudom_var(next_domain, irqpend_himask) != 0) {
            printk("ipipe_cpudom_var != 0\n");

            if (next_domain == this_domain) {
                printk("next_domain == this_domain\n");
                __ipipe_sync_pipeline(IPIPE_IRQMASK_ANY);
            } else {

                printk("next_domain != this_domain\n");
                ipipe_cpudom_var(this_domain, evsync) = 0;
                ipipe_current_domain = next_domain;
                ipipe_suspend_domain();    /* Sync stage and propagate

interrupts. */

                if (ipipe_current_domain == next_domain)
                    ipipe_current_domain = this_domain;
                /*
                 * Otherwise, something changed the current domain under our
                 * feet recycling the register set; do not override the new
                 * domain.
                 */

                if (ipipe_cpudom_var(this_domain, irqpend_himask) != 0 &&
                    !test_bit(IPIPE_STALL_FLAG,
                          &ipipe_cpudom_var(this_domain, status))) {
                    printk("recycling the register set\n");
                    __ipipe_sync_pipeline(IPIPE_IRQMASK_ANY);
                }
            }

            break;
        } else if (next_domain == this_domain) {
            printk("ipipe_cpudom_var == 0\n");
            printk("next_domain == this_domain\n");
            break;
        }

        pos = next_domain->p_link.next;
    }
}
#2 lore raw
In reply to Steven A. Falco
Quoted 8 lines · Steven A. Falco

I am building kernel 2.6.25.4 from DENX with Xenomai 2.4.4 for PPC440EPx (sequoia development board).

The kernel tries to use DHCP to obtain network settings. With IPIPE disabled, this works perfectly. However, when I enable IPIPE, the board sends packets ok, but does not receive packets - I can see the DHCP with a sniffer, but the development board does not receive them.

External interrupts are probably locked out by the pipeline engine; I've fixed a similar issue in recent patches for other PICs. Which I-pipe patch release are you using?

Quoted 33 lines

Also, in order to disable IPIPE, I had to patch kernel/time/tick-common.c around line 168. It is missing an ifdef:

kernel/time/tick-common.c +2 -0
index 58bfacf..3a735b8 100644
@@ -163,9 +163,11 @@ static void tick_setup_device(struct tick_device *td,
 
        td->evtdev = newdev;
 
+#ifdef CONFIG_IPIPE
        /* I-pipe: derive global tick IRQ from CPU 0 */
        if (cpu == 0)
                ipipe_update_tick_evtdev(newdev);
+#endif
 
        /*
         * When the device is not per cpu, pin the interrupt to the

If anyone has suggestions as to why IPIPE is blocking received ethernet packets, I'd appreciate it.

Steve

_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.
#3 lore raw
Quoted 11 lines · Philippe Gerum
Quoted 7 lines · Steven A. Falco

I am building kernel 2.6.25.4 from DENX with Xenomai 2.4.4 for PPC440EPx (sequoia development board).

The kernel tries to use DHCP to obtain network settings. With IPIPE disabled, this works perfectly. However, when I enable IPIPE, the board sends packets ok, but does not receive packets - I can see the DHCP with a sniffer, but the development board does not receive them.

Quoted 5 lines

External interrupts are probably locked out by the pipeline engine; I've fixed a
similar issue in recent patches for other PICs. Which I-pipe patch release are
you using?

I am using the patch that came with Xenomai 2.4.4, namely:
adeos-ipipe-2.6.25-powerpc-DENX-2.2-02.patch

Quoted 27 lines
Quoted 27 lines

Also, in order to disable IPIPE, I had to patch kernel/time/tick-common.c around line 168. It is missing an ifdef:

kernel/time/tick-common.c +2 -0
index 58bfacf..3a735b8 100644
@@ -163,9 +163,11 @@ static void tick_setup_device(struct tick_device
 *td,
 
 td->evtdev = newdev;
 
+#ifdef CONFIG_IPIPE
 /* I-pipe: derive global tick IRQ from CPU 0 */
 if (cpu == 0)
 ipipe_update_tick_evtdev(newdev);
+#endif
 
 /*

* When the device is not per cpu, pin the interrupt to the

If anyone has suggestions as to why IPIPE is blocking received ethernet packets, I'd appreciate it.

Steve

#4 lore raw
Quoted 19 lines · Steven A. Falco
Quoted 11 lines · Philippe Gerum
Quoted 7 lines · Steven A. Falco

I am building kernel 2.6.25.4 from DENX with Xenomai 2.4.4 for PPC440EPx (sequoia development board).

The kernel tries to use DHCP to obtain network settings. With IPIPE disabled, this works perfectly. However, when I enable IPIPE, the board sends packets ok, but does not receive packets - I can see the DHCP with a sniffer, but the development board does not receive them.

Quoted 5 lines

External interrupts are probably locked out by the pipeline engine; I've fixed a
similar issue in recent patches for other PICs. Which I-pipe patch release are
you using?

Quoted 3 lines

I am using the patch that came with Xenomai 2.4.4, namely:
adeos-ipipe-2.6.25-powerpc-DENX-2.2-02.patch

I can't reproduce this issue on a 440EP board, but I still have to to put my hands on a 440EPX to check this. However, both should be using the common 44x PIC support, so I don't expect big changes here.

Are you using the powerpc/ branch, or legacy ppc/ one for building the sequoia kernel?

Signature · 1 line
Philippe.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 10 lines · Steven A. Falco
Quoted 10 lines
Quoted 5 lines

I am using the patch that came with Xenomai 2.4.4, namely:
adeos-ipipe-2.6.25-powerpc-DENX-2.2-02.patch

I can't reproduce this issue on a 440EP board, but I still have to to put my hands on a 440EPX to check this. However, both should be using the common 44x PIC support, so I don't expect big changes here.

Quoted 5 lines
Quoted 3 lines

Are you using the powerpc/ branch, or legacy ppc/ one for building the sequoia kernel?

ARCH=powerpc.

Ah. So it's the UIC support that likely breaks. Could you try this patch?

arch/powerpc/sysdev/uic.c +0 -1
index dd40f64..4eff1ab 100644
@@ -111,7 +111,6 @@ static void uic_mask_ack_irq(unsigned int virq)
 
 	sr = 1 << (31-src);
 	spin_lock_irqsave(&uic->lock, flags);
-	ipipe_irq_lock(virq);
 	er = mfdcr(uic->dcrbase + UIC_ER);
 	er &= ~sr;
 	mtdcr(uic->dcrbase + UIC_ER, er);

In case it is not enough, try removing all the ipipe_irq_lock/unlock calls from arch/powerpc/sysdev/uic.c. If that works eventually, I'll sort the mess out later.

I started with the DENX-v2.6.25-stable branch from the

Quoted 13 lines

DENX linux-2.6-denx git tree, then applied Xenomai-2.4.4 using its install script. The toolchain is eldk-4.2 for ppc_4xxFP.

Is there some debugging I can turn on to help you track this down? I can also add additional printk statements.

In a case of "bad timing", I will be going on vacation tomorrow, so I will do what I can to gather more data today. Otherwise, I'll have to pick this up next Thursday (26th). :-(

Thanks,
Steve

Signature · 1 line
Philippe.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 34 lines · Steven A. Falco
Quoted 33 lines · Philippe Gerum
Quoted 9 lines · Steven A. Falco
Quoted 9 lines
Quoted 5 lines

I am using the patch that came with Xenomai 2.4.4, namely:
adeos-ipipe-2.6.25-powerpc-DENX-2.2-02.patch

I can't reproduce this issue on a 440EP board, but I still have to to put my hands on a 440EPX to check this. However, both should be using the common 44x PIC support, so I don't expect big changes here.

Quoted 6 lines
Quoted 4 lines

Are you using the powerpc/ branch, or legacy ppc/ one for building the sequoia kernel?

ARCH=powerpc.

Ah. So it's the UIC support that likely breaks. Could you try this patch?

arch/powerpc/sysdev/uic.c +0 -1
index dd40f64..4eff1ab 100644
@@ -111,7 +111,6 @@ static void uic_mask_ack_irq(unsigned int virq)
 
 	sr = 1 << (31-src);
 	spin_lock_irqsave(&uic->lock, flags);
-	ipipe_irq_lock(virq);
 	er = mfdcr(uic->dcrbase + UIC_ER);
 	er &= ~sr;
 	mtdcr(uic->dcrbase + UIC_ER, er);
Quoted 9 lines
Quoted 3 lines

In case it is not enough, try removing all the ipipe_irq_lock/unlock calls from arch/powerpc/sysdev/uic.c. If that works eventually, I'll sort the mess out later.

Beautiful. The patch works! I now get DHCP replies.

Is this the patch you will put into the official tree, or do you still need to do more?

One thing, could you confirm that your network card relies on edge interrupts (and not level)?

Aside of that, it should be ok. It's the same IRQ lock out issue fixed in the ppc/ branch recently.

Quoted 2 lines

Also, please include my compile-time patch, if that is acceptible.

I recently committed a different fix for the same issue after you reported it. This should work without requiring additional #ifdef'ing as well. Thanks for the heads up.

include/asm-powerpc/ipipe.h +2 -2
@@ -62,8 +62,6 @@
 		local_irq_enable_hw(); x;				\
 	} )
 
-#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
-
 struct ipipe_domain;
 
 struct ipipe_sysinfo {
@@ -209,4 +207,6 @@ do {									\
 
 #endif /* CONFIG_IPIPE */
 
+#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
+
 #endif /* !__ASM_POWERPC_IPIPE_H */
Signature · 1 line
Philippe.
#9 lore raw
Quoted 8 lines
Quoted 7 lines

Beautiful. The patch works! I now get DHCP replies.

Is this the patch you will put into the official tree, or do you still need to do more?

Quoted 7 lines

One thing, could you confirm that your network card relies on edge interrupts (and not level)?

Aside of that, it should be ok. It's the same IRQ lock out issue fixed in the ppc/ branch recently.

Sorry for the delay in getting back to you - vacation.

The ethernet interrupts on the PPC440 are level-sensitive. I gather that is not what you were expecting, so I wonder what the implications are.

After looking at it more closely, I don't really understand this fix. uic_mask_ack_irq() is just uic_mask_irq() followed by uic_ack_irq(). So, why do you remove the ipipe_irq_lock() from uic_mask_ack_irq() and not from uic_mask_irq()? Also, since uic_unmask_irq() always calls ipipe_irq_unlock(), doesn't that mean you can wind up with more unlocks than locks (since uic_mask_ack_irq/uic_unmask_irq are no longer balanced)?

Quoted 21 lines
Quoted 3 lines

Also, please include my compile-time patch, if that is acceptible.

I recently committed a different fix for the same issue after you reported it. This should work without requiring additional #ifdef'ing as well. Thanks for the heads up.

include/asm-powerpc/ipipe.h +0 -2
@@ -62,8 +62,6 @@
 		local_irq_enable_hw(); x;				\
 	} )
 
-#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
-
 struct ipipe_domain;
 
 struct ipipe_sysinfo {

include/asm-powerpc/ipipe.h do { \ · line 212

Quoted 6 lines
include/asm-powerpc/ipipe.h +2 -0
@@ -209,4 +207,6 @@ do {									\
 
 #endif /* CONFIG_IPIPE */
 
+#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
+
 #endif /* !__ASM_POWERPC_IPIPE_H */

Ok - thanks. I'll apply that fix instead.

Steve

#10 lore raw
Quoted 16 lines · Steven A. Falco
Quoted 8 lines
Quoted 7 lines

Beautiful. The patch works! I now get DHCP replies.

Is this the patch you will put into the official tree, or do you still need to do more?

Quoted 7 lines

One thing, could you confirm that your network card relies on edge interrupts (and not level)?

Aside of that, it should be ok. It's the same IRQ lock out issue fixed in the ppc/ branch recently.

Quoted 5 lines

Sorry for the delay in getting back to you - vacation.

The ethernet interrupts on the PPC440 are level-sensitive. I gather that is not what you were expecting, so I wonder what the implications are.

Nothing bad. This just means that the bug was due to unbalanced locking, which is only ok when trying to decrease the lock count uselessly.

Quoted 4 lines

After looking at it more closely, I don't really understand this fix. uic_mask_ack_irq() is just uic_mask_irq() followed by uic_ack_irq(). So, why do you remove the ipipe_irq_lock() from uic_mask_ack_irq() and not from uic_mask_irq()?

We don't want to lock the pipeline for a given interrupt when acknowledging that interrupt -- when present uic_mask_ack_irq() will always supersede separate mask+ack calls for acknowledging IRQs.

However, we want non ack-related masking/unmasking to alter the pipeline state for the interrupt in question. And those routines are not involved in IRQ acknowledge at all.

Also, since uic_unmask_irq() always calls

Quoted 3 lines

ipipe_irq_unlock(), doesn't that mean you can wind up with more unlocks than locks (since uic_mask_ack_irq/uic_unmask_irq are no longer balanced)?

That is explicitly allowed by the pipeline code.

Quoted 33 lines
Quoted 21 lines
Quoted 3 lines

Also, please include my compile-time patch, if that is acceptible.

I recently committed a different fix for the same issue after you reported it. This should work without requiring additional #ifdef'ing as well. Thanks for the heads up.

include/asm-powerpc/ipipe.h +0 -2
@@ -62,8 +62,6 @@
 		local_irq_enable_hw(); x;				\
 	} )
 
-#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
-
 struct ipipe_domain;
 
 struct ipipe_sysinfo {

include/asm-powerpc/ipipe.h do { \ · line 212

Quoted 6 lines
include/asm-powerpc/ipipe.h +2 -0
@@ -209,4 +207,6 @@ do {									\
 
 #endif /* CONFIG_IPIPE */
 
+#define ipipe_update_tick_evtdev(evtdev)	do { } while (0)
+
 #endif /* !__ASM_POWERPC_IPIPE_H */

Ok - thanks. I'll apply that fix instead.

Steve

Signature · 1 line
Philippe.