All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, Timur Tabi <timur@freescale.com>
Subject: Re: [PATCH v5] introduce macro spin_event_timeout()
Date: Tue, 10 Mar 2009 17:58:58 -0500	[thread overview]
Message-ID: <49B6F0B2.70102@freescale.com> (raw)
In-Reply-To: <20090310223753.GB26415@zod.rchland.ibm.com>

Josh Boyer wrote:
> On Tue, Mar 10, 2009 at 05:33:08PM -0500, Scott Wood wrote:
>> Timur Tabi wrote:
>>> The macro spin_event_timeout() takes a condition and timeout value
>>> (in microseconds) as parameters.  It spins until either the condition is true
>>> or the timeout expires.  It returns zero if the timeout expires first, non-zero
>>> otherwise.
>>>
>>> This primary purpose of this macro is to poll on a hardware register until a
>>> status bit changes.  The timeout ensures that the loop still terminates if the
>>> bit doesn't change as expected.  This macro makes it easier for driver
>>> developers to perform this kind of operation properly.
>>>
>>> Signed-off-by: Timur Tabi <timur@freescale.com>
>>> ---
>>>
>>> v5: ported to arch/powerpc, made it powerpc-specific, eliminated udelay
>> Why make it powerpc-specific?  This would be nice to have in  
>> arch-independent code.
> 
> That's just mean.  He already posted it to lkml and was told to make it
> powerpc specific by Alan.

Well, that's what happens when a discussion hops mailing lists with no 
backreference. :-P

I don't see anywhere where he says it should be architecture dependent, 
but rather a general "I don't like this, get off my lawn!" response.

I cannot agree with the "we shouldn't be encouraging this" sentiment; 
people don't generally do spin loops because they're lazy[1], but rather 
because the hardware demands it -- and it's hardly only on powerpc (much 
less just "some Freescale drivers") that I've encountered hardware that 
demands it, typiclally during reset/initialization or similarly non-hot 
paths.  Why not provide something less likely to have bugs (the timeout 
case is unlikely to be well tested), more easily seen when reviewing a 
patch, and more likely to result in spin loops *with* a timeout rather 
than without?

-Scott

[1] Or rather, those that do should be smacked down during patch review.

  reply	other threads:[~2009-03-10 22:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 22:11 [PATCH v5] introduce macro spin_event_timeout() Timur Tabi
2009-03-10 22:33 ` Scott Wood
2009-03-10 22:37   ` Josh Boyer
2009-03-10 22:58     ` Scott Wood [this message]
2009-03-11  0:32       ` Josh Boyer
2009-03-10 23:59     ` Benjamin Herrenschmidt
2009-03-11  0:22       ` Timur Tabi
2009-03-11  0:24         ` Benjamin Herrenschmidt
2009-03-11 17:10           ` Grant Likely
2009-03-11 21:49             ` Benjamin Herrenschmidt
2009-03-11 21:54               ` Timur Tabi
2009-03-11 22:49                 ` Scott Wood
2009-03-11  5:09         ` Roland Dreier
2009-03-11 16:31           ` Timur Tabi
2009-03-11 16:51             ` Scott Wood
2009-03-11 19:14               ` Timur Tabi
2009-03-11 19:22                 ` Scott Wood
2009-03-11 20:45                   ` Timur Tabi
2009-03-11 21:00                     ` Scott Wood
2009-03-11 21:02                       ` Timur Tabi
2009-03-11 21:03                         ` Scott Wood
2009-03-11  0:44       ` Josh Boyer
2009-03-10 23:58 ` Benjamin Herrenschmidt

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=49B6F0B2.70102@freescale.com \
    --to=scottwood@freescale.com \
    --cc=jwboyer@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=timur@freescale.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.