* [parisc-linux] xchg/cmpxchg defined in wrong place?
@ 2000-12-30 5:12 Grant Grundler
2000-12-30 6:41 ` Grant Grundler
2000-12-30 16:46 ` Alan Cox
0 siblings, 2 replies; 7+ messages in thread
From: Grant Grundler @ 2000-12-30 5:12 UTC (permalink / raw)
To: parisc-linux
Hello Linux Kernel Guru's,
After surveying all the arches that define __HAVE_ARCH_CMPXCHG:
./include/asm-alpha/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-i386/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-ia64/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-ppc/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-sparc64/system.h:#define __HAVE_ARCH_CMPXCHG 1
I've come to the conclusion xchg/cmpxchg definitions do NOT
belong in system.h. AFAICT, all the above use Load Linked semantics
(or in the i386 case, operation is atomic). In other words, xchg/cmpxchg
are atomic operations. Shouldn't xchg/cmpxchg definitions live
with other atomic operations - asm/atomic.h?
Currently, parisc __xchg lives in arch/parisc/kernel/setup.c. There is no
way to inline xchg or cmpxchg for parisc at the moment. And given the
dependendencies between asm/system.h, asm/spinlock.h, and asm/atomic.h,
I'm not trying to inline them. Perhaps when the definitions formally move
to atomic.h (or other more appropriate place).
And to add insult to injury, drivers/char/drm/drmP.h (the only visible
consumer of __HAVE_ARCH_CMPXCHG) doesn't even explicitly include
asm/system.h!
thanks,
grant
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [parisc-linux] xchg/cmpxchg defined in wrong place?
2000-12-30 5:12 [parisc-linux] xchg/cmpxchg defined in wrong place? Grant Grundler
@ 2000-12-30 6:41 ` Grant Grundler
2000-12-30 16:46 ` Alan Cox
1 sibling, 0 replies; 7+ messages in thread
From: Grant Grundler @ 2000-12-30 6:41 UTC (permalink / raw)
To: parisc-linux
Grant Grundler wrote:
...
> Currently, parisc __xchg lives in arch/parisc/kernel/setup.c.
Sorry. I got this fact wrong: __xchg lives in arch/parisc/lib/bitops.c
__xchg_called_with_bad_pointer *is* defined in arch/parisc/kernel/setup.c.
My understanding is this fuction in fact should NOT be defined.
It's a tool to catch problems for architectures which can inline __xchg.
Neither item is material to my arguments for defining them in atomic.h.
grant
Grant Grundler
Unix Systems Enablement Lab
+1.408.447.7253
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [parisc-linux] xchg/cmpxchg defined in wrong place?
2000-12-30 5:12 [parisc-linux] xchg/cmpxchg defined in wrong place? Grant Grundler
2000-12-30 6:41 ` Grant Grundler
@ 2000-12-30 16:46 ` Alan Cox
2000-12-30 17:52 ` Grant Grundler
1 sibling, 1 reply; 7+ messages in thread
From: Alan Cox @ 2000-12-30 16:46 UTC (permalink / raw)
To: Grant Grundler; +Cc: parisc-linux
> way to inline xchg or cmpxchg for parisc at the moment. And given the
> dependendencies between asm/system.h, asm/spinlock.h, and asm/atomic.h,
> I'm not trying to inline them. Perhaps when the definitions formally move
> to atomic.h (or other more appropriate place).
>
> And to add insult to injury, drivers/char/drm/drmP.h (the only visible
> consumer of __HAVE_ARCH_CMPXCHG) doesn't even explicitly include
> asm/system.h!
Seems a reasonable thing to try and move to atomic.h yes
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [parisc-linux] xchg/cmpxchg defined in wrong place?
2000-12-30 16:46 ` Alan Cox
@ 2000-12-30 17:52 ` Grant Grundler
2000-12-31 1:55 ` Grant Grundler
0 siblings, 1 reply; 7+ messages in thread
From: Grant Grundler @ 2000-12-30 17:52 UTC (permalink / raw)
To: Alan Cox; +Cc: parisc-linux
Alan Cox wrote:
> Seems a reasonable thing to try and move to atomic.h yes
ok. I'll take a whack at parisc arch and see what happens.
If it's easy, I'll try the i386 arch as well - mostly
to build more drivers as a sanity check.
thanks,
grant
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [parisc-linux] xchg/cmpxchg defined in wrong place?
2000-12-30 17:52 ` Grant Grundler
@ 2000-12-31 1:55 ` Grant Grundler
2000-12-31 4:16 ` R P Herrold
0 siblings, 1 reply; 7+ messages in thread
From: Grant Grundler @ 2000-12-31 1:55 UTC (permalink / raw)
To: parisc-linux
Grant Grundler wrote:
> ok. I'll take a whack at parisc arch and see what happens.
This was easy. Was even able to build/link with DRM and all the
related drivers. Code change committed to parisc-linux CVS:
o removes bogus definition of __xchg_called_with_bad_pointer from setup.c
o definitions follow sparc64 model except I didn't try to inline all
of this mess.
o added __xchgNN() and __cmpxchg_uNN() functions to bitops.c and
declared them in parisc_ksyms.c for CONFIG_MODULES support.
o added "include <asm/atomic.h>" to arch/parisc/kernel/semaphore.c
to make sure it gets the xchg() macro definition.
TODO: DRM should explicitly include asm/atomic.h to pick up
#define __HAVE_ARCH_CMPXCHG directly.
> If it's easy, I'll try the i386 arch as well - mostly
> to build more drivers as a sanity check.
I moved all the xchg/cmpxchg related code from include/asm-i386/system.h
to include/asm-i386/atomic.h and built an x86 kernel (natively) but didn't
boot it. Booting the kernel shouldn't be necessary since mis-use will
result in a linker error (xchg undefined).
I used 2.4.0-test10 since it was handy. Once I get newer Linus
tree, I can cut/paste again and submit the patch to l-k.
Should be able to do this in the next couple of days unless someone
tells me they've done it already.
thanks,
grant
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [parisc-linux] xchg/cmpxchg defined in wrong place?
2000-12-31 1:55 ` Grant Grundler
@ 2000-12-31 4:16 ` R P Herrold
2001-01-02 0:09 ` Dual Boot Grant Grundler
0 siblings, 1 reply; 7+ messages in thread
From: R P Herrold @ 2000-12-31 4:16 UTC (permalink / raw)
To: Grant Grundler, parisc-linux
On Sat, 30 Dec 2000, Grant Grundler wrote:
> I moved all the xchg/cmpxchg related code from include/asm-i386/system.h
> to include/asm-i386/atomic.h and built an x86 kernel (natively) but didn't
> boot it. Booting the kernel shouldn't be necessary since mis-use will
> result in a linker error (xchg undefined).
I've always liked this one:
Theory and Practice, distinguished: In Theory, there is no
difference between Theory and Practice; in Practice, there
always is ...
I'm going to try spinning up a G50, and sniffing at a K220 for
parisc linux ... 735/125 on the way in ... I'd like to leave
HP-UX on the K220 and 'dual boot' -- but it is such a pain to
hook a console up -- Any thoughts on an OS/2 style Boot
Manager leaving 'next boot' semaphore flags behind ...
-- Russ
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Dual Boot
2000-12-31 4:16 ` R P Herrold
@ 2001-01-02 0:09 ` Grant Grundler
0 siblings, 0 replies; 7+ messages in thread
From: Grant Grundler @ 2001-01-02 0:09 UTC (permalink / raw)
To: R P Herrold; +Cc: parisc-linux
R P Herrold wrote:
...
> I'm going to try spinning up a G50, and sniffing at a K220 for
> parisc linux ... 735/125 on the way in ... I'd like to leave
> HP-UX on the K220 and 'dual boot' -- but it is such a pain to
> hook a console up -- Any thoughts on an OS/2 style Boot
> Manager leaving 'next boot' semaphore flags behind ...
It's hard to hook up a serial console on K220?!
Under HPUX, "setboot" command can set the primary boot path
so it can reboot from any disk/lan you want. You would have to
write a similar program for parisc-linux to poke stuff into NVRAM.
It might be a PDC call to do it; I don't know. But it's doable.
grant
Grant Grundler
Unix Systems Enablement Lab
+1.408.447.7253
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-01-02 0:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-30 5:12 [parisc-linux] xchg/cmpxchg defined in wrong place? Grant Grundler
2000-12-30 6:41 ` Grant Grundler
2000-12-30 16:46 ` Alan Cox
2000-12-30 17:52 ` Grant Grundler
2000-12-31 1:55 ` Grant Grundler
2000-12-31 4:16 ` R P Herrold
2001-01-02 0:09 ` Dual Boot Grant Grundler
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.