All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-2.4.9: atomic_dec_and_lock sometimes used while not defined
@ 2001-08-16 18:21 Adam J. Richter
  2001-08-17  9:20 ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Adam J. Richter @ 2001-08-16 18:21 UTC (permalink / raw)
  To: linux-kernel

	If I try to build a kernel that can do SMP and run on a 386,
the linux-2.4.9 NFS client gets compiled with an undefined reference
to atomic_dec_and_lock().  I imagine that the correct fix is to
change the ifdefs that bracket the following line in include/linux/spinlock.h:

#define atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic)

	However, I'm really not clear enough on the semantics of
atomic_dec_and_lock vs. atomic_dec_and_test to know whether this
is safe.

	Also, it looks like arch/sparc64/sparc64_ksyms.c references
atomic_dec_and_test without it every being defined on any architecture
other than x86, so I am suspicious of a partially applied patch here.

	If nobody has a better idea, I'm going to move the
#define statement that I mentioned above out of its current
ifdef logic and just bracket it like so:

#ifndef CONFIG_HAVE_DEC_LOCK
#define atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic)
#endif

Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

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

* Re: linux-2.4.9: atomic_dec_and_lock sometimes used while not defined
  2001-08-16 18:21 linux-2.4.9: atomic_dec_and_lock sometimes used while not defined Adam J. Richter
@ 2001-08-17  9:20 ` Trond Myklebust
  2001-08-17 10:15   ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2001-08-17  9:20 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: linux-kernel

>>>>> " " == Adam J Richter <adam@yggdrasil.com> writes:

     > 	If I try to build a kernel that can do SMP and run on a 386,
     > the linux-2.4.9 NFS client gets compiled with an undefined
     > reference to atomic_dec_and_lock().

Why aren't you seeing the same error in linux/fs/inode.c? That also
references atomic_dec_and_lock when compiling 386 SMP...

     > 	However, I'm really not clear enough on the semantics of
     > atomic_dec_and_lock vs. atomic_dec_and_test to know whether
     > this is safe.

     > 	Also, it looks like arch/sparc64/sparc64_ksyms.c references
     > atomic_dec_and_test without it every being defined on any
     > architecture other than x86, so I am suspicious of a partially
     > applied patch here.

See linux/arch/sparc64/lib/dec_and_lock.S. atomic_dec_and_lock should
indeed be defined on a sparc64.

Cheers,
   Trond

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

* Re: linux-2.4.9: atomic_dec_and_lock sometimes used while not defined
  2001-08-17  9:20 ` Trond Myklebust
@ 2001-08-17 10:15   ` Trond Myklebust
  2001-08-17 10:31     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Trond Myklebust @ 2001-08-17 10:15 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: Alan Cox, linux-kernel


>>>>> " " == Adam J Richter <adam@yggdrasil.com> writes:
    >> If I try to build a kernel that can do SMP and run on a 386,
    >> the linux-2.4.9 NFS client gets compiled with an undefined
    >> reference to atomic_dec_and_lock().

Bummer I found the bug. It's not a missing define, but a missing
export...

Cheers,
  Trond

diff -u --recursive --new-file linux-2.4.9.orig/lib/Makefile linux-2.4.9/lib/Makefile
--- linux-2.4.9.orig/lib/Makefile	Wed Apr 25 22:31:03 2001
+++ linux-2.4.9/lib/Makefile	Fri Aug 17 11:52:35 2001
@@ -16,6 +16,7 @@
 obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
 
 ifneq ($(CONFIG_HAVE_DEC_LOCK),y) 
+  export-objs += dec_and_lock.o
   obj-y += dec_and_lock.o
 endif
 
diff -u --recursive --new-file linux-2.4.9.orig/lib/dec_and_lock.c linux-2.4.9/lib/dec_and_lock.c
--- linux-2.4.9.orig/lib/dec_and_lock.c	Sat Jul  8 01:22:48 2000
+++ linux-2.4.9/lib/dec_and_lock.c	Fri Aug 17 11:55:02 2001
@@ -1,3 +1,4 @@
+#include <linux/module.h>
 #include <linux/spinlock.h>
 #include <asm/atomic.h>
 
@@ -34,4 +35,6 @@
 	spin_unlock(lock);
 	return 0;
 }
+
+EXPORT_SYMBOL(atomic_dec_and_lock);
 #endif

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

* Re: linux-2.4.9: atomic_dec_and_lock sometimes used while not defined
  2001-08-17 10:15   ` Trond Myklebust
