* [PATCH] x86: use only a single branch for upcall-pending exit path checks
@ 2012-09-11 11:53 Jan Beulich
2012-09-11 13:33 ` Keir Fraser
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2012-09-11 11:53 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 2461 bytes --]
This utilizes the fact that the two bytes of interest are adjacent to
one another and that the resulting 16-bit values of interest are within
a contiguous range of numbers.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/x86_32/entry.S
+++ b/xen/arch/x86/x86_32/entry.S
@@ -219,10 +219,10 @@ test_all_events:
jnz process_nmi
test_guest_events:
movl VCPU_vcpu_info(%ebx),%eax
- testb $0xFF,VCPUINFO_upcall_mask(%eax)
- jnz restore_all_guest
- testb $0xFF,VCPUINFO_upcall_pending(%eax)
- jz restore_all_guest
+ movzwl VCPUINFO_upcall_pending(%eax),%eax
+ decl %eax
+ cmpl $0xfe,%eax
+ ja restore_all_guest
/*process_guest_events:*/
sti
leal VCPU_trap_bounce(%ebx),%edx
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -108,10 +108,10 @@ ENTRY(compat_test_all_events)
jnz compat_process_nmi
compat_test_guest_events:
movq VCPU_vcpu_info(%rbx),%rax
- testb $0xFF,COMPAT_VCPUINFO_upcall_mask(%rax)
- jnz compat_restore_all_guest
- testb $0xFF,COMPAT_VCPUINFO_upcall_pending(%rax)
- jz compat_restore_all_guest
+ movzwl COMPAT_VCPUINFO_upcall_pending(%rax),%eax
+ decl %eax
+ cmpl $0xfe,%eax
+ ja compat_restore_all_guest
/*compat_process_guest_events:*/
sti
leaq VCPU_trap_bounce(%rbx),%rdx
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -199,8 +199,8 @@ test_all_events:
movl VCPU_processor(%rbx),%eax
shl $IRQSTAT_shift,%rax
leaq irq_stat(%rip),%rcx
- testl $~0,(%rcx,%rax,1)
- jnz process_softirqs
+ cmpl $0,(%rcx,%rax,1)
+ jne process_softirqs
testb $1,VCPU_mce_pending(%rbx)
jnz process_mce
.Ltest_guest_nmi:
@@ -208,10 +208,10 @@ test_all_events:
jnz process_nmi
test_guest_events:
movq VCPU_vcpu_info(%rbx),%rax
- testb $0xFF,VCPUINFO_upcall_mask(%rax)
- jnz restore_all_guest
- testb $0xFF,VCPUINFO_upcall_pending(%rax)
- jz restore_all_guest
+ movzwl VCPUINFO_upcall_pending(%rax),%eax
+ decl %eax
+ cmpl $0xfe,%eax
+ ja restore_all_guest
/*process_guest_events:*/
sti
leaq VCPU_trap_bounce(%rbx),%rdx
[-- Attachment #2: x86-upcall-pending.patch --]
[-- Type: text/plain, Size: 2524 bytes --]
x86: use only a single branch for upcall-pending exit path checks
This utilizes the fact that the two bytes of interest are adjacent to
one another and that the resulting 16-bit values of interest are within
a contiguous range of numbers.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/x86_32/entry.S
+++ b/xen/arch/x86/x86_32/entry.S
@@ -219,10 +219,10 @@ test_all_events:
jnz process_nmi
test_guest_events:
movl VCPU_vcpu_info(%ebx),%eax
- testb $0xFF,VCPUINFO_upcall_mask(%eax)
- jnz restore_all_guest
- testb $0xFF,VCPUINFO_upcall_pending(%eax)
- jz restore_all_guest
+ movzwl VCPUINFO_upcall_pending(%eax),%eax
+ decl %eax
+ cmpl $0xfe,%eax
+ ja restore_all_guest
/*process_guest_events:*/
sti
leal VCPU_trap_bounce(%ebx),%edx
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -108,10 +108,10 @@ ENTRY(compat_test_all_events)
jnz compat_process_nmi
compat_test_guest_events:
movq VCPU_vcpu_info(%rbx),%rax
- testb $0xFF,COMPAT_VCPUINFO_upcall_mask(%rax)
- jnz compat_restore_all_guest
- testb $0xFF,COMPAT_VCPUINFO_upcall_pending(%rax)
- jz compat_restore_all_guest
+ movzwl COMPAT_VCPUINFO_upcall_pending(%rax),%eax
+ decl %eax
+ cmpl $0xfe,%eax
+ ja compat_restore_all_guest
/*compat_process_guest_events:*/
sti
leaq VCPU_trap_bounce(%rbx),%rdx
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -199,8 +199,8 @@ test_all_events:
movl VCPU_processor(%rbx),%eax
shl $IRQSTAT_shift,%rax
leaq irq_stat(%rip),%rcx
- testl $~0,(%rcx,%rax,1)
- jnz process_softirqs
+ cmpl $0,(%rcx,%rax,1)
+ jne process_softirqs
testb $1,VCPU_mce_pending(%rbx)
jnz process_mce
.Ltest_guest_nmi:
@@ -208,10 +208,10 @@ test_all_events:
jnz process_nmi
test_guest_events:
movq VCPU_vcpu_info(%rbx),%rax
- testb $0xFF,VCPUINFO_upcall_mask(%rax)
- jnz restore_all_guest
- testb $0xFF,VCPUINFO_upcall_pending(%rax)
- jz restore_all_guest
+ movzwl VCPUINFO_upcall_pending(%rax),%eax
+ decl %eax
+ cmpl $0xfe,%eax
+ ja restore_all_guest
/*process_guest_events:*/
sti
leaq VCPU_trap_bounce(%rbx),%rdx
[-- 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] 2+ messages in thread
* Re: [PATCH] x86: use only a single branch for upcall-pending exit path checks
2012-09-11 11:53 [PATCH] x86: use only a single branch for upcall-pending exit path checks Jan Beulich
@ 2012-09-11 13:33 ` Keir Fraser
0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2012-09-11 13:33 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 11/09/2012 12:53, "Jan Beulich" <JBeulich@suse.com> wrote:
> This utilizes the fact that the two bytes of interest are adjacent to
> one another and that the resulting 16-bit values of interest are within
> a contiguous range of numbers.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
> --- a/xen/arch/x86/x86_32/entry.S
> +++ b/xen/arch/x86/x86_32/entry.S
> @@ -219,10 +219,10 @@ test_all_events:
> jnz process_nmi
> test_guest_events:
> movl VCPU_vcpu_info(%ebx),%eax
> - testb $0xFF,VCPUINFO_upcall_mask(%eax)
> - jnz restore_all_guest
> - testb $0xFF,VCPUINFO_upcall_pending(%eax)
> - jz restore_all_guest
> + movzwl VCPUINFO_upcall_pending(%eax),%eax
> + decl %eax
> + cmpl $0xfe,%eax
> + ja restore_all_guest
> /*process_guest_events:*/
> sti
> leal VCPU_trap_bounce(%ebx),%edx
> --- a/xen/arch/x86/x86_64/compat/entry.S
> +++ b/xen/arch/x86/x86_64/compat/entry.S
> @@ -108,10 +108,10 @@ ENTRY(compat_test_all_events)
> jnz compat_process_nmi
> compat_test_guest_events:
> movq VCPU_vcpu_info(%rbx),%rax
> - testb $0xFF,COMPAT_VCPUINFO_upcall_mask(%rax)
> - jnz compat_restore_all_guest
> - testb $0xFF,COMPAT_VCPUINFO_upcall_pending(%rax)
> - jz compat_restore_all_guest
> + movzwl COMPAT_VCPUINFO_upcall_pending(%rax),%eax
> + decl %eax
> + cmpl $0xfe,%eax
> + ja compat_restore_all_guest
> /*compat_process_guest_events:*/
> sti
> leaq VCPU_trap_bounce(%rbx),%rdx
> --- a/xen/arch/x86/x86_64/entry.S
> +++ b/xen/arch/x86/x86_64/entry.S
> @@ -199,8 +199,8 @@ test_all_events:
> movl VCPU_processor(%rbx),%eax
> shl $IRQSTAT_shift,%rax
> leaq irq_stat(%rip),%rcx
> - testl $~0,(%rcx,%rax,1)
> - jnz process_softirqs
> + cmpl $0,(%rcx,%rax,1)
> + jne process_softirqs
> testb $1,VCPU_mce_pending(%rbx)
> jnz process_mce
> .Ltest_guest_nmi:
> @@ -208,10 +208,10 @@ test_all_events:
> jnz process_nmi
> test_guest_events:
> movq VCPU_vcpu_info(%rbx),%rax
> - testb $0xFF,VCPUINFO_upcall_mask(%rax)
> - jnz restore_all_guest
> - testb $0xFF,VCPUINFO_upcall_pending(%rax)
> - jz restore_all_guest
> + movzwl VCPUINFO_upcall_pending(%rax),%eax
> + decl %eax
> + cmpl $0xfe,%eax
> + ja restore_all_guest
> /*process_guest_events:*/
> sti
> leaq VCPU_trap_bounce(%rbx),%rdx
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-11 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 11:53 [PATCH] x86: use only a single branch for upcall-pending exit path checks Jan Beulich
2012-09-11 13:33 ` Keir Fraser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).