Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] Non-atomic __set_bit
@ 2001-09-24  6:10 Carlos O'Donell Jr.
  2001-09-29  0:09 ` Albert Strasheim
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos O'Donell Jr. @ 2001-09-24  6:10 UTC (permalink / raw)
  To: parisc-linux; +Cc: Albert Strasheim

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

parisc,

Walking the source for devfs and thinking about Alberts problem.

Would the non-working devfs be fixed by adding:

Non-atomic versions of set_bit e.g. __set_bit 
and test_and_set_bit e.g. __test_and_set_bit
to linux/include/asm-parisc/bitops.h?

I have the latest CVS linux module.
I've patched against that. It compiles now ;)
(god bless make -j8)

I'm currently sleepy, but I'll post the patch, and test
it tommorow on a 712/60 and 715/50.

c.

[-- Attachment #2: bitops-devfs.diff --]
[-- Type: text/plain, Size: 1281 bytes --]

--- ./linux/include/asm-parisc/bitops.h.orig	Mon Sep 24 01:27:31 2001
+++ ./linux/include/asm-parisc/bitops.h.mod	Mon Sep 24 01:41:38 2001
@@ -50,6 +50,26 @@
 	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
 }
 
+/*
+ * Non-Atomic __set_bit
+ *
+ * If called by multiple processes, only one will succeed.
+ * The others would have been reordered before the succeeding
+ * call.
+ *
+ */
+
+static __inline__ void __set_bit(int nr, void * address)
+{
+        unsigned long mask;
+        unsigned long *addr = (unsigned long *) address;
+
+        addr += (nr >> SHIFT_PER_LONG);
+        mask = 1L << CHOP_SHIFTCOUNT(nr);
+        *addr |= mask;
+}
+
+
 static __inline__ int test_and_clear_bit(int nr, void * address)
 {
 	unsigned long mask;
@@ -66,6 +86,25 @@
 
 	return oldbit;
 }
+
+/*
+ * Non-Atomic __test_and_clear_bit
+ *
+ */
+
+static __inline__ int __test_and_clear_bit(int nr, void * address)
+{
+        unsigned long mask;
+        unsigned long *addr = (unsigned long *) address;
+        int oldbit;
+        addr += (nr >> SHIFT_PER_LONG);
+        mask = 1L << CHOP_SHIFTCOUNT(nr);
+        oldbit = (*addr & mask) ? 1 : 0;
+        *addr &= ~mask;
+											            return oldbit;
+}
+
+
 
 static __inline__ void clear_bit(int nr, void * address)
 {

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

* Re: [parisc-linux] Non-atomic __set_bit
  2001-09-24  6:10 [parisc-linux] Non-atomic __set_bit Carlos O'Donell Jr.
@ 2001-09-29  0:09 ` Albert Strasheim
  2001-09-29 17:27   ` Carlos O'Donell Jr.
  0 siblings, 1 reply; 4+ messages in thread
From: Albert Strasheim @ 2001-09-29  0:09 UTC (permalink / raw)
  To: Carlos O'Donell Jr.; +Cc: parisc-linux

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

Hello,

Is this going into CVS any time soon? It seems to work fine on my
720/50.

Regards,

Albert

On Mon, 24 Sep 2001, Carlos O'Donell Jr. wrote:

> parisc,
> 
> Walking the source for devfs and thinking about Alberts problem.
> 
> Would the non-working devfs be fixed by adding:
> 
> Non-atomic versions of set_bit e.g. __set_bit 
> and test_and_set_bit e.g. __test_and_set_bit
> to linux/include/asm-parisc/bitops.h?
> 
> I have the latest CVS linux module.
> I've patched against that. It compiles now ;)
> (god bless make -j8)
> 
> I'm currently sleepy, but I'll post the patch, and test
> it tommorow on a 712/60 and 715/50.
> 
> c.

<patch snipped>

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: [parisc-linux] Non-atomic __set_bit
  2001-09-29  0:09 ` Albert Strasheim
@ 2001-09-29 17:27   ` Carlos O'Donell Jr.
  2001-09-29 21:43     ` Albert Strasheim
  0 siblings, 1 reply; 4+ messages in thread
