* Re: asm/atomic.h and user code
[not found] <1172958807.453840.180700@30g2000cwc.googlegroups.com>
@ 2007-03-04 2:09 ` Robert Hancock
2007-03-04 3:03 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Robert Hancock @ 2007-03-04 2:09 UTC (permalink / raw)
To: remi.chateauneu@gmail.com, linux-kernel
remi.chateauneu@gmail.com wrote:
> Is it me or it seems it is not possible anymore to use asm/atomic.h in
> non-kernel code ? Thanks.
The atomic functions, as with any internal kernel data structures, were
never intended to be used in userspace. In particular, the atomic
functions depend on config settings like CONFIG_SMP in order to actually
be atomic, and that's not guaranteed in userspace.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: asm/atomic.h and user code
2007-03-04 2:09 ` asm/atomic.h and user code Robert Hancock
@ 2007-03-04 3:03 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2007-03-04 3:03 UTC (permalink / raw)
To: Robert Hancock; +Cc: remi.chateauneu@gmail.com, linux-kernel
On Sat, Mar 03, 2007 at 08:09:47PM -0600, Robert Hancock wrote:
> Date: Sat, 03 Mar 2007 20:09:47 -0600
> From: Robert Hancock <hancockr@shaw.ca>
> Subject: Re: asm/atomic.h and user code
> To: "remi.chateauneu@gmail.com" <remi.chateauneu@gmail.com>,
> linux-kernel <linux-kernel@vger.kernel.org>
> Content-type: text/plain; charset=ISO-8859-1; format=flowed
>
> remi.chateauneu@gmail.com wrote:
> >Is it me or it seems it is not possible anymore to use asm/atomic.h in
> >non-kernel code ? Thanks.
>
> The atomic functions, as with any internal kernel data structures, were
> never intended to be used in userspace. In particular, the atomic
> functions depend on config settings like CONFIG_SMP in order to actually
> be atomic, and that's not guaranteed in userspace.
Some of the atomic headers use constructs such as disabling interrupts
which are not permitted in user space and if they were, would _silently_
fail. Other atomic operations such as <asm/bitops.h>, <asm/spinlock.h>
and xchg() <asm/system.h> have the same restriction.
Another trap is that in userspace PIC code may be used while in the kernel
it generally is not used and therefore much of the inline assembler code in
the kernel might fail.
In short, the kernel is a different universe :-)
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-04 4:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1172958807.453840.180700@30g2000cwc.googlegroups.com>
2007-03-04 2:09 ` asm/atomic.h and user code Robert Hancock
2007-03-04 3:03 ` Ralf Baechle
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.