xen/xsm: Improve alloc/free of evtchn buckets
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 16 Jan 2021 16:09:10 +0000 (16:09 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 9 Apr 2021 09:31:17 +0000 (10:31 +0100)
commit935d501ccbf5b8c4db1f6d0730a4a4c998e9e76a
tree7cccdba1a951ebcaf9464391cb0d48d6aa4b6a2b
parent7ae04e1de449843a4b19d684c79ee07e3e42abfc
xen/xsm: Improve alloc/free of evtchn buckets

Currently, flask_alloc_security_evtchn() is called in loops of
64 (EVTCHNS_PER_BUCKET), which for non-dummy implementations is a function
pointer call even in the no-op case.  The non no-op case only sets a single
constant, and doesn't actually fail.

Spectre v2 protections has made function pointer calls far more expensive, and
64 back-to-back calls is a waste.  Rework the APIs to pass the size of the
bucket instead, and call them once.

No practical change, but {alloc,free}_evtchn_bucket() should be rather more
efficient now.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/common/event_channel.c
xen/include/xsm/dummy.h
xen/include/xsm/xsm.h
xen/xsm/dummy.c
xen/xsm/flask/hooks.c