public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] missing GET_CPU_IDX in i386 entry.S
@ 2002-06-08 15:33 Brian Gerst
  2002-06-09  5:48 ` george anzinger
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Gerst @ 2002-06-08 15:33 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

resume_kernel uses CPU_IDX but never uses GET_CPU_IDX to get the index. 
  This is an issue when smp and preemption are both enabled.  I also 
removed the unused GET_CURRENT_CPU_IDX.

--
				Brian Gerst

[-- Attachment #2: cpu_idx-1 --]
[-- Type: text/plain, Size: 727 bytes --]

diff -urN linux-bk/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S
--- linux-bk/arch/i386/kernel/entry.S	Wed May 29 15:06:00 2002
+++ linux/arch/i386/kernel/entry.S	Sat Jun  8 10:44:44 2002
@@ -83,13 +83,9 @@
 #define GET_CPU_IDX \
 		movl TI_CPU(%ebx), %eax;  \
 		shll $irq_array_shift, %eax
-#define GET_CURRENT_CPU_IDX \
-		GET_THREAD_INFO(%ebx); \
-		GET_CPU_IDX
 #define CPU_IDX (,%eax)
 #else
 #define GET_CPU_IDX
-#define GET_CURRENT_CPU_IDX GET_THREAD_INFO(%ebx)
 #define CPU_IDX
 #endif
 
@@ -236,6 +232,7 @@
 	movl TI_FLAGS(%ebx), %ecx
 	testb $_TIF_NEED_RESCHED, %cl
 	jz restore_all
+	GET_CPU_IDX
 	movl irq_stat+local_bh_count CPU_IDX, %ecx
 	addl irq_stat+local_irq_count CPU_IDX, %ecx
 	jnz restore_all

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] missing GET_CPU_IDX in i386 entry.S
  2002-06-08 15:33 [PATCH] missing GET_CPU_IDX in i386 entry.S Brian Gerst
@ 2002-06-09  5:48 ` george anzinger
  0 siblings, 0 replies; 2+ messages in thread
From: george anzinger @ 2002-06-09  5:48 UTC (permalink / raw)
  To: Brian Gerst; +Cc: Linus Torvalds, Linux-Kernel

Brian Gerst wrote:
> 
> resume_kernel uses CPU_IDX but never uses GET_CPU_IDX to get the index.
>   This is an issue when smp and preemption are both enabled.  I also
> removed the unused GET_CURRENT_CPU_IDX.

Gosh, your right.  How did you find this?

I think the better solution, however, is to remove the whole
test.  Since the preempt counter gets bumped on each
interrupt and every local_bh_disable, this code should NEVER
find either of the two counters other than zero (since we
already know preemt count is zero).

Good work.

-g
> 
> --
>                                 Brian Gerst
> 
>   ------------------------------------------------------------
> diff -urN linux-bk/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S
> --- linux-bk/arch/i386/kernel/entry.S   Wed May 29 15:06:00 2002
> +++ linux/arch/i386/kernel/entry.S      Sat Jun  8 10:44:44 2002
> @@ -83,13 +83,9 @@
>  #define GET_CPU_IDX \
>                 movl TI_CPU(%ebx), %eax;  \
>                 shll $irq_array_shift, %eax
> -#define GET_CURRENT_CPU_IDX \
> -               GET_THREAD_INFO(%ebx); \
> -               GET_CPU_IDX
>  #define CPU_IDX (,%eax)
>  #else
>  #define GET_CPU_IDX
> -#define GET_CURRENT_CPU_IDX GET_THREAD_INFO(%ebx)
>  #define CPU_IDX
>  #endif
> 
> @@ -236,6 +232,7 @@
>         movl TI_FLAGS(%ebx), %ecx
>         testb $_TIF_NEED_RESCHED, %cl
>         jz restore_all
> +       GET_CPU_IDX
>         movl irq_stat+local_bh_count CPU_IDX, %ecx
>         addl irq_stat+local_irq_count CPU_IDX, %ecx
>         jnz restore_all

-- 
George Anzinger   george@mvista.com
High-res-timers: 
http://sourceforge.net/projects/high-res-timers/
Real time sched:  http://sourceforge.net/projects/rtsched/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-09  5:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-08 15:33 [PATCH] missing GET_CPU_IDX in i386 entry.S Brian Gerst
2002-06-09  5:48 ` george anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox