Re: [PATCH] asm-i386/atomic.h: local_irq_save should be used instead of local_irq_disable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 11 Apr 2006, lepton wrote:

> Hi!
> 	When I read the kernel codes, I think this perhaps be a little
> 	bug, What do you think about this?
>
> 	See the following patch (against 2.6.16.3)
>
> Signed-off-by: Lepton Wu <[email protected]>
>
> diff -pru linux-2.6-curr.orig/include/asm-i386/atomic.h linux-2.6-curr.lepton/include/asm-i386/atomic.h
> --- linux-2.6-curr.orig/include/asm-i386/atomic.h	2006-04-06 09:21:53.000000000 +0800
> +++ linux-2.6-curr.lepton/include/asm-i386/atomic.h	2006-04-11 20:47:39.000000000 +0800
> @@ -189,6 +189,7 @@ static __inline__ int atomic_add_return(
> {
> 	int __i;
> #ifdef CONFIG_M386
> +	unsigned long flags;
> 	if(unlikely(boot_cpu_data.x86==3))
> 		goto no_xadd;
> #endif
> @@ -202,10 +203,10 @@ static __inline__ int atomic_add_return(
>
> #ifdef CONFIG_M386
> no_xadd: /* Legacy 386 processor */
> -	local_irq_disable();
> +	local_irq_save(flags);
> 	__i = atomic_read(v);
> 	atomic_set(v, i + __i);
> -	local_irq_enable();
> +	local_irq_restore(flags);
> 	return i + __i;
> #endif
> }

You need to disable interrupts on the local CPU! So, you would need
to save the flags, disable the interrupts, then restore the flags
after the atomic operations.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.15.4 on an i686 machine (5589.42 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_


****************************************************************
The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux