From: "Jan Beulich" Subject: Re: [PATCH, RFC] x86/HVM: batch vCPU wakeups Date: Wed, 10 Sep 2014 14:10:01 +0100 Message-ID: <541069C9020000780003345F@mail.emea.novell.com> References: <540ED7810200007800032678@mail.emea.novell.com> <20140909212925.GC82414@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartD8ED91B9.1__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XRheu-0000yF-UE for xen-devel@lists.xenproject.org; Wed, 10 Sep 2014 13:10:05 +0000 In-Reply-To: <20140909212925.GC82414@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: Ian Campbell , xen-devel , Keir Fraser , Ian Jackson 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. --=__PartD8ED91B9.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline >>> On 09.09.14 at 23:29, wrote: > At 09:33 +0100 on 09 Sep (1410251617), Jan Beulich wrote: >> RFC for two reasons: >> 1) I started to consider elimination of the event-check IPIs in a more >> general way when MONITOR/MWAIT is in use: As long as the remote CPU >> is known to be MWAITing (or in the process of resuming after MWAIT), >> the write of softirq_pending(cpu) ought to be sufficient to wake it. >> This would yield the patch here pointless on MONITOR/MWAIT capable >> hardware. >=20 > That's a promising line. And it alone gives quite a bit better performance than batching, at least on the hardware I can directly test on. The maxima go down even more significantly than the average values. Putting the batching back on top improves the average delivery times a little further, but surprisingly makes the maxima go back up to almost where they were with just batching. So far I haven't been able to think of an explanation for this. But while attaching the raw patch here for reference, I'll want to wait with formal submission until I've seen the numbers from the big box (also to decide whether to include or drop the batching one). Jan --=__PartD8ED91B9.1__= Content-Type: text/plain; name="x86-suppress-event-check-IPI.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-suppress-event-check-IPI.patch" =0AOne aspect worth noting is that cpumask_raise_softirq() gets brought = in=0Async here with cpu_raise_softirq() in that now both don't attempt = to=0Araise a self-IPI on the processing CPU.=0A=0A--- a/xen/arch/x86/acpi/c= pu_idle.c=0A+++ b/xen/arch/x86/acpi/cpu_idle.c=0A@@ -340,6 +340,16 @@ void = cpuidle_wakeup_mwait(cpumask_t *mas=0A cpumask_andnot(mask, mask, = &target);=0A }=0A =0A+bool_t arch_skip_send_event_check(unsigned int = cpu)=0A+{=0A+ /*=0A+ * This relies on softirq_pending() and = mwait_wakeup() to access data=0A+ * on the same cache line.=0A+ = */=0A+ smp_mb();=0A+ return !!cpumask_test_cpu(cpu, &cpuidle_mwait_fl= ags);=0A+}=0A+=0A void mwait_idle_with_hints(unsigned int eax, unsigned = int ecx)=0A {=0A unsigned int cpu =3D smp_processor_id();=0A@@ -359,7 = +369,7 @@ void mwait_idle_with_hints(unsigned int =0A * Timer = deadline passing is the event on which we will be woken via=0A * = cpuidle_mwait_wakeup. So check it now that the location is armed.=0A = */=0A- if ( expires > NOW() || expires =3D=3D 0 )=0A+ if ( (expires = > NOW() || expires =3D=3D 0) && !softirq_pending(cpu) )=0A {=0A = cpumask_set_cpu(cpu, &cpuidle_mwait_flags);=0A __mwait(eax, = ecx);=0A--- a/xen/common/softirq.c=0A+++ b/xen/common/softirq.c=0A@@ = -70,12 +70,14 @@ void open_softirq(int nr, softirq_handle=0A =0A void = cpumask_raise_softirq(const cpumask_t *mask, unsigned int nr)=0A {=0A- = int cpu;=0A+ unsigned int cpu, this_cpu =3D smp_processor_id();=0A = cpumask_t send_mask;=0A =0A cpumask_clear(&send_mask);=0A = for_each_cpu(cpu, mask)=0A- if ( !test_and_set_bit(nr, &softirq_pend= ing(cpu)) )=0A+ if ( !test_and_set_bit(nr, &softirq_pending(cpu)) = &&=0A+ cpu !=3D this_cpu &&=0A+ !arch_skip_send_eve= nt_check(cpu) )=0A cpumask_set_cpu(cpu, &send_mask);=0A =0A = smp_send_event_check_mask(&send_mask);=0A@@ -84,7 +86,8 @@ void cpumask_ra= ise_softirq(const cpumask=0A void cpu_raise_softirq(unsigned int cpu, = unsigned int nr)=0A {=0A if ( !test_and_set_bit(nr, &softirq_pending(cp= u))=0A- && (cpu !=3D smp_processor_id()) )=0A+ && (cpu = !=3D smp_processor_id())=0A+ && !arch_skip_send_event_check(cpu) = )=0A smp_send_event_check_cpu(cpu);=0A }=0A =0A--- a/xen/include/as= m-arm/softirq.h=0A+++ b/xen/include/asm-arm/softirq.h=0A@@ -3,6 +3,8 @@=0A = =0A #define NR_ARCH_SOFTIRQS 0=0A =0A+#define arch_skip_send_event_ch= eck(cpu) 0=0A+=0A #endif /* __ASM_SOFTIRQ_H__ */=0A /*=0A * Local = variables:=0A--- a/xen/include/asm-x86/softirq.h=0A+++ b/xen/include/asm-x8= 6/softirq.h=0A@@ -9,4 +9,6 @@=0A #define PCI_SERR_SOFTIRQ (NR_COMMON_= SOFTIRQS + 4)=0A #define NR_ARCH_SOFTIRQS 5=0A =0A+bool_t arch_skip_s= end_event_check(unsigned int cpu);=0A+=0A #endif /* __ASM_SOFTIRQ_H__ */=0A --=__PartD8ED91B9.1__= 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 --=__PartD8ED91B9.1__=--