No need to use 4-byte integers to store two bits of information.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
---
xen/arch/x86/hvm/vmx/vmx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f83f102638..b79bca71ad 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3978,7 +3978,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
vmx_update_cpu_exec_control(v);
break;
case EXIT_REASON_TASK_SWITCH: {
- static const enum hvm_task_switch_reason reasons[] = {
+ static const int8_t reasons[] = {
TSW_call_or_int, TSW_iret, TSW_jmp, TSW_call_or_int
};
unsigned int inst_len, source;
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
On 07.01.2020 13:25, Andrew Cooper wrote: > No need to use 4-byte integers to store two bits of information. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> In principle Reviewed-by: Jan Beulich <jbeulich@suse.com> But ... > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -3978,7 +3978,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs) > vmx_update_cpu_exec_control(v); > break; > case EXIT_REASON_TASK_SWITCH: { > - static const enum hvm_task_switch_reason reasons[] = { > + static const int8_t reasons[] = { > TSW_call_or_int, TSW_iret, TSW_jmp, TSW_call_or_int > }; ... given our general preference of unsigned types when values can't become negative, why not uint8_t? As an aside, elsewhere I saw people starting to convert code because apparently gcc 10 will warn about enum type mismatches. I didn't investigate yet whether that's just for enum -> enum conversions, or also for enum <- / -> integer ones. Of course it wouldn't be the end of the world if we had to revert the change above; did you consider the alternative of making the enum a __packed one (which would avoid potential issues like the one named)? Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
> From: Andrew Cooper <andrew.cooper3@citrix.com> > Sent: Tuesday, January 7, 2020 8:25 PM > > No need to use 4-byte integers to store two bits of information. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
© 2016 - 2024 Red Hat, Inc.