All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads
@ 2015-05-08 12:08 Jan Beulich
  2015-05-08 12:36 ` Andrew Cooper
  2015-05-11 15:15 ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2015-05-08 12:08 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

1- or 2-byte operations never alter the high halves of registers.

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

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2234,7 +2234,7 @@ static int emulate_privileged_op(struct 
             if ( op_bytes == 4 )
                 regs->eax = 0;
             else
-                regs->eax &= ~((1u << (op_bytes * 8)) - 1);
+                regs->eax &= ~((1 << (op_bytes * 8)) - 1);
             regs->eax |= guest_io_read(port, op_bytes, v, regs);
         }
         bpmatch = check_guest_io_breakpoint(v, port, op_bytes);




[-- Attachment #2: x86-PV-IO-read-high-bits.patch --]
[-- Type: text/plain, Size: 667 bytes --]

x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads

1- or 2-byte operations never alter the high halves of registers.

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

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2234,7 +2234,7 @@ static int emulate_privileged_op(struct 
             if ( op_bytes == 4 )
                 regs->eax = 0;
             else
-                regs->eax &= ~((1u << (op_bytes * 8)) - 1);
+                regs->eax &= ~((1 << (op_bytes * 8)) - 1);
             regs->eax |= guest_io_read(port, op_bytes, v, regs);
         }
         bpmatch = check_guest_io_breakpoint(v, port, op_bytes);

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads
  2015-05-08 12:08 [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads Jan Beulich
@ 2015-05-08 12:36 ` Andrew Cooper
  2015-05-11 15:15 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2015-05-08 12:36 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser

On 08/05/15 13:08, Jan Beulich wrote:
> 1- or 2-byte operations never alter the high halves of registers.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -2234,7 +2234,7 @@ static int emulate_privileged_op(struct 
>              if ( op_bytes == 4 )
>                  regs->eax = 0;
>              else
> -                regs->eax &= ~((1u << (op_bytes * 8)) - 1);
> +                regs->eax &= ~((1 << (op_bytes * 8)) - 1);
>              regs->eax |= guest_io_read(port, op_bytes, v, regs);
>          }
>          bpmatch = check_guest_io_breakpoint(v, port, op_bytes);
>
>
>

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

* Re: [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads
  2015-05-08 12:08 [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads Jan Beulich
  2015-05-08 12:36 ` Andrew Cooper
@ 2015-05-11 15:15 ` Konrad Rzeszutek Wilk
  2015-05-12  9:27   ` Jan Beulich
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2015-05-11 15:15 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser, Andrew Cooper

On Fri, May 08, 2015 at 01:08:05PM +0100, Jan Beulich wrote:
> 1- or 2-byte operations never alter the high halves of registers.
> 

That is impressive. How possibly did you spot this?

Was it due to reviewing some other code that got you looking
at this?

Thanks!

> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -2234,7 +2234,7 @@ static int emulate_privileged_op(struct 
>              if ( op_bytes == 4 )
>                  regs->eax = 0;
>              else
> -                regs->eax &= ~((1u << (op_bytes * 8)) - 1);
> +                regs->eax &= ~((1 << (op_bytes * 8)) - 1);
>              regs->eax |= guest_io_read(port, op_bytes, v, regs);
>          }
>          bpmatch = check_guest_io_breakpoint(v, port, op_bytes);
> 
> 
> 

> x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads
> 
> 1- or 2-byte operations never alter the high halves of registers.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -2234,7 +2234,7 @@ static int emulate_privileged_op(struct 
>              if ( op_bytes == 4 )
>                  regs->eax = 0;
>              else
> -                regs->eax &= ~((1u << (op_bytes * 8)) - 1);
> +                regs->eax &= ~((1 << (op_bytes * 8)) - 1);
>              regs->eax |= guest_io_read(port, op_bytes, v, regs);
>          }
>          bpmatch = check_guest_io_breakpoint(v, port, op_bytes);

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads
  2015-05-11 15:15 ` Konrad Rzeszutek Wilk
@ 2015-05-12  9:27   ` Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2015-05-12  9:27 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Andrew Cooper, Keir Fraser, xen-devel

>>> On 11.05.15 at 17:15, <konrad.wilk@oracle.com> wrote:
> On Fri, May 08, 2015 at 01:08:05PM +0100, Jan Beulich wrote:
>> 1- or 2-byte operations never alter the high halves of registers.
>> 
> 
> That is impressive. How possibly did you spot this?
> 
> Was it due to reviewing some other code that got you looking
> at this?

Yes, while reviewing the patches from Roger (or rather investigating
the need to revert).

Jan

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

end of thread, other threads:[~2015-05-12  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 12:08 [PATCH] x86: don't clear high 32 bits of RAX on sub-word guest I/O port reads Jan Beulich
2015-05-08 12:36 ` Andrew Cooper
2015-05-11 15:15 ` Konrad Rzeszutek Wilk
2015-05-12  9:27   ` Jan Beulich

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.