public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: "Mark A. Greer" <mgreer@mvista•com>
To: akpm <akpm@osdl•org>
Cc: Brian Waite <waite@skycomputers•com>,
	Embedded PPC Linux list <linuxppc-embedded@ozlabs•org>
Subject: Re: [PATCH][PPC32] fix locking bugs in mv64x60 code
Date: Wed, 02 Feb 2005 17:21:38 -0700	[thread overview]
Message-ID: <42016E92.50905@mvista.com> (raw)
In-Reply-To: <42016E33.9070804@mvista.com>

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

And with the patch this time...
--
Mark A. Greer wrote:

> [Original patch slightly edited by mgreer]
>
> This patch fixes 2 SMP deadlocks. The first is that mv64x60_read() was 
> returning before the unlock. The second was mv64x60_modify() locks the 
> spin lock and calls mv64x60_read() and mv64x60_write() which also lock 
> the same spin lock.
>
> Please apply.
>
> Signed-Off-By: Brian Waite <waite@skycomputers•com>
> Signed-off-by: Mark A. Greer <mgreer@mvista•com>
>
>


[-- Attachment #2: mv_smp.patch --]
[-- Type: text/plain, Size: 1368 bytes --]

diff -Nru a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
--- a/arch/ppc/syslib/mv64x60.c	2005-02-02 17:15:26 -07:00
+++ b/arch/ppc/syslib/mv64x60.c	2005-02-02 17:15:26 -07:00
@@ -32,7 +32,7 @@
 
 
 u8		mv64x60_pci_exclude_bridge = 1;
-spinlock_t	mv64x60_lock; /* Only really used by PIC code once init done */
+spinlock_t	mv64x60_lock = SPIN_LOCK_UNLOCKED;
 
 static phys_addr_t 	mv64x60_bridge_pbase = 0;
 static void 		*mv64x60_bridge_vbase = 0;
diff -Nru a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h
--- a/include/asm-ppc/mv64x60.h	2005-02-02 17:15:26 -07:00
+++ b/include/asm-ppc/mv64x60.h	2005-02-02 17:15:26 -07:00
@@ -254,10 +254,12 @@
 extern inline u32
 mv64x60_read(struct mv64x60_handle *bh, u32 offset) {
 	ulong	flags;
+	u32     reg;
 
 	spin_lock_irqsave(&mv64x60_lock, flags);
-	return in_le32(bh->v_base + offset);
+	reg = in_le32(bh->v_base + offset);
 	spin_unlock_irqrestore(&mv64x60_lock, flags);
+	return reg;
 }
 
 extern inline void
@@ -267,9 +269,9 @@
 	ulong	flags;
 
 	spin_lock_irqsave(&mv64x60_lock, flags);
-	reg = mv64x60_read(bh, offs) & (~mask); /* zero bits we care about */
-	reg |= data & mask; /* set bits from the data */
-	mv64x60_write(bh, offs, reg);
+	reg = in_le32(bh->v_base + offs) & (~mask);
+	reg |= data & mask;
+	out_le32(bh->v_base + offs, reg);
 	spin_unlock_irqrestore(&mv64x60_lock, flags);
 }
 

      reply	other threads:[~2005-02-03  0:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-03  0:20 [PATCH][PPC32] fix locking bugs in mv64x60 code Mark A. Greer
2005-02-03  0:21 ` Mark A. Greer [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=42016E92.50905@mvista.com \
    --to=mgreer@mvista$(echo .)com \
    --cc=akpm@osdl$(echo .)org \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    --cc=waite@skycomputers$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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