All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: linux-kernel@vger.kernel.org, rdreier@cisco.com,
	peterz@infradead.org, will.newton@gmail.com
Subject: Re: [PATCH v3] add function spin_event_timeout()
Date: Mon, 09 Mar 2009 15:54:19 -0500	[thread overview]
Message-ID: <49B581FB.7060506@freescale.com> (raw)
In-Reply-To: <49B57F45.7040104@gmail.com>

Jiri Slaby wrote:
> On 9.3.2009 21:32, Timur Tabi wrote:
>> +#define spin_event_timeout(condition, timeout)				\
>> +({									\
>> +	int __timeout = timeout;					\
>> +	while (!(condition)&&  --__timeout) {				\
>> +		udelay(1);						\
>> +		cpu_relax();						\
> 
> So you don't need cpu_relax anymore...

I checked the udelay() code.  It varies per platform, but I didn't see
how it always replicated the functionality of cpu_relax().  For example,
in x86_64, cpu_relax is a "rep; nop;".  But I don't see that code
sequence in arch/x86/lib/delay.c.

So I presume that something in the delay functions makes cpu_relax()
unnecessary.  What exactly is the purpose of cpu_relax()?

> And I would make timeout UL like delay functions.

I made it an integer because I don't expect anyone to pass a value
larger than 2^31, but I'll change it.

-- 
Timur Tabi
Linux kernel developer at Freescale

  reply	other threads:[~2009-03-09 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-09 20:32 [PATCH v3] add function spin_event_timeout() Timur Tabi
2009-03-09 20:42 ` Jiri Slaby
2009-03-09 20:54   ` Timur Tabi [this message]
2009-03-10  0:37     ` Robert Hancock

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=49B581FB.7060506@freescale.com \
    --to=timur@freescale.com \
    --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 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.