@ 2001-08-17 10:31     ` Christoph Hellwig
  2001-08-17 10:40       ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2001-08-17 10:31 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: alan, linux-kernel, adam

Hi Trond,

In article <shsu1z7c7qa.fsf@charged.uio.no> you wrote:
> diff -u --recursive --new-file linux-2.4.9.orig/lib/Makefile linux-2.4.9/lib/Makefile
> --- linux-2.4.9.orig/lib/Makefile	Wed Apr 25 22:31:03 2001
> +++ linux-2.4.9/lib/Makefile	Fri Aug 17 11:52:35 2001
> @@ -16,6 +16,7 @@
>  obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o
>  
>  ifneq ($(CONFIG_HAVE_DEC_LOCK),y) 
> +  export-objs += dec_and_lock.o
>    obj-y += dec_and_lock.o
>  endif

Nonono!  Please add it to export-objs _always_ not dependand on some
CONFIG_ symbol, that's how the 2.4 makefiles work.

	Christoph

-- 
Of course it doesn't work. We've performed a software upgrade.

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

* Re: linux-2.4.9: atomic_dec_and_lock sometimes used while not defined
  2001-08-17 10:31     ` Christoph Hellwig
@ 2001-08-17 10:40       ` Trond Myklebust
  0 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2001-08-17 10:40 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Trond Myklebust, alan, linux-kernel, adam

>>>>> " " == Christoph Hellwig <hch@ns.caldera.de> writes:

     > Hi Trond, In article <shsu1z7c7qa.fsf@charged.uio.no> you
     > wrote:
    >> diff -u --recursive --new-file linux-2.4.9.orig/lib/Makefile
    >> linux-2.4.9/lib/Makefile
    >> --- linux-2.4.9.orig/lib/Makefile Wed Apr 25 22:31:03 2001
    >> +++ linux-2.4.9/lib/Makefile Fri Aug 17 11:52:35 2001
    >> @@ -16,6 +16,7 @@ obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) +=
    >> rwsem.o
    >>
    >> ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
    >> + export-objs += dec_and_lock.o
    >> obj-y += dec_and_lock.o endif

     > Nonono!  Please add it to export-objs _always_ not dependand on
     > some CONFIG_ symbol, that's how the 2.4 makefiles work.

Revised patch follows...

Cheers,
  Trond

diff -u --recursive --new-file linux-2.4.9/lib/Makefile linux-2.4.9-atomic_lock/lib/Makefile
--- linux-2.4.9/lib/Makefile	Wed Apr 25 22:31:03 2001
+++ linux-2.4.9-atomic_lock/lib/Makefile	Fri Aug 17 12:38:24 2001
@@ -8,7 +8,7 @@
 
 L_TARGET := lib.a
 
-export-objs := cmdline.o rwsem-spinlock.o rwsem.o
+export-objs := cmdline.o dec_and_lock.o rwsem-spinlock.o rwsem.o
 
 obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o
 
diff -u --recursive --new-file linux-2.4.9/lib/dec_and_lock.c linux-2.4.9-atomic_lock/lib/dec_and_lock.c
--- linux-2.4.9/lib/dec_and_lock.c	Sat Jul  8 01:22:48 2000
+++ linux-2.4.9-atomic_lock/lib/dec_and_lock.c	Fri Aug 17 12:22:49 2001
@@ -1,3 +1,4 @@
+#include <linux/module.h>
 #include <linux/spinlock.h>
 #include <asm/atomic.h>
 
@@ -34,4 +35,6 @@
 	spin_unlock(lock);
 	return 0;
 }
+
+EXPORT_SYMBOL(atomic_dec_and_lock);
 #endif

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

end of thread, other threads:[~2001-08-17 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-16 18:21 linux-2.4.9: atomic_dec_and_lock sometimes used while not defined Adam J. Richter
2001-08-17  9:20 ` Trond Myklebust
2001-08-17 10:15   ` Trond Myklebust
2001-08-17 10:31     ` Christoph Hellwig
2001-08-17 10:40       ` Trond Myklebust

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.