From: "Jan Beulich" Subject: [PATCH] x86: use only a single branch for upcall-pending exit path checks Date: Tue, 11 Sep 2012 12:53:02 +0100 Message-ID: <504F423E020000780009A91D@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part5F6E4D0E.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part5F6E4D0E.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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 --=__Part5F6E4D0E.0__= Content-Type: text/plain; name="x86-upcall-pending.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-upcall-pending.patch" x86: use only a single branch for upcall-pending exit path checks=0A=0AThis= utilizes the fact that the two bytes of interest are adjacent to=0Aone = another and that the resulting 16-bit values of interest are within=0Aa = contiguous range of numbers.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/x86_32/entry.S=0A+++ b/xen/arch/x86/x86_32/en= try.S=0A@@ -219,10 +219,10 @@ test_all_events:=0A jnz process_nmi= =0A test_guest_events:=0A movl VCPU_vcpu_info(%ebx),%eax=0A- = testb $0xFF,VCPUINFO_upcall_mask(%eax)=0A- jnz restore_all_guest= =0A- testb $0xFF,VCPUINFO_upcall_pending(%eax)=0A- jz = restore_all_guest=0A+ movzwl VCPUINFO_upcall_pending(%eax),%eax=0A+ = decl %eax=0A+ cmpl $0xfe,%eax=0A+ ja restore_all_gue= st=0A /*process_guest_events:*/=0A sti=0A leal VCPU_trap_bo= unce(%ebx),%edx=0A--- a/xen/arch/x86/x86_64/compat/entry.S=0A+++ b/xen/arch= /x86/x86_64/compat/entry.S=0A@@ -108,10 +108,10 @@ ENTRY(compat_test_all_ev= ents)=0A jnz compat_process_nmi=0A compat_test_guest_events:=0A = movq VCPU_vcpu_info(%rbx),%rax=0A- testb $0xFF,COMPAT_VCPUIN= FO_upcall_mask(%rax)=0A- jnz compat_restore_all_guest=0A- = testb $0xFF,COMPAT_VCPUINFO_upcall_pending(%rax)=0A- jz = compat_restore_all_guest=0A+ movzwl COMPAT_VCPUINFO_upcall_pending(%= rax),%eax=0A+ decl %eax=0A+ cmpl $0xfe,%eax=0A+ ja = compat_restore_all_guest=0A /*compat_process_guest_events:*/=0A = sti=0A leaq VCPU_trap_bounce(%rbx),%rdx=0A--- a/xen/arch/x86/x86_6= 4/entry.S=0A+++ b/xen/arch/x86/x86_64/entry.S=0A@@ -199,8 +199,8 @@ = test_all_events:=0A movl VCPU_processor(%rbx),%eax=0A shl = $IRQSTAT_shift,%rax=0A leaq irq_stat(%rip),%rcx=0A- = testl $~0,(%rcx,%rax,1)=0A- jnz process_softirqs=0A+ cmpl = $0,(%rcx,%rax,1)=0A+ jne process_softirqs=0A testb = $1,VCPU_mce_pending(%rbx)=0A jnz process_mce=0A .Ltest_guest_nmi:= =0A@@ -208,10 +208,10 @@ test_all_events:=0A jnz process_nmi=0A = test_guest_events:=0A movq VCPU_vcpu_info(%rbx),%rax=0A- = testb $0xFF,VCPUINFO_upcall_mask(%rax)=0A- jnz restore_all_guest= =0A- testb $0xFF,VCPUINFO_upcall_pending(%rax)=0A- jz = restore_all_guest=0A+ movzwl VCPUINFO_upcall_pending(%rax),%eax=0A+ = decl %eax=0A+ cmpl $0xfe,%eax=0A+ ja restore_all_= guest=0A /*process_guest_events:*/=0A sti=0A leaq = VCPU_trap_bounce(%rbx),%rdx=0A --=__Part5F6E4D0E.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part5F6E4D0E.0__=--