Skip to contentSkip to conversation

"monitor"-ed address and IPI reduction

DISCUSSION Jan Beulich 3 participants 5 messages Mar 9, 2010 – Mar 10, 2010

lore
Share & tools
lore
#0 lore raw

What is the point of specifying "current" as the address to monitor? The memory location of interest really is irq_stat[cpu].__softirq_pending, and if that was used it would then also be possible to actually avoid sending IPIs when monitor/mwait are in use, as is being done on Linux.

Jan

#1 lore raw
Quoted 1 line · Jan Beulich

What is the point of specifying "current" as the address to monitor?

You provide a good point. The original purpose to monitor "current" is to avoid accidentally wakeup while relying on ipi for waking up mechanism.

Quoted 4 lines

The memory location of interest really is irq_stat[cpu].__softirq_pending, and if that was used it would then also be possible to actually avoid sending IPIs when monitor/mwait are in use, as is being done on Linux.

I agree that we can have a try on this. Waking up cpu by mem write should be more efficient for monitor/mwait case.

Jimmy

#2 lore raw
Quoted 7 lines · Gang
Quoted 1 line · Jan Beulich

What is the point of specifying "current" as the address to monitor?

You provide a good point. The original purpose to monitor "current" is to avoid accidentally wakeup while relying on ipi for waking up mechanism.

Quoted 7 lines
Quoted 4 lines

The memory location of interest really is irq_stat[cpu].__softirq_pending, and if that was used it would then also be possible to actually avoid sending IPIs when monitor/mwait are in use, as is being done on Linux.

I agree that we can have a try on this. Waking up cpu by mem write should be more efficient for monitor/mwait case.

Here is a patch to monitor "sortirq_pending" instead of "current". The IPI reduction part may be a bit complex, can we hold it for post-4.0?

Jimmy
---------------------------
CPUIDLE: monitor "sortirq_pending" instead of "current"

xen/arch/x86/acpi/cpu_idle.c +6 -2
diff -r 132ac04cbdba xen/arch/x86/acpi/cpu_idle.c
@@ -142,9 +142,13 @@ static void acpi_safe_halt(void)
 
 static void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
 {
-    __monitor((void *)current, 0, 0);
+    int cpu = smp_processor_id();
+
+    __monitor((void *)&softirq_pending(cpu), 0, 0);
+
     smp_mb();
-    __mwait(eax, ecx);
+    if ( !softirq_pending(cpu) )
+        __mwait(eax, ecx);
 }
 
 static void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)

CPUIDLE: monitor "sortirq_pending" instead of "current"

xen/arch/x86/acpi/cpu_idle.c +6 -2
diff -r 132ac04cbdba xen/arch/x86/acpi/cpu_idle.c
@@ -142,9 +142,13 @@ static void acpi_safe_halt(void)
 
 static void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
 {
-    __monitor((void *)current, 0, 0);
+    int cpu = smp_processor_id();
+
+    __monitor((void *)&softirq_pending(cpu), 0, 0);
+
     smp_mb();
-    __mwait(eax, ecx);
+    if ( !softirq_pending(cpu) )
+        __mwait(eax, ecx);
 }
 
 static void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 5 lines · Gang
Quoted 2 lines

I agree that we can have a try on this. Waking up cpu by mem write should be more efficient for monitor/mwait case.

Here is a patch to monitor "sortirq_pending" instead of "current". The IPI reduction part may be a bit complex, can we hold it for post-4.0?

This whole thing is for post 4.0 now.

-- Keir

#4 lore raw
Quoted 10 lines · Keir Fraser
Quoted 6 lines · Gang
Quoted 2 lines

I agree that we can have a try on this. Waking up cpu by mem write should be more efficient for monitor/mwait case.

Here is a patch to monitor "sortirq_pending" instead of "current". The IPI reduction part may be a bit complex, can we hold it for post-4.0?

This whole thing is for post 4.0 now.

That's fine.

Jimmy