All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix ldcw inline assembler
@ 2009-04-30 21:39 Helge Deller
  2009-04-30 22:27 ` Kyle McMartin
  2009-05-01 18:18 ` Carlos O'Donell
  0 siblings, 2 replies; 13+ messages in thread
From: Helge Deller @ 2009-04-30 21:39 UTC (permalink / raw)
  To: linux-parisc, John David Anglin, Kyle McMartin, Thibaut VARENE

This "fix ldcw assembler" patch below is really an old one now, but sadly it never got applied.

I just tried it again. Without this patch I always see login-problems when ssh-ing into
my parisc box. The very first time sshd just drops the connection (Connection closed by remote host).
With this patch I didn't faced this problem again.

I'm wondering, if not other userspace problems suddenly go away then as well,
e.g. the uid/gid issues others are seeing:
http://marc.info/?l=linux-parisc&m=121114269417948&w=2

Kyle, please apply.

Helge

-------- Original Message --------
Subject: [PATCH] ldcw inline assembler patch
From: Dave Anglin

There are two reasons to expose the memory *a in the asm:

1) To prevent the compiler from discarding a preceeding write to *a, and
2) to prevent it from caching *a in a register over the asm.

The change has had a few days testing with a SMP build of 2.6.22.19
running on a rp3440.

This patch is about the correctness of the __ldcw() macro itself. 
The use of the macro should be confined to small inline functions 
to try to limit the effect of clobbering memory on GCC's optimization 
of loads and stores.

Signed-off-by: Dave Anglin <dave.anglin@nrc-cnrc.gc.ca>
Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/include/asm/system.h b/arch/parisc/include/asm/system.h
index ee80c92..d91357b 100644
--- a/arch/parisc/include/asm/system.h
+++ b/arch/parisc/include/asm/system.h
@@ -168,8 +168,8 @@ static inline void set_eiem(unsigned long val)
 /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*.  */
 #define __ldcw(a) ({						\
 	unsigned __ret;						\
-	__asm__ __volatile__(__LDCW " 0(%1),%0"			\
-		: "=r" (__ret) : "r" (a));			\
+	__asm__ __volatile__(__LDCW " 0(%2),%0"			\
+		: "=r" (__ret), "+m" (*(a)) : "r" (a));		\
 	__ret;							\
 })
 
	


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-05-02  1:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-30 21:39 [PATCH] fix ldcw inline assembler Helge Deller
2009-04-30 22:27 ` Kyle McMartin
2009-05-02  1:47   ` John David Anglin
2009-05-01 17:14     ` John David Anglin
2009-05-01 18:18 ` Carlos O'Donell
2009-05-01 21:37   ` John David Anglin
2009-05-01 21:46     ` Kyle McMartin
2009-05-01 22:03       ` James Bottomley
2009-05-01 22:25         ` Kyle McMartin
2009-05-01 22:36           ` James Bottomley
2009-05-01 22:39             ` Kyle McMartin
2009-05-01 22:55               ` John David Anglin
2009-05-01 22:05       ` John David Anglin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.