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

Re: [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[]



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@xxxxxxxxxx>

In principle
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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