]> git.baikalelectronics.ru Git - kernel.git/commit
PM: QoS: annotate data races in pm_qos_*_value()
authorQian Cai <cai@lca.pw>
Wed, 26 Feb 2020 01:58:13 +0000 (20:58 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 3 Mar 2020 22:34:51 +0000 (23:34 +0100)
commitd9e107258c8dd6f52e6192f6c77d0b8d4644a84d
tree0e5dc4d1dc85172d654680b371e38f693c80a730
parent496d8530e67c566a872c620c4608647872ab6c21
PM: QoS: annotate data races in pm_qos_*_value()

The target_value field in struct pm_qos_constraints is used for
lockless access to the effective constraint value of a given QoS
list, so the readers of it cannot expect it to always reflect the
most recent effective constraint value.  However, they can and do
expect it to be equal to a valid effective constraint value computed
at a certain time in the past (event though it may not be the most
recent one), so add READ|WRITE_ONCE() annotations around the
target_value accesses to prevent the compiler from possibly causing
that expectation to be unmet by generating code in an exceptionally
convoluted way.

Signed-off-by: Qian Cai <cai@lca.pw>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/qos.c