From: Esben Nielsen <nielsen.esben@gogglemail.com>
To: Esben Nielsen <nielsen.esben@gogglemail.com>
Cc: Xupei Liang <tliang@yahoo.com>,
Liu Dave-r63238 <DaveLiu@freescale.com>,
linuxppc-embedded@ozlabs.org
Subject: RE: atomic operations in user space
Date: Tue, 29 Aug 2006 13:30:06 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0608291329170.12461@frodo.shire> (raw)
In-Reply-To: <Pine.LNX.4.64.0608291323390.12461@frodo.shire>
On Tue, 29 Aug 2006, Esben Nielsen wrote:
>
>
> On Tue, 29 Aug 2006, Li Yang-r58472 wrote:
>
>>
>> > -----Original Message-----
>> > From: Esben Nielsen [mailto:nielsen.esben@gogglemail.com]
>> > Sent: Tuesday, August 29, 2006 5:57 PM
>> > To: Liu Dave-r63238
>> > Cc: Li Yang-r58472; Esben Nielsen; Xupei Liang;
>> linuxppc-embedded@ozlabs.org
>> > Subject: RE: atomic operations in user space
>> >
>> >
>> >
>> > On Tue, 29 Aug 2006, Liu Dave-r63238 wrote:
>> >
>> > > > > 2) These mutexes are based on futexes which requires atomic
>> > > > > operations in userspace. These are available on most
>> architectures.
>> > > Look at
>> > > > > the glibc code in
>> > > > > nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h for instance.
>> > > > > Use that and your PPC manual to implement your atomic operations.
>> > > >
>> > > > No matter semaphore or futex, it uses system calls to kernel.
>> >
>> > There is only a system call if there is congestion - that is the whole
>> idea
>> > behind the futex.
>> >
>> > > > And the
>> > > > true atomic operation is in kernel not user space.
>> >
>> > "True" atomic operations are available in user space on most
>> architectures.
>> >
>> > > > Maybe
>> > > > it's feasible
>> > > > for other architectures to do atomic operations directly in
>> > > > user space.
>> > > > IMHO, not for powerpc.
>> >
>> > It is available for PowerPC, but not in POWER and POWER2
>> instructionsets
>> > according to http://www.nersc.gov/vendor_docs/ibm/asm/lwarx.htm#idx607
>> > It is the same in the ARM world: Atomic instructions was introduced in
>> > ARMv6 I believe. Older ARM processors don't have them.
>>
>> Yes, I do know there are lwarx and stwrx instructions. But there is
>> only one reservation per CPU and reservation can be re-established with
>> no difference.
>> So there are possibilities reservation is broken and reserved again in
>> one atomic block.
>>
>> Task A Task B
>> lwarx
>> ......
>> lwarx
>> stwrx
>>
>> .....
>> .....
>> lwarx
>> stwrx
>> .....
>> stwrx
>>
>> The addresses of above operations are the same.
>>
>> In this case Thread A thinks that it is atomic as it holds the same
>> reservation, but it is actually broken. Such control flow can't be
>> prevented in user space.
>>
>
> So you are saying that futexes on powerpc are broken?
Are you sure the reservation isn't automaticly broken due to the task
switch?
>
> Esben
>
Esben
>> >
>> > >
>> > > Are you meaning that we didn't do atomic operations directly in user
>> > > space
>> > > on powerpc platform ?
>> > >
>> >
>> > Well, that is not the conclusion I get either when reading the glibc
>> code.
>> > Try to look at glibc-2.3.5/sysdeps/powerpc/bits/atomic.h.
>> >
>> > This is by the way probably what the original post in this thread
>> wanted
>> > in the first place!
>> >
>> > Esben
>> >
>> >
>> > > -DAve
>>
>> _______________________________________________
>> Linuxppc-embedded mailing list
>> Linuxppc-embedded@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>>
>
>
next prev parent reply other threads:[~2006-08-29 11:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-29 0:43 atomic operations in user space Xupei Liang
2006-08-29 6:43 ` Li Yang-r58472
2006-08-29 8:33 ` Esben Nielsen
2006-08-29 8:54 ` Li Yang-r58472
2006-08-29 9:20 ` Liu Dave-r63238
2006-08-29 9:56 ` Esben Nielsen
2006-08-29 10:05 ` Liu Dave-r63238
2006-08-29 10:52 ` Li Yang-r58472
2006-08-29 11:26 ` Esben Nielsen
2006-08-29 11:30 ` Esben Nielsen [this message]
2006-08-29 12:36 ` Brent Cook
-- strict thread matches above, loose matches on Subject: below --
2006-08-30 2:17 Liu Dave-r63238
2006-08-30 2:27 ` Liu Dave-r63238
2006-08-30 2:40 ` Li Yang-r58472
2006-08-29 13:37 Li Yang
2006-08-29 16:05 ` Esben Nielsen
2006-08-29 17:00 ` Li Yang
2006-08-23 19:03 Terry Liang
2006-08-24 10:39 ` Li Yang-r58472
2006-08-24 14:18 ` Brent Cook
2006-08-25 2:33 ` Li Yang-r58472
2006-08-22 20:50 Xupei Liang
2006-08-22 22:23 ` Arnd Bergmann
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=Pine.LNX.4.64.0608291329170.12461@frodo.shire \
--to=nielsen.esben@gogglemail.com \
--cc=DaveLiu@freescale.com \
--cc=linuxppc-embedded@ozlabs.org \
--cc=tliang@yahoo.com \
/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;
as well as URLs for NNTP newsgroup(s).