From: Timur Tabi <timur@freescale.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linux-kernel@vger.kernel.org, rdreier@cisco.com,
jirislaby@gmail.com, peterz@infradead.org, will.newton@gmail.com,
hancockrwd@gmail.com, jeremy@goop.org
Subject: Re: [PATCH v4] introduce macro spin_event_timeout()
Date: Wed, 11 Mar 2009 11:48:05 -0500 [thread overview]
Message-ID: <ed82fe3e0903110948w542a864dj821106900755f14e@mail.gmail.com> (raw)
In-Reply-To: <20090311003756.25ffa6f4@lxorguk.ukuu.org.uk>
On Tue, Mar 10, 2009 at 7:37 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> Given the proposed helper isn't a sane default for x86 I think it needs a
> good deal more work.
Alan, I'm happy to put whatever effort is requirement to make this
code satisfactory. I believe that this is a useful macro to have in
the kernel. I do appreciate the attention you are giving it.
> It also hides details like that timing which is bad
> sometimes.
Are you talking about the udelay() inside the loop? If so, I agree
that this is bad and have removed it in the PowerPC-specific version:
#define spin_event_timeout(condition, timeout) \
({ \
unsigned long __start = get_tbl(); \
unsigned long __loops = tb_ticks_per_usec * timeout; \
int __ret = 1; \
while (!(condition)) { \
if (tb_ticks_since(__start) > __loops) { \
__ret = 0; \
break; \
} \
cpu_relax(); \
} \
__ret; \
})
tb_ticks_since() is a front-end to get_tbl(), which is similar to the
rdtsc instruction. In this case, we're not adding arbitrary delays
into the loop, and we're not using jiffies, but we are
architecture-dependent.
--
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2009-03-11 16:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 15:30 Timur Tabi
2009-03-10 15:35 ` Alan Cox
2009-03-10 15:50 ` Timur Tabi
2009-03-10 16:05 ` Will Newton
2009-03-10 16:11 ` Timur Tabi
2009-03-11 0:01 ` Benjamin Herrenschmidt
2009-03-11 0:37 ` Alan Cox
2009-03-11 16:48 ` Timur Tabi [this message]
2009-03-11 16:58 ` Alan Cox
2009-03-11 18:18 ` Timur Tabi
2009-03-11 21:58 ` Benjamin Herrenschmidt
2009-03-12 2:45 ` Grant Likely
2009-03-12 15:54 ` Timur Tabi
2009-03-12 16:01 ` Grant Likely
2009-03-12 16:19 ` Timur Tabi
2009-03-12 16:50 ` Peter Zijlstra
2009-03-12 19:05 ` Timur Tabi
2009-03-13 3:03 ` Benjamin Herrenschmidt
2009-03-13 4:51 ` Grant Likely
2009-03-10 18:41 ` Grant Likely
2009-03-10 19:04 ` Timur Tabi
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=ed82fe3e0903110948w542a864dj821106900755f14e@mail.gmail.com \
--to=timur@freescale.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=hancockrwd@gmail.com \
--cc=jeremy@goop.org \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rdreier@cisco.com \
--cc=will.newton@gmail.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
all inboxes | Powered by JetHome®