]> xenbits.xensource.com Git - xen.git/commit
evtchn/Flask: pre-allocate node on send path
authorJan Beulich <jbeulich@suse.com>
Fri, 2 Oct 2020 06:36:21 +0000 (08:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 2 Oct 2020 06:36:21 +0000 (08:36 +0200)
commit52e1fc47abc3a0123d2b5bb7e9172e84fd571851
tree65789b95c1219bcc9322d2b7ab0908044af0b3e0
parent22b08b35db4aca2d2f6b31ba940cc65402b5586d
evtchn/Flask: pre-allocate node on send path

xmalloc() & Co may not be called with IRQs off, or else check_lock()
will have its assertion trigger about locks getting acquired
inconsistently. Re-arranging the locking in evtchn_send() doesn't seem
very reasonable, especially since the per-channel lock was introduced to
avoid acquiring the per-domain event lock on the send paths. Issue a
second call to xsm_evtchn_send() instead, before acquiring the lock, to
give XSM / Flask a chance to pre-allocate whatever it may need.

As these nodes are used merely for caching earlier decisions' results,
allocate just one node in AVC code despite two potentially being needed.
Things will merely be not as performant if a second allocation was
wanted, just like when the pre-allocation fails.

Fixes: c0ddc8634845 ("evtchn: convert per-channel lock to be IRQ-safe")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Jason Andryuk <jandryuk@gmail.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
xen/common/event_channel.c
xen/include/xsm/xsm.h
xen/xsm/flask/avc.c
xen/xsm/flask/hooks.c
xen/xsm/flask/include/avc.h