Re: broken suspend (sched related) [Was: 2.6.24-rc4-mm1]

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jiri Slaby <jirislaby@...>
Cc: Andrew Morton <akpm@...>, <linux-kernel@...>, Rafael J. Wysocki <rjw@...>, Arjan van de Ven <arjan@...>, Thomas Gleixner <tglx@...>, Linux-pm mailing list <linux-pm@...>
Date: Sunday, December 9, 2007 - 4:06 am

* Jiri Slaby <jirislaby@gmail.com> wrote:


not a dumb question at all - i forgot about it. Find the updated patch 
below.

( sidenote: this shows the x86 unification concept in action. You
  noticed the missing _64.c probably because you saw a _32.c file 
  modified in the patch and the rule is that if we modify a _32.c file 
  then the matching _64.c file needs to be updated too. If this had been
  an old-style pre-unification arch/i386/kernel/process.c file you'd not
  have been able to tell this from just looking at the patch file - and
  we'd possibly have missed to include a fix on the 64-bit side. With
  the unification of files we are realizing it how many times this
  happened in the past (and went unnoticed). )

	Ingo

--------------------->
Subject: x86: idle wakeup event in the HLT loop
From: Ingo Molnar <mingo@elte.hu>

do a proper idle-wakeup event on HLT as well - some CPUs stop the TSC
in HLT too, not just when going through the ACPI methods.

(the ACPI idle code already does this.)

[ update the 64-bit side too, as noticed by Jiri Slaby. ]

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/process_32.c |   15 ++++++++++++---
 arch/x86/kernel/process_64.c |   13 ++++++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

Index: linux-x86.q/arch/x86/kernel/process_32.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/process_32.c
+++ linux-x86.q/arch/x86/kernel/process_32.c
@@ -113,10 +113,19 @@ void default_idle(void)
 		smp_mb();
 
 		local_irq_disable();
