This is a repeat of an issue I posted before, but which for some reason I never saw email back ... basically, I think the notion of counting wakeup events seems dubious on common hardware, so the focus might perhaps better be placed on ensuring userspace just receives events rather than trying to track events which in one context ended up being wakeup events. (That's simpler, and the system is by definition awake if it can handle any events at all.) Thing is, "wakeup" is, for e.g. most ARMs, just a hardware attribute of what's otherwise a routine event, which happens in other contexts and needs to be handled consistently .... nothing special about having woken the system too, the result ought to be the same regardless (from the user P.O.V.) ... (Common Examples include SoC peripheral IRQs that can wake the system (including GPIO and other types of external IRQ signal.) BRIEFLY: if that event doesn't arrive reliably, it's an issue regardless of wakeup: either TX from kernel, or RX in userspace. Such bugs would need to be fixed. Having them fixed will help the wakeup scenarios too of course. (The raciness issues might boil down to something as simple as not letting userspace know about transition events to/from suspend states, but that issue ought to be cleanly separable; ISTR other messages on the suspend blocker threads have shown how to work with such clean factoring.) So trying to track whether a given event is what woke the system will often be implausible, since several such events might each have fired (one or more concurrent wakeup sources, even ... it could be indeterminate which one[s] happened.) And the event could fire without being a wakeup. Yes, there are a few cases (like USB remote wakeup signaling and some PCI mechanisms, plus a few BIOS assisted situations) where certain events may be identifiable as wakeup sources, perhaps runtime not system-wide). But the common case just includes an event, not the ability to know that event had the "woke whole system from low power state" side effect too. > + The > /sys/power/wakeup_count file allows user space to avoid > + losing wakeup events > when transitioning the system into a sleep > + state. Reading > from it returns the current number of registered > + wakeup events and it > blocks if some wakeup events are being > + processed at the > time the file is read from. _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm