From: "Jan Beulich" Subject: [PATCH v2 2/2] x86: don't rely on __softirq_pending to be the first field in irq_cpustat_t Date: Fri, 01 Mar 2013 10:57:48 +0000 Message-ID: <513097BC02000078000C2512@nat28.tlf.novell.com> References: <512F913902000078000C222A@nat28.tlf.novell.com> <513095DA02000078000C24FD@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3C0C50BC.2__=" Return-path: In-Reply-To: <513095DA02000078000C24FD@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Keir Fraser Cc: Andrew Cooper , Malcolm Crossley , Tim Deegan , "xen-devel@lists.xen.org" 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. --=__Part3C0C50BC.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This is even more so as the field doesn't have a comment to that effect in the structure definition. Once modifying the respective assembly code, also convert the IRQSTAT_shift users to do a 32-bit shift only (as we won't support 48M CPUs any time soon) and use "cmpl" instead of "testl" when checking the field (both reducing code size). Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/svm/entry.S +++ b/xen/arch/x86/hvm/svm/entry.S @@ -41,10 +41,10 @@ ENTRY(svm_asm_do_resume) CLGI =20 mov VCPU_processor(%rbx),%eax - shl $IRQSTAT_shift,%rax - lea irq_stat(%rip),%rdx - testl $~0,(%rdx,%rax,1) - jnz .Lsvm_process_softirqs + shl $IRQSTAT_shift,%eax + lea irq_stat+IRQSTAT_softirq_pending(%rip),%rdx + cmpl $0,(%rdx,%rax,1) + jne .Lsvm_process_softirqs =20 testb $0, VCPU_nsvm_hap_enabled(%rbx) UNLIKELY_START(nz, nsvm_hap) --- a/xen/arch/x86/hvm/vmx/entry.S +++ b/xen/arch/x86/hvm/vmx/entry.S @@ -97,8 +97,8 @@ vmx_asm_do_vmentry: cli =20 mov VCPU_processor(%rbx),%eax - shl $IRQSTAT_shift,%rax - lea irq_stat(%rip),%rdx + shl $IRQSTAT_shift,%eax + lea irq_stat+IRQSTAT_softirq_pending(%rip),%rdx cmpl $0,(%rdx,%rax,1) jnz .Lvmx_process_softirqs =20 --- a/xen/arch/x86/x86_64/asm-offsets.c +++ b/xen/arch/x86/x86_64/asm-offsets.c @@ -162,6 +162,7 @@ void __dummy__(void) #endif =20 DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t))); + OFFSET(IRQSTAT_softirq_pending, irq_cpustat_t, __softirq_pending); BLANK(); =20 OFFSET(CPUINFO86_ext_features, struct cpuinfo_x86, x86_capability[1]);= --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -96,10 +96,10 @@ ENTRY(compat_test_all_events) cli # tests must not race interrupts /*compat_test_softirqs:*/ movl VCPU_processor(%rbx),%eax - shlq $IRQSTAT_shift,%rax - leaq irq_stat(%rip),%rcx - testl $~0,(%rcx,%rax,1) - jnz compat_process_softirqs + shll $IRQSTAT_shift,%eax + leaq irq_stat+IRQSTAT_softirq_pending(%rip),%rcx + cmpl $0,(%rcx,%rax,1) + jne compat_process_softirqs testb $1,VCPU_mce_pending(%rbx) jnz compat_process_mce .Lcompat_test_guest_nmi: --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -195,8 +195,8 @@ test_all_events: cli # tests must not race interrupts /*test_softirqs:*/ =20 movl VCPU_processor(%rbx),%eax - shl $IRQSTAT_shift,%rax - leaq irq_stat(%rip),%rcx + shll $IRQSTAT_shift,%eax + leaq irq_stat+IRQSTAT_softirq_pending(%rip),%rcx cmpl $0,(%rcx,%rax,1) jne process_softirqs testb $1,VCPU_mce_pending(%rbx) @@ -663,7 +663,7 @@ handle_ist_exception: /* Send an IPI to ourselves to cover for the lack of event = checking. */ movl VCPU_processor(%rbx),%eax shll $IRQSTAT_shift,%eax - leaq irq_stat(%rip),%rcx + leaq irq_stat+IRQSTAT_softirq_pending(%rip),%rcx cmpl $0,(%rcx,%rax,1) je 1f movl $EVENT_CHECK_VECTOR,%edi --=__Part3C0C50BC.2__= Content-Type: text/plain; name="x86-IRQSTAT_softirq_pending.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-IRQSTAT_softirq_pending.patch" x86: don't rely on __softirq_pending to be the first field in irq_cpustat_t= =0A=0AThis is even more so as the field doesn't have a comment to that = effect=0Ain the structure definition.=0A=0AOnce modifying the respective = assembly code, also convert the=0AIRQSTAT_shift users to do a 32-bit shift = only (as we won't support 48M=0ACPUs any time soon) and use "cmpl" instead = of "testl" when checking the=0Afield (both reducing code size).=0A=0ASigned= -off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/hvm/svm/en= try.S=0A+++ b/xen/arch/x86/hvm/svm/entry.S=0A@@ -41,10 +41,10 @@ ENTRY(svm_= asm_do_resume)=0A CLGI=0A =0A mov VCPU_processor(%rbx),%ea= x=0A- shl $IRQSTAT_shift,%rax=0A- lea irq_stat(%rip),%rdx= =0A- testl $~0,(%rdx,%rax,1)=0A- jnz .Lsvm_process_softirqs= =0A+ shl $IRQSTAT_shift,%eax=0A+ lea irq_stat+IRQSTAT_softi= rq_pending(%rip),%rdx=0A+ cmpl $0,(%rdx,%rax,1)=0A+ jne = .Lsvm_process_softirqs=0A =0A testb $0, VCPU_nsvm_hap_enabled(%rbx)= =0A UNLIKELY_START(nz, nsvm_hap)=0A--- a/xen/arch/x86/hvm/vmx/entry.S=0A+++= b/xen/arch/x86/hvm/vmx/entry.S=0A@@ -97,8 +97,8 @@ vmx_asm_do_vmentry:=0A = cli=0A =0A mov VCPU_processor(%rbx),%eax=0A- shl = $IRQSTAT_shift,%rax=0A- lea irq_stat(%rip),%rdx=0A+ shl = $IRQSTAT_shift,%eax=0A+ lea irq_stat+IRQSTAT_softirq_pending(%rip),= %rdx=0A cmpl $0,(%rdx,%rax,1)=0A jnz .Lvmx_process_softirq= s=0A =0A--- a/xen/arch/x86/x86_64/asm-offsets.c=0A+++ b/xen/arch/x86/x86_64= /asm-offsets.c=0A@@ -162,6 +162,7 @@ void __dummy__(void)=0A #endif=0A =0A = DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));=0A+ OFFSET(IRQS= TAT_softirq_pending, irq_cpustat_t, __softirq_pending);=0A BLANK();=0A = =0A OFFSET(CPUINFO86_ext_features, struct cpuinfo_x86, x86_capability[1= ]);=0A--- a/xen/arch/x86/x86_64/compat/entry.S=0A+++ b/xen/arch/x86/x86_64/= compat/entry.S=0A@@ -96,10 +96,10 @@ ENTRY(compat_test_all_events)=0A = cli # tests must not race interrupts=0A = /*compat_test_softirqs:*/=0A movl VCPU_processor(%rbx),%eax=0A- = shlq $IRQSTAT_shift,%rax=0A- leaq irq_stat(%rip),%rcx=0A- = testl $~0,(%rcx,%rax,1)=0A- jnz compat_process_softirqs=0A+ = shll $IRQSTAT_shift,%eax=0A+ leaq irq_stat+IRQSTAT_softirq_pe= nding(%rip),%rcx=0A+ cmpl $0,(%rcx,%rax,1)=0A+ jne = compat_process_softirqs=0A testb $1,VCPU_mce_pending(%rbx)=0A = jnz compat_process_mce=0A .Lcompat_test_guest_nmi:=0A--- a/xen/arch/x8= 6/x86_64/entry.S=0A+++ b/xen/arch/x86/x86_64/entry.S=0A@@ -195,8 +195,8 @@ = test_all_events:=0A cli # tests must = not race interrupts=0A /*test_softirqs:*/ =0A movl VCPU_processor= (%rbx),%eax=0A- shl $IRQSTAT_shift,%rax=0A- leaq = irq_stat(%rip),%rcx=0A+ shll $IRQSTAT_shift,%eax=0A+ leaq = irq_stat+IRQSTAT_softirq_pending(%rip),%rcx=0A cmpl $0,(%rcx,%rax,= 1)=0A jne process_softirqs=0A testb $1,VCPU_mce_pending(%= rbx)=0A@@ -663,7 +663,7 @@ handle_ist_exception:=0A /* Send an IPI = to ourselves to cover for the lack of event checking. */=0A movl = VCPU_processor(%rbx),%eax=0A shll $IRQSTAT_shift,%eax=0A- = leaq irq_stat(%rip),%rcx=0A+ leaq irq_stat+IRQSTAT_softirq_pending= (%rip),%rcx=0A cmpl $0,(%rcx,%rax,1)=0A je 1f=0A = movl $EVENT_CHECK_VECTOR,%edi=0A --=__Part3C0C50BC.2__= 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 --=__Part3C0C50BC.2__=--