Re: [PATCH]atomic_inc_return() for i386/x86_64 (Re: RCU issue withSELinux)

From: Andi Kleen
Date: Sat Aug 28 2004 - 09:49:26 EST


"Kaigai Kohei" <kaigai@xxxxxxxxxxxxx> writes:

> atomic_inc_return() is not defined for arm,arm26,i386,x86_64 and um archtectures.
> This attached patch adds atomic_inc_return() and atomic_dec_return() to arm,i386 and x86_64.
>
> It is implemented by 'xaddl' operation with LOCK prefix for i386 and x86_64.
> But this operation is permitted after i486 processor only.
> Another implementation may be necessary for i386SX/DX processor.
> But 'xaddl' operation is used in 'include/asm-i386/rwsem.h' unconditionally.
> I think it has agreed on using 'xaddl' operation in past days.

We don't support SMP on 386 boxes. What you can do for 386 is to use
alternative() and just use an non SMP safe version for 386 and xadd
for 486+

This will require adding a new pseudo CPUID bit in cpufeature.h
that can be tested for in alternative (similar to the X86_FEATURE_P3/P4
flags that are already there)

-Andi

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