diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-01-31 11:06:39 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-03-15 00:43:13 +0100 |
commit | 023d3779145ec6b7a0f38f19672a347b92feb74e (patch) | |
tree | 1ec78dc731dad2b8155faf6625617284f1b3b76d /drivers/net/seeq8005.h | |
parent | dc1b83ab08f1954335692cdcd499f78c94f4c42a (diff) |
PM / Wakeup: Combine atomic counters to avoid reordering issues
The memory barrier in wakeup_source_deactivate() is supposed to
prevent the callers of pm_wakeup_pending() and pm_get_wakeup_count()
from seeing the new value of events_in_progress (0, in particular)
and the old value of event_count at the same time. However, if
wakeup_source_deactivate() is executed by CPU0 and, for instance,
pm_wakeup_pending() is executed by CPU1, where both processors can
reorder operations, the memory barrier in wakeup_source_deactivate()
doesn't affect CPU1 which can reorder reads. In that case CPU1 may
very well decide to fetch event_count before it's modified and
events_in_progress after it's been updated, so pm_wakeup_pending()
may fail to detect a wakeup event. This issue can be addressed by
using a single atomic variable to store both events_in_progress
and event_count, so that they can be updated together in a single
atomic operation.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/net/seeq8005.h')
0 files changed, 0 insertions, 0 deletions