]> xenbits.xensource.com Git - people/jgross/xen.git/commit
xen/spinlock: move debug helpers inside the locked regions
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 29 Jul 2020 11:13:30 +0000 (13:13 +0200)
committerJulien Grall <jgrall@amazon.com>
Thu, 30 Jul 2020 18:27:08 +0000 (19:27 +0100)
commit98bed5de1de3352c63cfe29a00f17e8d9ce72689
tree28c79806b5e6f3224ffbda2409e8cf9bed878804
parent64219fa179c3e48adad12bfce3f6b3f1596cccbf
xen/spinlock: move debug helpers inside the locked regions

Debug helpers such as lock profiling or the invariant pCPU assertions
must strictly be performed inside the exclusive locked region, or else
races might happen.

Note the issue was not strictly introduced by the pointed commit in
the Fixes tag, since lock stats where already incremented before the
barrier, but that commit made it more apparent as manipulating the cpu
field could happen outside of the locked regions and thus trigger the
BUG_ON on rel_lock(). This is only enabled on debug builds, and thus
releases are not affected.

Fixes: 80cba391a35 ('spinlocks: in debug builds store cpu holding the lock')
Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/common/spinlock.c