[lkml]   [2004]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH]atomic_inc_return() for i386/x86_64 (Re: RCU issue with SELinux)
    Hi Andi, thanks for your comment.
    Sorry, I have not noticed your mail in the flood of Linux-Kernel ML.

    > > 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+

    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 attached patch modifies the include/asm-i386/atomic.h.
    If the target processor is 386, then atomic_add_return() use
    non-atomic operations between local_irq_disable() and local_irq_enable().
    Otherwise, atomic_add_return() use 'xadd' operation with LOCK prefix.

    By the way, do you know why 'xadd' operation is used
    unconditionally in 'include/asm-i386/rwsem.h'?


    Signed-off-by: KaiGai, Kohei <>
    Signed-off-by: Takayoshi Kochi <>
    Kai Gai <>
    [unhandled content-type:application/octet-stream]
     \ /
      Last update: 2005-03-22 14:05    [W:0.022 / U:3.368 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site