From: NIIBE Yutaka <gniibe@fsij.org>
To: Carlos O'Donell <carlos@systemhalted.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>,
debian-hppa@lists.debian.org,
linux-parisc <linux-parisc@vger.kernel.org>,
Helge Deller <deller@gmx.de>
Subject: Re: CAS (lws_compare_and_swap32)
Date: Thu, 01 Apr 2010 10:16:58 +0900 [thread overview]
Message-ID: <4BB3F40A.7020401@fsij.org> (raw)
In-Reply-To: <119aab441003301338o1d0582f3wdbf82681f88ed671@mail.gmail.com>
Hi all, thanks for your attention.
Carlos O'Donell wrote:
> On UP you have a problem:
> * Thread A enters LWS CAS (no lock on UP)
> * Thread A writes to CAS address causing COW
> * Thread A sleeps.
> * Thread A completes COW, but finishes time slice before the write is restarted.
> * Thread B enters LWS CAS (no lock on UP)
> * Thread B writes to CAS address, and finishes time slice.
> * Thread A writes to CAS address and clobbers B's value.
I thought like that:
(condition like a young process, or a process after fork
which occurs COW)
* Thread A enters LWS CAS (no lock on UP)
* Thread A writes to CAS address causing COW
* Thread A sleeps for new memory.
Kernel process scheduling:
Thread A sleeps
-> swapper wakes up and got new memory, then sleep
-> Thread B wakes up
* Thread B enters LWS CAS (no lock on UP)
* Thread B writes to CAS address, causing COW, this time we have memory.
Writes completes, and finishes time slice.
Kernel process scheduling like that:
Thread B sleeps -> Thread A wakes up
* Thread A writes to CAS address and clobbers B's value.
Today, I have a next question. Is there any cache alias problem here?
Should we invalidate the cache line before "load" and flush the cache
line after "store"?
I am testing on paer.debian.org. It says D-cache is wribe back,
and that's my concern.
--------------------------
Welcome to paer.debian.org, the Debian hppa porterbox
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Last login: Wed Mar 31 02:31:27 2010 from 150.82.175.29
gniibe@paer:~$ cat /proc/cpuinfo
processor : 0
cpu family : PA-RISC 2.0
cpu : PA8700 (PCX-W2)
cpu MHz : 750.000000
capabilities : os64
model : 9000/800/A500-7X
model name : Crescendo 750 W2
hversion : 0x00005e30
sversion : 0x00000491
I-cache : 768 KB
D-cache : 1536 KB (WB, direct mapped)
ITLB entries : 240
DTLB entries : 240 - shared with ITLB
bogomips : 1495.04
software id : 822930640
--------------------------
--
next prev parent reply other threads:[~2010-04-01 1:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4BB0B2C8.8000302@fsij.org>
[not found] ` <119aab441003290913x6cb925b9v66b44a14c31393cb@mail.gmail.com>
2010-03-29 19:31 ` CAS (lws_compare_and_swap32) Carlos O'Donell
2010-03-29 20:07 ` Kyle McMartin
2010-03-30 20:38 ` Carlos O'Donell
2010-03-30 21:36 ` Kyle McMartin
2010-04-01 1:16 ` NIIBE Yutaka [this message]
2010-04-01 1:57 ` NIIBE Yutaka
2010-03-30 1:54 ` John David Anglin
2010-03-30 2:18 ` Carlos O'Donell
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=4BB3F40A.7020401@fsij.org \
--to=gniibe@fsij.org \
--cc=carlos@systemhalted.org \
--cc=debian-hppa@lists.debian.org \
--cc=deller@gmx.de \
--cc=kyle@mcmartin.ca \
--cc=linux-parisc@vger.kernel.org \
/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 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.