mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] __up_read and gcc-3.0
Date: Wed, 9 May 2001 19:09:55 +0200	[thread overview]
Message-ID: <20010509190955.A1526@vana.vc.cvut.cz> (raw)

Hi Alan,
  can you apply this patch to next 2.4.4-acX ? This fixes problem with
gcc3.0 (20010426) unable to compile this under some conditions. As
__up_write() uses same code ("i".... instead of tmp variable), I think
that you should apply this. It can cause slower code, as gcc cannot
move "movl -RWSEM_ACTIVE_READ_BIAS,%edx" away from "xadd" anymore,
but as "lock xadd" is slow anyway, it should not matter.

  I looked at generated code in cases where it originally failed, and
generated code looks OK to me.
					Thanks,
						Petr Vandrovec
						vandrove@vc.cvut.cz


diff -urdN linux/include/asm-i386/rwsem.h linux/include/asm-i386/rwsem.h
--- linux/include/asm-i386/rwsem.h	Fri Apr 27 22:48:24 2001
+++ linux/include/asm-i386/rwsem.h	Wed May  9 16:31:57 2001
@@ -148,9 +148,9 @@
  */
 static inline void __up_read(struct rw_semaphore *sem)
 {
-	__s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
 	__asm__ __volatile__(
 		"# beginning __up_read\n\t"
+		"  movl      %2,%%edx\n\t"
 LOCK_PREFIX	"  xadd      %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */
 		"  js        2f\n\t" /* jump if the lock is being waited upon */
 		"1:\n\t"
@@ -164,9 +164,9 @@
 		"  jmp       1b\n"
 		".previous\n"
 		"# ending __up_read\n"
-		: "+m"(sem->count), "+d"(tmp)
-		: "a"(sem)
-		: "memory", "cc");
+		: "+m"(sem->count)
+		: "a"(sem), "i"(-RWSEM_ACTIVE_READ_BIAS)
+		: "memory", "cc", "edx");
 }
 
 /*

             reply	other threads:[~2001-05-09 17:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-09 17:09 Petr Vandrovec [this message]
2001-05-11 13:13 ` Tom Leete
2001-05-11 15:48 Petr Vandrovec

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=20010509190955.A1526@vana.vc.cvut.cz \
    --to=vandrove@vc.cvut.cz \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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

all inboxes | Powered by JetHome®