-		if (!need_resched())
+		if (!need_resched()) {
+			ktime_t t0, t1;
+			u64 t0n, t1n;
+
+			t0 = ktime_get();
+			t0n = ktime_to_ns(t0);
 			safe_halt();	/* enables interrupts racelessly */
-		else
-			local_irq_enable();
+			local_irq_disable();
+			t1 = ktime_get();
+			t1n = ktime_to_ns(t1);
+			sched_clock_idle_wakeup_event(t1n - t0n);
+		}
+		local_irq_enable();
 		current_thread_info()->status |= TS_POLLING;
 	} else {
 		/* loop is done by the caller */
Index: linux-x86.q/arch/x86/kernel/process_64.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/process_64.c
+++ linux-x86.q/arch/x86/kernel/process_64.c
@@ -116,9 +116,16 @@ static void default_idle(void)
 	smp_mb();
 	local_irq_disable();
 	if (!need_resched()) {
-		/* Enables interrupts one instruction before HLT.
-		   x86 special cases this so there is no race. */
-		safe_halt();
+		ktime_t t0, t1;
+		u64 t0n, t1n;
+
+		t0 = ktime_get();
+		t0n = ktime_to_ns(t0);
+		safe_halt();	/* enables interrupts racelessly */
+		local_irq_disable();
+		t1 = ktime_get();
+		t1n = ktime_to_ns(t1);
+		sched_clock_idle_wakeup_event(t1n - t0n);
 	} else
 		local_irq_enable();
 	current_thread_info()->status |= TS_POLLING;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.24-rc4-mm1, Andrew Morton, (Wed Dec 5, 1:17 am)
Re: 2.6.24-rc4-mm1 - BUG in tcp_fragment, Cedric Le Goater, (Thu Dec 13, 1:45 pm)
Re: 2.6.24-rc4-mm1 - BUG in tcp_fragment, Ilpo Järvinen, (Thu Dec 13, 7:00 pm)
Re: 2.6.24-rc4-mm1 - BUG in tcp_fragment, Cedric Le Goater, (Fri Dec 14, 2:52 am)
Re: 2.6.24-rc4-mm1, Rik van Riel, (Wed Dec 12, 12:16 am)
Re: 2.6.24-rc4-mm1, Martin Bligh, (Tue Dec 11, 12:20 pm)
Re: 2.6.24-rc4-mm1, Randy Dunlap, (Tue Dec 11, 12:59 pm)
Re: 2.6.24-rc4-mm1, Martin Bligh, (Tue Dec 11, 1:50 pm)
Re: 2.6.24-rc4-mm1, Reuben Farrelly, (Mon Dec 10, 10:48 am)
Re: 2.6.24-rc4-mm1, Andrew Morton, (Mon Dec 10, 5:11 pm)
Re: 2.6.24-rc4-mm1, Reuben Farrelly, (Tue Dec 11, 10:12 am)
broken suspend (sched related) [Was: 2.6.24-rc4-mm1], Jiri Slaby, (Fri Dec 7, 10:34 am)
Re: broken suspend (sched related) [Was: 2.6.24-rc4-mm1], Gautham R Shenoy, (Mon Dec 10, 4:19 am)
Re: broken suspend (sched related) [Was: 2.6.24-rc4-mm1], Gautham R Shenoy, (Mon Dec 10, 6:15 am)
Re: broken suspend (sched related) [Was: 2.6.24-rc4-mm1], Gautham R Shenoy, (Mon Dec 10, 7:08 am)
Re: broken suspend (sched related) [Was: 2.6.24-rc4-mm1], Gautham R Shenoy, (Mon Dec 10, 7:49 am)
Re: broken suspend (sched related) [Was: 2.6.24-rc4-mm1], Ingo Molnar, (Sun Dec 9, 4:06 am)
Re: 2.6.24-rc4-mm1: VDSOSYM build error, Laurent Riffard, (Thu Dec 6, 6:28 pm)
Re: 2.6.24-rc4-mm1: VDSOSYM build error, Andrew Morton, (Thu Dec 6, 6:37 pm)
Re: 2.6.24-rc4-mm1: VDSOSYM build error, Miles Lane, (Thu Dec 6, 7:28 pm)
Re: 2.6.24-rc4-mm1: VDSOSYM build error, Andrew Morton, (Thu Dec 6, 7:34 pm)
Re: 2.6.24-rc4-mm1: VDSOSYM build error, Miles Lane, (Thu Dec 6, 7:47 pm)
Re: 2.6.24-rc4-mm1: VDSOSYM build error, Ingo Molnar, (Fri Dec 7, 6:36 am)
[PATCH x86/mm] x86 vDSO: canonicalize sysenter .eh_frame, Roland McGrath, (Thu Dec 6, 9:14 pm)
Re: 2.6.24-rc4-mm1, Reuben Farrelly, (Thu Dec 6, 2:59 am)
Re: 2.6.24-rc4-mm1, Andrew Morton, (Thu Dec 6, 3:35 am)
Re: 2.6.24-rc4-mm1, Ilpo Järvinen, (Mon Dec 10, 8:24 am)
Re: 2.6.24-rc4-mm1, Cedric Le Goater, (Wed Dec 12, 3:21 pm)
tcp_sacktag_one() WARNING (was Re: 2.6.24-rc4-mm1), Cedric Le Goater, (Thu Dec 13, 1:38 pm)
Re: 2.6.24-rc4-mm1, Ilpo Järvinen, (Mon Dec 10, 4:05 pm)
Re: 2.6.24-rc4-mm1, David Miller, (Thu Dec 6, 3:09 am)
Re: 2.6.24-rc4-mm1, Ilpo Järvinen, (Fri Dec 7, 9:16 am)
Re: 2.6.24-rc4-mm1, Cedric Le Goater, (Wed Dec 12, 1:57 pm)
Re: 2.6.24-rc4-mm1 Kernel build fails on S390x, Kamalesh Babulal, (Wed Dec 5, 11:15 pm)
Re: 2.6.24-rc4-mm1 Kernel build fails on S390x, Andrew Morton, (Thu Dec 6, 3:19 am)
Re: 2.6.24-rc4-mm1, , (Thu Dec 6, 7:49 am)
Re: 2.6.24-rc4-mm1, Andrew Morton, (Thu Dec 6, 8:04 am)
Re: 2.6.24-rc4-mm1, , (Thu Dec 6, 3:18 pm)
Re: 2.6.24-rc4-mm1, Greg KH, (Thu Dec 6, 3:38 pm)
Re: 2.6.24-rc4-mm1, , (Thu Dec 6, 4:04 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, Kay Sievers, (Thu Dec 6, 6:04 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, , (Thu Dec 6, 7:12 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, Kay Sievers, (Thu Dec 6, 7:24 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, , (Fri Dec 7, 2:20 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, Kay Sievers, (Fri Dec 7, 2:44 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, , (Fri Dec 7, 4:28 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, Kay Sievers, (Fri Dec 7, 4:49 pm)
Re: [dm-devel] Re: 2.6.24-rc4-mm1, Alasdair G Kergon, (Thu Dec 6, 6:12 pm)
Re: 2.6.24-rc4-mm1: some issues on sparc64, Mariusz Kozlowski, (Sat Dec 8, 2:20 pm)
Re: 2.6.24-rc4-mm1: some issues on sparc64, Andrew Morton, (Sat Dec 8, 2:22 pm)
Re: 2.6.24-rc4-mm1: some issues on sparc64, David Miller, (Sun Dec 9, 4:45 am)
Re: 2.6.24-rc4-mm1: some issues on sparc64, Andrew Morton, (Sun Dec 9, 5:03 am)
[PATCH] md: balance braces in raid5 debug code, Mariusz Kozlowski, (Fri Dec 7, 2:20 pm)
Re: 2.6.24-rc4-mm1, Dave Young, (Thu Dec 6, 10:12 pm)
Re: 2.6.24-rc4-mm1, Luis R. Rodriguez, (Fri Dec 7, 6:22 pm)
Re: 2.6.24-rc4-mm1, Dave Young, (Sun Dec 9, 9:07 pm)
Re: 2.6.24-rc4-mm1, Nick Kossifidis, (Sun Dec 9, 1:55 pm)
2.6.24-rc4-mm1: kobj changes fallout on powerpc, Olof Johansson, (Wed Dec 5, 5:15 am)
Re: 2.6.24-rc4-mm1: kobj changes fallout on powerpc, Kamalesh Babulal, (Wed Dec 5, 9:11 am)