From owner-freebsd-arm@FreeBSD.ORG Mon May 12 13:06:29 2014 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D548EECD; Mon, 12 May 2014 13:06:29 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1594823E7; Mon, 12 May 2014 13:06:29 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Wjpvy-0006zr-Cn; Mon, 12 May 2014 13:06:22 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s4CD6Il5034025; Mon, 12 May 2014 07:06:18 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19WbT57vkodSiRuIBj6szS2 Subject: Re: USB isochronous traffic with Rasberry Pi [WAS: Re: USB audio device on Raspberry Pi] From: Ian Lepore To: Hans Petter Selasky In-Reply-To: <536F17A1.8060807@selasky.org> References: <20140425154430.GA76168@utility-01.thismonkey.com> <5362638B.1080104@selasky.org> <5363C133.2000304@selasky.org> <53677CB8.5000800@selasky.org> <1399303695.22079.239.camel@revolution.hippie.lan> <1399304157.22079.243.camel@revolution.hippie.lan> <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> <1399764190.22079.425.camel@revolution.hippie.lan> <536F17A1.8060807@selasky.org> Content-Type: text/plain; charset="us-ascii" Date: Mon, 12 May 2014 07:06:18 -0600 Message-ID: <1399899978.22079.436.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: "freebsd-arm@freebsd.org" , Alexander Motin X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 May 2014 13:06:30 -0000 On Sun, 2014-05-11 at 08:24 +0200, Hans Petter Selasky wrote: > On 05/11/14 01:23, Ian Lepore wrote: > > 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 > > Hi Ian, > > Your patch works! > > BTW: I see the "mips" platform might have a similar issue. > > --HPS Committed as r265913; thanks for tracking this down! -- Ian