login
Header Space

 
 

Re: [BUG] long freezes on thinkpad t60

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Chuck Ebbert <cebbert@...>, Jarek Poplawski <jarkao2@...>, Miklos Szeredi <miklos@...>, <chris@...>, <linux-kernel@...>, <tglx@...>, <akpm@...>
Date: Friday, June 22, 2007 - 4:17 am

* Ingo Molnar <mingo@elte.hu> wrote:


even considering that the 'LOCK'-ed intruction was the heaviest in the 
busy-loop, the numbers still just dont add up to 'tens of seconds of 
lockups', so there must be something else happening too.

So here's an addition to the existing theories: the Core2Duo is a 
4-issue CPU architecture. Now, why does this matter? It matters to the 
timing of the delivery of interrupts. For example, on a 3-issue 
architecture, the instruction level profile of well-cached workloads 
often looks like this:

c05a3b71:      710      89 d6                   mov    %edx,%esi
c05a3b73:        0      8b 55 c0                mov    0xffffffc0(%ebp),%edx
c05a3b76:        0      89 c3                   mov    %eax,%ebx
c05a3b78:      775      8b 82 e8 00 00 00       mov    0xe8(%edx),%eax
c05a3b7e:        0      8b 48 18                mov    0x18(%eax),%ecx
c05a3b81:        0      8b 45 c8                mov    0xffffffc8(%ebp),%eax
c05a3b84:      792      89 1c 24                mov    %ebx,(%esp)
c05a3b87:        0      89 74 24 04             mov    %esi,0x4(%esp)
c05a3b8b:        0      ff d1                   call   *%ecx
c05a3b8d:        0      8b 4d c8                mov    0xffffffc8(%ebp),%ecx
c05a3b90:      925      8b 41 6c                mov    0x6c(%ecx),%eax
c05a3b93:        0      39 41 10                cmp    %eax,0x10(%ecx)
c05a3b96:        0      0f 85 a8 01 00 00       jne    c05a3d44 <schedule+0x2a4>
c05a3b9c:      949      89 da                   mov    %ebx,%edx
c05a3b9e:        0      89 f1                   mov    %esi,%ecx
c05a3ba0:        0      8b 45 c8                mov    0xffffffc8(%ebp),%eax

the second column is the number of times the profiling interrupt has hit 
that particular instruction.

Note the many zero entries - this means that for instructions that are 
well-cached, the issue order _prevents_ interrupts from _ever_ hitting 
to within a bundle of micro-ops that the decoder will issue! The above 
workload was a plain lat_ctx, so nothing special, and interrupts and DMA 
traffic were coming and going. Still the bundling of instructions was 
very strong.

There's no guarantee of 'instruction bundling': a cachemiss can still 
stall the pipeline and allow an interrupt to hit any instruction [where 
interrupt delivery is valid], but on a well-cached workload like the 
above, even a 3-issue architecture can effectively 'merge' instructions 
to each other, and can make them essentially 'atomic' as far as external 
interrupts go.

[ also note another interesting thing in the profile above: the
  CALL *%ecx was likely BTB-optimized and hence we have a 'bundling' 
  effect that is even larger than 3 instructions. ]

i think that is what might have happened on Miklos's laptop too: the 
'movb' of the spin_unlock() done by the wait_task_inactive() got 
'bundled' together with the first LOCK instruction that took it again, 
making it very unlikely for a timer interrupt to ever hit that small 
window in wait_task_inactive(). The cpu_relax()'s "REP; NOP" was likely 
a simple NOP, because the Core2Duo is not an SMT platform.

to check this theory, adding 3 NOPs to the critical section should make 
the lockups a lot less prominent too. (While NOPs are not actually 
'issued', they do take up decoder bandwidth, so they hopefully are able 
to break up any 'bundle' of instructions.)

Miklos, if you've got some time to test this - could you revert the 
fa490cfd15d7 commit and apply the patch below - does it have any impact 
on the lockups you were experiencing?

	Ingo

---
 kernel/sched.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -1131,6 +1131,7 @@ repeat:
 		preempted = !task_running(rq, p);
 		task_rq_unlock(rq, &flags);
 		cpu_relax();
