public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Kaigai Kohei <kaigai@ak.jp.nec.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH]atomic_inc_return() for i386/x86_64 (Re: RCU issue with SELinux)
Date: 31 Aug 2004 10:49:53 +0200
Date: Tue, 31 Aug 2004 10:49:53 +0200	[thread overview]
Message-ID: <20040831084953.GA11113@muc.de> (raw)
In-Reply-To: <01b401c48f33$3fb05000$f97d220a@linux.bs1.fc.nec.co.jp>

On Tue, Aug 31, 2004 at 05:19:34PM +0900, Kaigai Kohei wrote:
> 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 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.

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

386 compatible kernels use a different rwsem implementation
that doesn't use this include.

-Andi

  reply	other threads:[~2004-08-31  8:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2wJxj-7g2-23@gated-at.bofh.it>
     [not found] ` <2x2JC-3Uu-11@gated-at.bofh.it>
2004-08-28 14:48   ` [PATCH]atomic_inc_return() for i386/x86_64 (Re: RCU issue with SELinux) Andi Kleen
2004-08-31  8:19     ` Kaigai Kohei
2004-08-31  8:49       ` Andi Kleen [this message]
2004-09-01  6:22         ` Kaigai Kohei
2004-08-24 13:24 RCU issue with SELinux (Re: SELINUX performance issues) James Morris
2004-08-25  9:52 ` [PATCH]atomic_inc_return() for i386/x86_64 (Re: RCU issue with SELinux) Kaigai Kohei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040831084953.GA11113@muc.de \
    --to=ak@muc.de \
    --cc=kaigai@ak.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox