[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/hvm: Drop .is_singlestep_supported() callback


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 13 Jan 2022 18:48:00 +0000
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Thu, 13 Jan 2022 18:48:35 +0000
  • Ironport-data: A9a23:eOMPqa3vSmrbG7nAaPbD5UJ2kn2cJEfYwER7XKvMYLTBsI5bp2BRn 2BNCmmFOqqCM2D2f40nbIq1phgO68XTyNFiQAU6pC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkS5PE3oHJ9RGQ74nRLlbHILOCanAZqTNMEn9700o6wrVh2OaEvPDia++zk YKqyyHgEAfNNw5cagr4PIra9XuDFNyr0N8plgRWicJj5TcypFFMZH4rHomjLmOQf2VhNrXSq 9Avbl2O1jixEx8FUrtJm1tgG6EAaua60QOm0hK6V0U+6/TrS+NbPqsTbZIhhUlrZzqhg/5Jw utAjt+LWSAIZZXBhOEFA0dGHHQrVUFG0OevzXmXtMWSywvNcmf2wuUoB0YzVWEa0r8pWycUr 6VecW1TKEDY7w616OvTpu1Er8IvNsT0eqgYvWlt12rxBvc6W5HTBa7N4Le02R9u35ESTKmOP qL1bxJpbyXLZBxmFW5IDZZk27froXyleQNx/Qf9Sa0fvDGIkV0ZPKLWGMbcf9WRbdlWmkueq XPL+yLyBRRyHN6Cz3yD+3GlhO7KlAv6Xp4fEPuz8fs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ironport-hdrordr: A9a23:IHQaNKvuMqX8Ir1hsNITF8z87skDeNV00zEX/kB9WHVpmszxra GTdZMgpHnJYVcqKRYdcL+7Scq9qB/nmqKdgrNhWYtKPjOW2ldARbsKheCJrlHd8kXFh5dgPM xbE5SWZuefMbEDt7ee3DWF
  • Ironport-sdr: fP/dlcoMLXVLUaBa7C+AHwamvSYjZybBit8b0KRP73K9WKiCVBW74zKEROduYCBQULzz32UScY UDLeEIGzYrL62zBvsudDXSLpJRPKbgdlyKdztPdeS/J1gH/z+Qd9uGis+hOlTy/QhLDZgj0K1E gG1DbXZVAJ6euEd01fGwwObqB6ENlC7m7L+2Tl6+nJ1I05TrQxZKqZU/xKvWpE0XwlqMEiQQDe YR0wLeN4Sn8PxjCI2yN7uikRg3gPl//55kxKBDC7ohA4Hz1XLsjaii+Ll8vLT65gsD/Zf605+5 Aysu5Tv5R2GV5zxNbhfIUTkE
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

There is absolutely no need for a function pointer call here.

Drop the hook, introduce a singlestep_supported boolean, and configure it in
start_vmx() like all other optional functionality.

No functional change, but rather more efficient logic.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
CC: Jun Nakajima <jun.nakajima@xxxxxxxxx>
CC: Kevin Tian <kevin.tian@xxxxxxxxx>

Based on Jan's "altcall all hvm ops" patch, but not logically related.  This
had escaped my previous attempts to drop inappropriate function pointer use.

The hvm_funcs data fields are a mess.  All the booleans and 'hvm_capabilities'
want merging into a single bitfield, so we're not wasting 8 bytes of space to
hold 6 bits of information.
---
 xen/arch/x86/hvm/vmx/vmx.c         | 8 ++------
 xen/arch/x86/include/asm/hvm/hvm.h | 7 +++----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a7a0d662342a..1c46669762b0 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2120,11 +2120,6 @@ static void vmx_enable_msr_interception(struct domain 
*d, uint32_t msr)
         vmx_set_msr_intercept(v, msr, VMX_MSR_W);
 }
 
-static bool_t vmx_is_singlestep_supported(void)
-{
-    return !!cpu_has_monitor_trap_flag;
-}
-
 static void vmx_vcpu_update_eptp(struct vcpu *v)
 {
     struct domain *d = v->domain;
@@ -2454,7 +2449,6 @@ static struct hvm_function_table __initdata 
vmx_function_table = {
     .nhvm_domain_relinquish_resources = nvmx_domain_relinquish_resources,
     .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
     .enable_msr_interception = vmx_enable_msr_interception,
-    .is_singlestep_supported = vmx_is_singlestep_supported,
     .altp2m_vcpu_update_p2m = vmx_vcpu_update_eptp,
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
@@ -2661,6 +2655,8 @@ const struct hvm_function_table * __init start_vmx(void)
         return NULL;
     }
 
+    vmx_function_table.singlestep_supported = cpu_has_monitor_trap_flag;
+
     if ( cpu_has_vmx_dt_exiting )
         vmx_function_table.set_descriptor_access_exiting =
             vmx_set_descriptor_access_exiting;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h 
b/xen/arch/x86/include/asm/hvm/hvm.h
index b26302d9e769..9338cf25a657 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -97,6 +97,7 @@ struct hvm_function_table {
 
     /* Necessary hardware support for alternate p2m's? */
     bool altp2m_supported;
+    bool singlestep_supported;
 
     /* Hardware virtual interrupt delivery enable? */
     bool virtual_intr_delivery_enabled;
@@ -208,7 +209,6 @@ struct hvm_function_table {
                                 uint8_t *p2m_acc, struct npfec npfec);
 
     void (*enable_msr_interception)(struct domain *d, uint32_t msr);
-    bool_t (*is_singlestep_supported)(void);
 
     /* Alternate p2m */
     void (*altp2m_vcpu_update_p2m)(struct vcpu *v);
@@ -644,10 +644,9 @@ static inline void hvm_enable_msr_interception(struct 
domain *d, uint32_t msr)
     alternative_vcall(hvm_funcs.enable_msr_interception, d, msr);
 }
 
-static inline bool_t hvm_is_singlestep_supported(void)
+static inline bool hvm_is_singlestep_supported(void)
 {
-    return (hvm_funcs.is_singlestep_supported &&
-            alternative_call(hvm_funcs.is_singlestep_supported));
+    return hvm_funcs.singlestep_supported;
 }
 
 static inline bool hvm_hap_supported(void)
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.