+		asm volatile ("nop; nop; nop;");
 		if (preempted)
 			yield();
 		goto repeat;
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[BUG] long freezes on thinkpad t60, Miklos Szeredi, (Thu May 24, 8:04 am)
Re: [BUG] long freezes on thinkpad t60, Henrique de Moraes Holschuh..., (Thu May 24, 6:08 pm)
Re: [BUG] long freezes on thinkpad t60, Kok, Auke, (Thu May 24, 6:13 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Fri May 25, 2:58 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu May 24, 8:54 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Thu May 24, 10:03 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu May 24, 10:10 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Thu May 24, 10:28 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu May 24, 10:42 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu May 24, 10:44 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Thu May 24, 1:09 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu May 24, 5:01 pm)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Fri May 25, 5:51 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Thu Jun 14, 12:04 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Sat Jun 16, 6:37 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Sun Jun 17, 5:46 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 2:43 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Mon Jun 18, 3:24 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 4:12 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Mon Jun 18, 12:34 pm)
Re: [BUG] long freezes on thinkpad t60, Jarek Poplawski, (Wed Jun 20, 5:36 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Wed Jun 20, 1:34 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 3:30 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 11:50 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 12:08 pm)
Re: [BUG] long freezes on thinkpad t60, Chuck Ebbert, (Thu Jun 21, 12:44 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 1:31 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:18 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 4:36 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:16 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Fri Jun 22, 4:17 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Sat Jun 23, 6:36 am)
Re: [BUG] long freezes on thinkpad t60, Jarek Poplawski, (Mon Jun 25, 2:45 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Sat Jun 23, 12:39 pm)
Re: [BUG] long freezes on thinkpad t60, Eric Dumazet, (Thu Jun 21, 2:29 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 2:44 pm)
Re: [BUG] long freezes on thinkpad t60, Nick Piggin, (Tue Jun 26, 4:42 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Tue Jun 26, 1:23 pm)
Re: [BUG] long freezes on thinkpad t60, Nick Piggin, (Wed Jun 27, 1:23 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Wed Jun 27, 2:04 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Wed Jun 27, 3:47 pm)
Re: [BUG] long freezes on thinkpad t60, Nick Piggin, (Mon Jul 2, 3:06 am)
Re: [BUG] long freezes on thinkpad t60, Davide Libenzi, (Wed Jun 27, 4:17 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Wed Jun 27, 6:11 pm)
Re: [BUG] long freezes on thinkpad t60, Davide Libenzi, (Wed Jun 27, 7:30 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Wed Jun 27, 8:46 pm)
Re: [BUG] long freezes on thinkpad t60, Davide Libenzi, (Wed Jun 27, 11:03 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Wed Jun 27, 4:10 pm)
Re: [BUG] long freezes on thinkpad t60, Nick Piggin, (Wed Jun 27, 2:20 am)
Re: [BUG] long freezes on thinkpad t60, Jarek Poplawski, (Tue Jun 26, 6:56 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:12 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 3:56 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 4:10 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:23 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 3:35 pm)
Re: [BUG] long freezes on thinkpad t60, Eric Dumazet, (Thu Jun 21, 4:36 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:09 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 4:14 pm)
[patch] spinlock debug: make looping nicer, Ingo Molnar, (Thu Jun 21, 4:42 pm)
Re: [patch] spinlock debug: make looping nicer, Linus Torvalds, (Thu Jun 21, 4:58 pm)
Re: [patch] spinlock debug: make looping nicer, Ingo Molnar, (Thu Jun 21, 5:15 pm)
Re: [patch] spinlock debug: make looping nicer, Jarek Poplawski, (Fri Jun 22, 3:00 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:30 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 4:48 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 5:06 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 12:32 pm)
Re: [BUG] long freezes on thinkpad t60, Jarek Poplawski, (Thu Jun 21, 3:38 am)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Thu Jun 21, 12:01 pm)
Re: [BUG] long freezes on thinkpad t60, Jarek Poplawski, (Fri Jun 22, 6:38 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Thu Jun 21, 4:39 am)
Re: [BUG] long freezes on thinkpad t60, Jarek Poplawski, (Thu Jun 21, 7:09 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 2:00 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Mon Jun 18, 2:25 pm)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Mon Jun 18, 1:41 pm)
Re: [BUG] long freezes on thinkpad t60, Linus Torvalds, (Mon Jun 18, 1:48 pm)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 2:02 pm)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Mon Jun 18, 4:25 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 4:31 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Mon Jun 18, 4:34 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 5:18 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 5:38 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 5:44 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Mon Jun 18, 6:18 am)
Re: [BUG] long freezes on thinkpad t60, Ingo Molnar, (Mon Jun 18, 8:36 am)
Re: [BUG] long freezes on thinkpad t60, Miklos Szeredi, (Mon Jun 18, 9:10 am)
Re: [BUG] long freezes on thinkpad t60, Andrew Morton, (Mon Jun 18, 4:20 am)
Re: [BUG] long freezes on thinkpad t60, Ravikiran G Thirumalai, (Tue Jun 19, 12:22 am)
Re: [BUG] long freezes on thinkpad t60, Chuck Ebbert, (Fri Jun 15, 5:25 pm)
speck-geostationary