cpuidle: lpm_levels: add soft watchdog for s2idle

When cpus are suspended under s2idle, non-wakeup interrupts can lead
to cascading behavior where cpus come out of suspend, get work
scheduled, return to suspend only to find another cpu has left suspend,
etc.  This, in turn, can lead to non-secure watchdog timeouts that crash
the system, since the watchdog will continue to count down while 1 or
more cpus are running but no patting occurs since the system is still
mostly suspended.

This change implements a "soft watchdog" mechanism that will detect when
cpus are cycling in and out of suspend under a single s2idle system
suspend effort and - if the number of cycles exceeds a threshold - abort
the suspend.

Bug: 136698892
Testing: Ran with debug logging throughout lpm-levels s2idle code that
was causing similar cpu scheduling/suspended behavior.
Ran with a hard 1s delay in s2idle_enter, which was identified as
another repro for producing a failure similar to ramdumps in the field.
Change-Id: I75d4be507f71719d74cf58cdd5a49d1f5cbd6c06
Signed-off-by: Kelly Rossmoyer <krossmo@google.com>
1 file changed