]> xenbits.xensource.com Git - xen.git/commit
xen/xsm: Improve fallback handling in xsm_fixup_ops()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 4 Nov 2021 03:12:49 +0000 (03:12 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 29 Nov 2021 13:53:05 +0000 (13:53 +0000)
commitee3407bb05dae8fa2bbd6476e36bd96d352fd19e
tree1f33392b29a74517bb14db4d10aca33c07c4e1db
parent28959fe44235babe31be40f09eccd139a247d858
xen/xsm: Improve fallback handling in xsm_fixup_ops()

The current xsm_fixup_ops() is just shy of a full page when compiled, and very
fragile to NULL function pointer errors.

Address both of these issues with a minor piece of structure (ab)use.
Introduce dummy_ops, and fix up the provided xsm_ops pointer by treating both
as an array of unsigned longs.

The compiled size improvement speaks for itself:

  $ ../scripts/bloat-o-meter xen-syms-before xen-syms-after
  add/remove: 1/0 grow/shrink: 0/1 up/down: 712/-3897 (-3185)
  Function                                     old     new   delta
  dummy_ops                                      -     712    +712
  xsm_fixup_ops                               3987      90   -3897

and there is an additional safety check that will make it obvious during
development if there is an issue with the fallback handling.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
xen/include/xsm/xsm.h
xen/xsm/dummy.c