Date: Sat, 10 May 2014 17:23:10 -0600 From: Ian Lepore <ian@FreeBSD.org> To: Hans Petter Selasky <hps@selasky.org> Cc: "freebsd-arm@freebsd.org" <freebsd-arm@FreeBSD.org>, Alexander Motin <mav@FreeBSD.org> Subject: Re: USB isochronous traffic with Rasberry Pi [WAS: Re: USB audio device on Raspberry Pi] Message-ID: <1399764190.22079.425.camel@revolution.hippie.lan> In-Reply-To: <536EA753.40905@selasky.org> References: <20140425154430.GA76168@utility-01.thismonkey.com> <5360C0A7.9010407@selasky.org> <1398867266.22079.51.camel@revolution.hippie.lan> <CAGW5k5bZ_bTQUXuzNm=tbwx3npz1_HoOR3vM8TBRVFs8zWCq-w@mail.gmail.com> <5362638B.1080104@selasky.org> <5363C133.2000304@selasky.org> <53677CB8.5000800@selasky.org> <CAJ-Vmo=XmH-RX6_i13NuAXhq-jTC%2BWedGiyOMJaPO4r014DSgw@mail.gmail.com> <1399303695.22079.239.camel@revolution.hippie.lan> <1399304157.22079.243.camel@revolution.hippie.lan> <CAJ-Vmok-%2B7%2Bcq%2BDa6_C2AA7BuP5readY_Gfwwm_RF5kh4VerQA@mail.gmail.com> <5368A93D.3070608@selasky.org> <5368AC03.8080401@selasky.org> <536CE5E9.8020408@selasky.org> <1399647986.22079.367.camel@revolution.hippie.lan> <536D0575.1040407@selasky.org> <1399661378.22079.376.camel@revolution.hippie.lan> <536DDA6D.7060101@selasky.org> <1399724697.22079.386.camel@revolution.hippie.l an> <536E2EBB.7030104@selasky.org> <1399742062.22079.403.camel@revolution.hippie.lan> <536EA597.3070700@selasky.org> <536EA753.40905@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-uGWDOLKFIGU7QklY4t93 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --=-uGWDOLKFIGU7QklY4t93 Content-Disposition: inline; filename="cpu_idle_spinlock.diff" Content-Type: text/x-patch; name="cpu_idle_spinlock.diff"; charset="us-ascii" Content-Transfer-Encoding: 7bit Index: sys/arm/arm/machdep.c =================================================================== --- sys/arm/arm/machdep.c (revision 265783) +++ sys/arm/arm/machdep.c (working copy) @@ -426,9 +426,9 @@ cpu_idle(int busy) CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); + spinlock_enter(); #ifndef NO_EVENTTIMERS if (!busy) { - critical_enter(); cpu_idleclock(); } #endif @@ -437,9 +437,9 @@ cpu_idle(int busy) #ifndef NO_EVENTTIMERS if (!busy) { cpu_activeclock(); - critical_exit(); } #endif + spinlock_exit(); CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", busy, curcpu); } --=-uGWDOLKFIGU7QklY4t93--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1399764190.22079.425.camel>