Date: Fri, 30 Aug 2013 12:13:04 +0200 From: Hans Petter Selasky <hps@bitfrost.no> To: "Lundberg, Johannes" <johannes@brilliantservice.co.jp> Cc: FreeBSD Current <freebsd-current@freebsd.org>, "freebsd-usb@freebsd.org" <freebsd-usb@freebsd.org> Subject: Re: xhci broken on 10-CURRENT and 2013 MacBook Air? Message-ID: <52207030.8050107@bitfrost.no> In-Reply-To: <CAASDrVnwKOwqAVAu19gExpNvPYcwXo1V%2Bg=kVbnZWq5ic4NDvA@mail.gmail.com> References: <CAASDrV=_8XDFZqcVP7aHdgEwxtMEDyNDQAyM5dgPmJ6=toOpow@mail.gmail.com> <CAASDrVmyduRKwsp5oURYuHX8G4hoODn0TftbC5MfV=3XhhocrA@mail.gmail.com> <521B9CD7.8010902@bitfrost.no> <CAASDrVk5xjptRPttbQA6b7Tg_Pgf005EqMQpUhv-jNje%2B352%2BA@mail.gmail.com> <521C6C26.7050207@bitfrost.no> <CAASDrVnJj4%2BkhHB-StW3JpVuCqZx7MBcmqA59_Ay-06Jgu5PnQ@mail.gmail.com> <CAASDrVk4eWVLj0=VHygKk5iG9Zd0tSwNkqLX%2BLJjP=mD_LRrUw@mail.gmail.com> <52203EC9.4060808@bitfrost.no> <CAASDrVnwKOwqAVAu19gExpNvPYcwXo1V%2Bg=kVbnZWq5ic4NDvA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------070205030908040509070208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 08/30/13 11:35, Lundberg, Johannes wrote: > Hi Hans > > I tried the patch and the result is the same. However, I found the command > that causes the freeze. Also, it is not always it freezes but maybe 9/10 > reboots or more frequently. > > At the end of the function xhci_start_controller(..) there is a for loop: > > 487 for (i = 0; i != 100; i++) { > 488 usb_pause_mtx(NULL, hz / 100); > 489 temp = XREAD4(sc, oper, XHCI_USBSTS) & XHCI_STS_HCH; > 490 if (!temp) > 491 break; > 492 } > > and it freezes at usb_pause_mtx(...) > value of i is 0 > value of hz is 1000 Hi, Can you try the attached patch? I think this is a problem inside DELAY(). Maybe you have to select another timing source for DELAY(), mav @ CC'ed? --HPS --------------070205030908040509070208 Content-Type: text/x-patch; name="pause_fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pause_fix.diff" === sys/kern/kern_synch.c ================================================================== --- sys/kern/kern_synch.c (revision 254832) +++ sys/kern/kern_synch.c (local) @@ -356,11 +356,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { - int sbt_sec; + KASSERT(sbt >= 0, ("pause: timeout must be >= 0")); - sbt_sec = sbintime_getsec(sbt); - KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0")); - /* silently convert invalid timeouts */ if (sbt == 0) sbt = tick_sbt; @@ -370,11 +367,14 @@ * We delay one second at a time to avoid overflowing the * system specific DELAY() function(s): */ - while (sbt_sec > 0) { + while (sbt >= SBT_1S) { DELAY(1000000); - sbt_sec--; + sbt -= SBT_1S; } - DELAY((sbt & 0xffffffff) / SBT_1US); + /* Do the delay remainder */ + sbt /= SBT_1US; + if (sbt != 0) + DELAY(sbt); return (0); } return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); --------------070205030908040509070208--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52207030.8050107>