USB isochronous traffic with Rasberry Pi [WAS: Re: USB audio device on Raspberry Pi]

Ian Lepore ian at FreeBSD.org
Sat May 10 23:23:15 UTC 2014


On Sun, 2014-05-11 at 00:25 +0200, Hans Petter Selasky wrote:
> Hi,
> 
> This patch fixes the problem too:
> 
> diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
> index 0490be7..8d53fab 100644
> --- a/sys/arm/arm/machdep.c
> +++ b/sys/arm/arm/machdep.c
> @@ -432,8 +432,12 @@ cpu_idle(int busy)
>                  cpu_idleclock();
>          }
>   #endif
> +       register_t s;
> +       s = intr_disable();
>          if (!sched_runnable())
>                  cpu_sleep(0);
> +       intr_restore(s);
> +
>   #ifndef NO_EVENTTIMERS
>          if (!busy) {
>                  cpu_activeclock();
> 
> It appears some IRQ is happening when sched_runnable() is running, and 
> then cpu_sleep(0) is executed even though sched_runnable() is no longer 
> true.
> 
> --HPS

Aha!  Now I think you're on to something.  Even after explaining why
interrupts should be disabled for WFI I didn't notice that we don't
disable interrupts before WFI.  (I wonder if this is why I sometimes see
a lost timer interrupt and have to hit a key to un-wedge things.)

Can you try the attached?  The spinlock_enter/exit calls are essentially
a combination of disabling interrupts and doing a critical_enter().

-- Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpu_idle_spinlock.diff
Type: text/x-patch
Size: 619 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20140510/c4922ecb/attachment.bin>


More information about the freebsd-arm mailing list