Hi Andi, thanks for your comment.
> > We can avoid the problem by the simple solution, since SMP
> > on 386 boxes isn't supported. It is to disable interrupt
> > while updating atomic_t variable.
>
> The patch is wrong. A CONFIG_M386 kernel can run on non
> 386 SMP boxes. Your patch would be racy then. The only thing
> that's not supported is a real 386 with multiple CPUs.
>
> You either have to check boot_cpu_data.x86 == 3 at runtime or
> use alternative() like I earlier suggested.
Indeed, the attached patch is implemented according to the suggestion.
The code for legacy-386 is used only when boot_cpu_data.x86 == 3.
This run-time check is done only when CONFIG_M386 is set.
Otherwise, we use 'XADD' operation for atomic_add_return()
as the previous patch.
I don't adopt the alternative(), because the macro doesn't fit for the situation
when arguments for __asm__ are necessary.
Thanks.
--------
Kai Gai <[email protected]>