linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Sean MacLennan <smaclennan@pikatech.com>
Cc: scottwood@freescale.com, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH v6] introduce macro spin_event_timeout()
Date: Fri, 01 May 2009 16:44:19 -0500	[thread overview]
Message-ID: <49FB6D33.6010905@freescale.com> (raw)
In-Reply-To: <20090501173354.64e78def@lappy.seanm.ca>

Sean MacLennan wrote:

> Would cpu_relax be a good thing to put here?
> 
> Something like:
> 
> while (!(rc = (condition)) && (tb_ticks_since(__start) <= __loops)) \
> 	if (delay) \
> 		udelay(delay); \
> 	else \
> 		cpu_relax(); \
> 

I had that at one point, but then I looked at the code for udelay(), and
it appears that if I do udelay(0), it does something similar to cpu_relax:

	start = get_tbl();
	while (get_tbl() - start < loops)
		HMT_low();
	HMT_medium();

cpu_relax does this:

do { HMT_low(); HMT_medium(); barrier(); } while (0)

Well, now that I look at it, cpu_relax() changes the thread priority to
low and then back to medium, whereas udelay() never sets it to low if
'loops' is 0.

I'm okay with changing my code, but I wonder if udelay() should look
like this:

	start = get_tbl();
	HMT_low();
	while (get_tbl() - start < loops)
		HMT_low();
	HMT_medium();

-- 
Timur Tabi
Linux kernel developer at Freescale

      reply	other threads:[~2009-05-01 21:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 19:05 [PATCH v6] introduce macro spin_event_timeout() Timur Tabi
2009-04-29 22:48 ` Timur Tabi
2009-05-01 20:51 ` Kumar Gala
2009-05-01 20:55   ` Timur Tabi
2009-05-01 20:56   ` Scott Wood
2009-05-01 21:33 ` Sean MacLennan
2009-05-01 21:44   ` Timur Tabi [this message]

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=49FB6D33.6010905@freescale.com \
    --to=timur@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=scottwood@freescale.com \
    --cc=smaclennan@pikatech.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;
as well as URLs for NNTP newsgroup(s).