Using WFI instruction on all armv7-based systems

Ian Lepore ian at FreeBSD.org
Fri Feb 28 03:56:34 UTC 2014


When I first got multiple cores running in my imx6 work, I noticed that
my core temperature climbed to 78C and stuck there even with the board
100% idle, and it didn't go up if I loaded the board to 100% busy.  It
turns out the cpu_sleep() routine we've been using didn't work right for
armv7 and the idle thread was just spinning, so all cores were running
flat-out all the time.

I added code to do the wait-for-interrupt the new armv7 way, using the
WFI instruction instead of a coprocessor function.  Now the temperature
idles at 54C.  This change should help all armv7 chips run cooler, not
just imx6.  I've tested it on imx53 and on my BeagleBone White.

After adding the WFI on imx6 I had a lot of trouble with the system
hanging during boot.  I eventually tracked it down to the chip's power
management features -- it was disabling clocks to parts of the ARM cores
needed to wake up from WFI, and we don't have the support code yet to
use the alternate interrupt controller in low power mode and all that
other complicated clocks-and-power stuff.

I mention the imx6 problem just in case the same sort of thing crops up
on some of the other armv7 chips that I don't have here to test.  If you
notice strange crashes or hangs, uneven jerky system response, bad
timekeeping (like ntpd keeps stepping the clock) then maybe your chip
also automatically powers down important stuff during WFI.  Let me know
and we'll figure out how to fix it, or some way to make WFI optional
until it can be fixed.

-- Ian




More information about the freebsd-arm mailing list