From: Carlos O'Donell Jr. @ 2001-09-29 17:27 UTC (permalink / raw)
  To: Albert Strasheim, parisc-linux

> Hello,
> 
> Is this going into CVS any time soon? It seems to work fine on my
> 720/50.
> 
> Regards,
> 
> Albert
> 

Albert,

Have you booted a devfs kernel on you box?
Does it seem to function properly?

Adding devfs to my kernel causes some odd stuff to go on after
trying to enter INIT. Though I haven't had time to sort it out.
The kernel boots fine, but probably one of the startup scripts
is doing something decidedly wrong.

Since you are using init=/bin/sh, and unless you tell devfs
to explicitly mount at boot, you won't _really_ be using 
devfs :)

Sure, it compiles... and it looks like it should work.
But theory and practice are so different it's not funny.

<Carlos looks back at the RF Amplifier design he has on the
whiteboard and chuckles>

c.

> 
> > parisc,
> > 
> > Walking the source for devfs and thinking about Alberts problem.
> > 
> > Would the non-working devfs be fixed by adding:
> > 
> > Non-atomic versions of set_bit e.g. __set_bit 
> > and test_and_set_bit e.g. __test_and_set_bit
> > to linux/include/asm-parisc/bitops.h?
> > 
> > I have the latest CVS linux module.
> > I've patched against that. It compiles now ;)
> > (god bless make -j8)
> > 
> > I'm currently sleepy, but I'll post the patch, and test
> > it tommorow on a 712/60 and 715/50.
> > 
> > c.
> 
> <patch snipped>

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

* Re: [parisc-linux] Non-atomic __set_bit
  2001-09-29 17:27   ` Carlos O'Donell Jr.
@ 2001-09-29 21:43     ` Albert Strasheim
  0 siblings, 0 replies; 4+ messages in thread
From: Albert Strasheim @ 2001-09-29 21:43 UTC (permalink / raw)
  To: Carlos O'Donell Jr.; +Cc: parisc-linux

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

Hello,

There's a CONFIG_DEVFS_MOUNT option that mounts it at boot. I know I
used fdisk on /dev/scsi/somedamnthing/part3/block10/orifice99 or
somesuch :-)

If init is croaking, you need devfsd perhaps?

But here it works fine.

Regards,

Albert

On Sat, 29 Sep 2001, Carlos O'Donell Jr. wrote:

> > Hello,
> > 
> > Is this going into CVS any time soon? It seems to work fine on my
> > 720/50.
> > 
> > Regards,
> > 
> > Albert
> > 
> 
> Albert,
> 
> Have you booted a devfs kernel on you box?
> Does it seem to function properly?
> 
> Adding devfs to my kernel causes some odd stuff to go on after
> trying to enter INIT. Though I haven't had time to sort it out.
> The kernel boots fine, but probably one of the startup scripts
> is doing something decidedly wrong.
> 
> Since you are using init=/bin/sh, and unless you tell devfs
> to explicitly mount at boot, you won't _really_ be using 
> devfs :)
> 
> Sure, it compiles... and it looks like it should work.
> But theory and practice are so different it's not funny.
> 
> <Carlos looks back at the RF Amplifier design he has on the
> whiteboard and chuckles>
> 
> c.
> 
> > 
> > > parisc,
> > > 
> > > Walking the source for devfs and thinking about Alberts problem.
> > > 
> > > Would the non-working devfs be fixed by adding:
> > > 
> > > Non-atomic versions of set_bit e.g. __set_bit 
> > > and test_and_set_bit e.g. __test_and_set_bit
> > > to linux/include/asm-parisc/bitops.h?
> > > 
> > > I have the latest CVS linux module.
> > > I've patched against that. It compiles now ;)
> > > (god bless make -j8)
> > > 
> > > I'm currently sleepy, but I'll post the patch, and test
> > > it tommorow on a 712/60 and 715/50.
> > > 
> > > c.
> > 
> > <patch snipped>
> 
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

end of thread, other threads:[~2001-09-29 21:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-24  6:10 [parisc-linux] Non-atomic __set_bit Carlos O'Donell Jr.
2001-09-29  0:09 ` Albert Strasheim
2001-09-29 17:27   ` Carlos O'Donell Jr.
2001-09-29 21:43     ` Albert Strasheim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox