]> xenbits.xensource.com Git - xen.git/commit
x86/vmx: Factor locate_msr_entry() out of vmx_find_msr() and vmx_add_msr()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 7 May 2018 10:57:00 +0000 (11:57 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 Aug 2018 16:27:59 +0000 (17:27 +0100)
commit87dba8038bcb401ffc23ec226860b7b3ec2c3943
tree592639d5eab994a74c38e4d1a762b45f91ac2175
parentfe028e615c9d4995685d48383fed5edc3054fa5a
x86/vmx: Factor locate_msr_entry() out of vmx_find_msr() and vmx_add_msr()

Instead of having multiple algorithms searching the MSR lists, implement a
single one.  It has the semantics required by vmx_add_msr(), to identify the
position in which an MSR should live, if it isn't already present.

There will be a marginal improvement for vmx_find_msr() by avoiding the
function pointer calls to vmx_msr_entry_key_cmp(), and a major improvement for
vmx_add_msr() by using a binary search instead of a linear search.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
(cherry picked from commit 4d94828cf11104256dccea1fa7762f00575dfaa0)
xen/arch/x86/hvm/vmx/vmcs.c