diff mbox

[4/5] VMX: fold redundant code

Message ID 56C4AFD102000078000D34AD@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Feb. 17, 2016, 4:37 p.m. UTC
No need to do this in two slightly different ways, possibly keeping the
compiler from folding the code for us.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
VMX: fold redundant code

No need to do this in two slightly different ways, possibly keeping the
compiler from folding the code for us.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3103,6 +3103,7 @@ void vmx_vmexit_handler(struct cpu_user_
                  && vector != TRAP_nmi 
                  && vector != TRAP_machine_check ) 
             {
+        default:
                 perfc_incr(realmode_exits);
                 v->arch.hvm_vmx.vmx_emulate = 1;
                 HVMTRACE_0D(REALMODE_EMULATE);
@@ -3121,12 +3122,6 @@ void vmx_vmexit_handler(struct cpu_user_
         case EXIT_REASON_INVEPT:
         case EXIT_REASON_INVVPID:
             break;
-
-        default:
-            v->arch.hvm_vmx.vmx_emulate = 1;
-            perfc_incr(realmode_exits);
-            HVMTRACE_0D(REALMODE_EMULATE);
-            return;
         }
     }

Comments

Andrew Cooper Feb. 17, 2016, 6:05 p.m. UTC | #1
On 17/02/16 16:37, Jan Beulich wrote:
> No need to do this in two slightly different ways, possibly keeping the
> compiler from folding the code for us.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3103,6 +3103,7 @@ void vmx_vmexit_handler(struct cpu_user_
>                   && vector != TRAP_nmi 
>                   && vector != TRAP_machine_check ) 

It would be nice if you could nuke the two bits of whitespace after the
TRAP_* constants while you are editing this area.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tian, Kevin Feb. 18, 2016, 5:26 a.m. UTC | #2
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Thursday, February 18, 2016 12:37 AM
> 
> No need to do this in two slightly different ways, possibly keeping the
> compiler from folding the code for us.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Kevin Tian <kevin.tian@intel.com>
diff mbox

Patch

--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3103,6 +3103,7 @@  void vmx_vmexit_handler(struct cpu_user_
                  && vector != TRAP_nmi 
                  && vector != TRAP_machine_check ) 
             {
+        default:
                 perfc_incr(realmode_exits);
                 v->arch.hvm_vmx.vmx_emulate = 1;
                 HVMTRACE_0D(REALMODE_EMULATE);
@@ -3121,12 +3122,6 @@  void vmx_vmexit_handler(struct cpu_user_
         case EXIT_REASON_INVEPT:
         case EXIT_REASON_INVVPID:
             break;
-
-        default:
-            v->arch.hvm_vmx.vmx_emulate = 1;
-            perfc_incr(realmode_exits);
-            HVMTRACE_0D(REALMODE_EMULATE);
-            return;
         }
     }