the problem happens only if analyze_suspend is used to suspend the system. during resume, everything goes fine, and then hangs in analyze_suspend, in this line recdata = fp.read(rechead[1]-8) writing directly to /sys/power/state or using rtcwake tool does not have any problem. The problem can not be reproduced in 4.7 kernel.
I'm doing git bisect right now.
Yu, please check if analyze_suspend still hangs in the latest upstream kernel.
It looks like the handling of the task that drives system suspend may be broken somehow. Does it still happen in 4.9-rc7?
Not reproduced on 4.9 upstream.