Linux Kernel wait_for_completion_timeout not wakeup by complete

Posted by Jun Li on Stack Overflow See other posts from Stack Overflow or by Jun Li
Published on 2012-11-21T23:45:27Z Indexed on 2012/12/11 23:04 UTC
Read the original article Hit count: 513

Filed under:
|

I am working on a strange issue with the i2c-omap driver. I am not sure if the problem happens at other time or not, but it happens around 5% of the time I tried to power off the system. During system power off, I write to some registers in the PMIC via I2C. In i2c-omap.c, I can see that the calling thread is waiting on wait_for_completion_timeout with a timeout value set to 1 second. And I can see the IRQ called "complete" (I added printk AFTER "complete"). However, after "complete" gets called, the wait_for_completion_timeout did not return. Instead, it takes up to 5 MINUTES before it returns. And the return value of wait_for_completion_timeout is positive indicating that there is no timeout. And the whole I2C transaction was successful.

In the meantime, I can see printk messages from other drivers. And the serial console still works. It is on Android, and if I use "top" I can see system_server is taking about 95% of the CPU. Killing system_server can make the wait_for_completion_timeout return immediately.

So my question is what could a user space app (system_server) do to make a kernel "wait_for_completion_timeout" not being wake up?

Thanks!

© Stack Overflow or respective owner

Related posts about android

Related posts about kernel