All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[]
@ 2020-01-07 12:25 Andrew Cooper
  2020-01-07 13:20 ` Jan Beulich
  2020-01-19  4:09 ` Tian, Kevin
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Cooper @ 2020-01-07 12:25 UTC (permalink / raw)
  To: Xen-devel
  Cc: Kevin Tian, Jan Beulich, Wei Liu, Andrew Cooper, Jun Nakajima,
	Roger Pau Monné

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[]
  2020-01-07 12:25 [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[] Andrew Cooper
@ 2020-01-07 13:20 ` Jan Beulich
  2020-01-19  4:09 ` Tian, Kevin
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2020-01-07 13:20 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Xen-devel, Kevin Tian, Jun Nakajima, Wei Liu, Roger Pau Monné

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[]
  2020-01-07 12:25 [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[] Andrew Cooper
  2020-01-07 13:20 ` Jan Beulich
@ 2020-01-19  4:09 ` Tian, Kevin
  1 sibling, 0 replies; 3+ messages in thread
From: Tian, Kevin @ 2020-01-19  4:09 UTC (permalink / raw)
  To: Andrew Cooper, Xen-devel
  Cc: Nakajima, Jun, Wei Liu, Jan Beulich, Roger Pau Monné

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-19  4:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 12:25 [Xen-devel] [PATCH] x86/vmx: Shrink TASK_SWITCH's hvm_task_switch_reason reasons[] Andrew Cooper
2020-01-07 13:20 ` Jan Beulich
2020-01-19  4:09 ` Tian, Kevin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.