public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@suse.de>,
	"Shai Fultheim (Shai@scalex86.org)" <shai@scalex86.org>,
	pravin b shelar <pravin.shelar@calsoftinc.com>,
	"Benzi Galili (Benzi@ScaleMP.com)" <benzi@scalemp.com>
Subject: Re: [rfc] [patch 1/2] spin_lock_irq: Enable interrupts while spinning -- preperatory patch
Date: Wed, 3 Jan 2007 11:11:30 -0800	[thread overview]
Message-ID: <20070103191130.GA4075@localhost.localdomain> (raw)
In-Reply-To: <20070103001635.ecbd74e5.akpm@osdl.org>

On Wed, Jan 03, 2007 at 12:16:35AM -0800, Andrew Morton wrote:
> On Tue, 2 Jan 2007 23:59:23 -0800
> Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
> 
> > The following patches do just that. The first patch is preparatory in nature
> > and the second one changes the  x86_64 implementation of spin_lock_irq.
> > Patch passed overnight runs of kernbench and dbench on 4 way x86_64 smp.
> 
> The end result of this is, I think, that i386 enables irqs while spinning
> in spin_lock_irqsave() but not while spinning in spin_lock_irq().  And
> x86_64 does the opposite.

No, right now we have on mainline (non PREEMPT case);

			i386				x86_64
-----------------------------------------------------------------------------
spin_lock_irq		cli when spin			cli when spin
spin_lock_irqsave	spin with intr enabled		spin with intr enabled

The posted patchset changed this to:

			i386				x86_64
-----------------------------------------------------------------------------
spin_lock_irq		cli when spin			spin with intr enabled
spin_lock_irqsave	spin with intr enabled		spin with intr enabled

> 
> Odd, isn't it?

Well we just implemented the x86_64 part.  Here goes the i386 part as well for 
spin_lock_irq.

i386: Enable interrupts while spinning for a lock with spin_lock_irq

Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>

Index: linux-2.6.20-rc1/include/asm-i386/spinlock.h
===================================================================
--- linux-2.6.20-rc1.orig/include/asm-i386/spinlock.h	2006-12-28 17:18:32.142775000 -0800
+++ linux-2.6.20-rc1/include/asm-i386/spinlock.h	2007-01-03 10:18:32.243662000 -0800
@@ -82,7 +82,22 @@ static inline void __raw_spin_lock_flags
 	 	  CLI_STI_INPUT_ARGS
 		: "memory" CLI_STI_CLOBBERS);
 }
-# define __raw_spin_lock_irq(lock) __raw_spin_lock(lock)
+
+static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
+{
+	asm volatile("\n1:\t"
+		     LOCK_PREFIX " ; decb %0\n\t"
+		     "jns 3f\n"
+		     STI_STRING "\n"
+		     "2:\t"
+		     "rep;nop\n\t"
+		     "cmpb $0,%0\n\t"
+		     "jle 2b\n\t"
+		     CLI_STRING "\n"
+		     "jmp 1b\n"
+		     "3:\n\t"
+		     : "+m" (lock->slock) : : "memory");
+}
 #endif
 
 static inline int __raw_spin_trylock(raw_spinlock_t *lock)

      reply	other threads:[~2007-01-03 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-03  7:59 [rfc] [patch 1/2] spin_lock_irq: Enable interrupts while spinning -- preperatory patch Ravikiran G Thirumalai
2007-01-03  8:01 ` [rfc] [patch 2/2] spin_lock_irq: Enable interrupts while spinning -- x86_64 implementation Ravikiran G Thirumalai
2007-01-03  8:16 ` [rfc] [patch 1/2] spin_lock_irq: Enable interrupts while spinning -- preperatory patch Andrew Morton
2007-01-03 19:11   ` Ravikiran G Thirumalai [this message]

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=20070103191130.GA4075@localhost.localdomain \
    --to=kiran@scalex86.org \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=benzi@scalemp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pravin.shelar@calsoftinc.com \
    --cc=shai@scalex86.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