From: David Mosberger <davidm@napali.hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Re: ia64_spinlock_contention and NEW_LOCK
Date: Wed, 12 Mar 2003 17:27:14 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590709806060@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709806055@msgid-missing>
>>>>> On Wed, 12 Mar 2003 21:19:37 +1100, Keith Owens <kaos@sgi.com> said:
Keith> The inline code for an uncontended lock drops from 5 to 4
Keith> bundles for each use of spin_lock(). The uncontended path
Keith> has one less memory access.
Good.
For McKinley and later, you can use brl to avoid the
movl/indirect-branch combo.
Keith> This code works for spin_lock() in built in code and for
Keith> modules. It does not affect the status of leaf functions, no
Keith> change to ar.pfs or b0.
This is wrong:
+ .prologue
+ .altrp b7
+ .save ar.pfs, r29
+ mov b7=r28 // my "return" address
+ mov r29=0 // dummy ar.pfs, pretend zero frame size
You have a 1-instruction window where the unwind info is wrong.
Single-stepping with the latest Ski beta and using the "cstack"
command, you should be able to see the problem.
Also, it is wrong to pretend to have a zero ar.pfs, since in general
that won't match with the caller's register frame (and the .save
directive would have to go in front of the "mov r29=0" instruction, if
anything). Makes you wish we had a ".alias" unwind directive, which
would specify a register that points to the code with the real unwind
info.
In general, I'm quite nervous about doing such trickery underneath the
compiler. Would you be interested in trying out the alternative of
simply using __sync_val_compare_and_swap(), likely()/unlikely() and
making ia64_spinlock_contention() a normal procedure? I'd rather
pester the compiler folks than live with code that's bound to bite us
in the future. ;-)
--david
next prev parent reply other threads:[~2003-03-12 17:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-12 10:19 [Linux-ia64] Re: ia64_spinlock_contention and NEW_LOCK Keith Owens
2003-03-12 10:35 ` Keith Owens
2003-03-12 17:27 ` David Mosberger [this message]
2003-03-12 21:18 ` Keith Owens
2003-03-12 21:51 ` Keith Owens
2003-03-13 19:16 ` David Mosberger
2003-03-13 21:59 ` Keith Owens
2003-03-13 22:14 ` David Mosberger
2003-03-13 22:20 ` Keith Owens
2003-03-13 22:26 ` David Mosberger
2003-03-13 22:42 ` Keith Owens
2003-03-13 22:46 ` 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-105590709806060@msgid-missing \
--to=davidm@napali.hpl.hp.com \
--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