[PATCH v2 4/9] x86/vmx: remove unused included headers from vmx.h

Xenia Ragiadakou posted 9 patches 2 years, 11 months ago
[PATCH v2 4/9] x86/vmx: remove unused included headers from vmx.h
Posted by Xenia Ragiadakou 2 years, 11 months ago
Do not include the headers:
  asm/i387.h
  asm/hvm/trace.h
  asm/processor.h
  asm/regs.h
because none of the declarations and macro definitions in them is used in
this file. Sort the rest of the headers alphabetically.
Fix build by including asm/i387.h in vmx.c, needed for vcpu_restore_fpu_lazy().

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---

Changes in v2:
  -add a blank line between different types of headers, reported by Andrew
  -fix english in commit message, reported by Andrew

 xen/arch/x86/hvm/vmx/vmx.c             | 1 +
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 9 +++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 0ec33bcc18..a0297e8c6c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -43,6 +43,7 @@
 #include <asm/hvm/vmx/vmcs.h>
 #include <public/sched.h>
 #include <public/hvm/ioreq.h>
+#include <asm/i387.h>
 #include <asm/hvm/vpic.h>
 #include <asm/hvm/vlapic.h>
 #include <asm/x86_emulate.h>
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 97d6b810ec..c0ca6d10e3 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -19,14 +19,11 @@
 #define __ASM_X86_HVM_VMX_VMX_H__
 
 #include <xen/sched.h>
-#include <asm/types.h>
-#include <asm/regs.h>
+
 #include <asm/asm_defns.h>
-#include <asm/processor.h>
-#include <asm/p2m.h>
-#include <asm/i387.h>
-#include <asm/hvm/trace.h>
 #include <asm/hvm/vmx/vmcs.h>
+#include <asm/p2m.h>
+#include <asm/types.h>
 
 extern int8_t opt_ept_exec_sp;
 
-- 
2.37.2
Re: [PATCH v2 4/9] x86/vmx: remove unused included headers from vmx.h
Posted by Jan Beulich 2 years, 11 months ago
On 22.02.2023 13:00, Xenia Ragiadakou wrote:
> Do not include the headers:
>   asm/i387.h
>   asm/hvm/trace.h
>   asm/processor.h
>   asm/regs.h
> because none of the declarations and macro definitions in them is used in
> this file. Sort the rest of the headers alphabetically.
> Fix build by including asm/i387.h in vmx.c, needed for vcpu_restore_fpu_lazy().

Nit: You don't really "fix" the build, you keep it working.

> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

In principle
Reviewed-by: Jan Beulich <jbeulich@suse.com>
but ...

> --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
> +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
> @@ -19,14 +19,11 @@
>  #define __ASM_X86_HVM_VMX_VMX_H__
>  
>  #include <xen/sched.h>
> -#include <asm/types.h>
> -#include <asm/regs.h>
> +
>  #include <asm/asm_defns.h>
> -#include <asm/processor.h>
> -#include <asm/p2m.h>
> -#include <asm/i387.h>
> -#include <asm/hvm/trace.h>
>  #include <asm/hvm/vmx/vmcs.h>
> +#include <asm/p2m.h>
> +#include <asm/types.h>

... can this please become xen/types.h (and move up accordingly), so
things won't break here when my further work in that area lands?

Jan
Re: [PATCH v2 4/9] x86/vmx: remove unused included headers from vmx.h
Posted by Xenia Ragiadakou 2 years, 11 months ago

On 2/23/23 12:29, Jan Beulich wrote:
> On 22.02.2023 13:00, Xenia Ragiadakou wrote:
>> Do not include the headers:
>>    asm/i387.h
>>    asm/hvm/trace.h
>>    asm/processor.h
>>    asm/regs.h
>> because none of the declarations and macro definitions in them is used in
>> this file. Sort the rest of the headers alphabetically.
>> Fix build by including asm/i387.h in vmx.c, needed for vcpu_restore_fpu_lazy().
> 
> Nit: You don't really "fix" the build, you keep it working.

Ok I will rephrase it in v3.

> 
>> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
> 
> In principle
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> but ...
> 
>> --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
>> +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
>> @@ -19,14 +19,11 @@
>>   #define __ASM_X86_HVM_VMX_VMX_H__
>>   
>>   #include <xen/sched.h>
>> -#include <asm/types.h>
>> -#include <asm/regs.h>
>> +
>>   #include <asm/asm_defns.h>
>> -#include <asm/processor.h>
>> -#include <asm/p2m.h>
>> -#include <asm/i387.h>
>> -#include <asm/hvm/trace.h>
>>   #include <asm/hvm/vmx/vmcs.h>
>> +#include <asm/p2m.h>
>> +#include <asm/types.h>
> 
> ... can this please become xen/types.h (and move up accordingly), so
> things won't break here when my further work in that area lands?

Sure.

> 
> Jan

-- 
Xenia