From: Joel GUILLET <Joel.Guillet@bull.net>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] _raw_write_trylock() missing
Date: Tue, 04 Feb 2003 14:18:22 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590709805811@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805809@msgid-missing>
On Tue, 4 Feb 2003, Peter Chubb wrote:
>
> When I try to build 2.5.59 for an SMP machine, I see that
> _raw_write_trylock() is undefined. As the read-write spin locks are
> all implemented as magic assembler, I don't feel competent to create
> it...
>
> Peter C
>
Hello,
Here is an implementation of "_raw_write_trylock_ " needed for preemption support with SMP.
I tested it on a 2.5.59 kernel with 2 Itaniums. It seems to work.
As I'm not used to deal with ia64 assembler (it's my first try), it would
be better if someone could check the code.
What the macro is doing : (at least, what I think it is doing)
- if the actual lock value is equal to "0",
change the lock value to "00.....0001"
else do nothing
The value of the macro is 0 if the lock value has been changed and
different from 0 in other cases.
The code for this : (in include/asm-ia64/spinlock.h)
#define _raw_write_trylock(rw) \
({ \
register long result; \
\
__asm__ __volatile__ ( \
"mov ar.ccv = r0\n" \
"dep r29 = -1, r0, 31, 1\n" \
";;\n" \
"1:\n" \
"cmpxchg4.acq %0 = [%1], r29, ar.ccv\n" \
:"=r"(result) :"r"(rw) : "ar.ccv", "r2", "r29", "memory"); \
(result == 0); \
})
Regards,
---------
Joël
next prev parent reply other threads:[~2003-02-04 14:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-04 2:53 [Linux-ia64] _raw_write_trylock() missing Peter Chubb
2003-02-04 14:18 ` Joel GUILLET [this message]
2003-02-05 1:46 ` Ian Wienand
2003-02-05 8:39 ` Joel GUILLET
2003-03-04 19:57 ` David Mosberger
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=marc-linux-ia64-105590709805811@msgid-missing \
--to=joel.guillet@bull.net \
--cc=linux-ia64@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox