mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Timur Tabi <timur@freescale.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-kernel@vger.kernel.org, rdreier@cisco.com,
	jirislaby@gmail.com, will.newton@gmail.com, hancockrwd@gmail.com,
	jeremy@goop.org
Subject: Re: [PATCH v4] introduce macro spin_event_timeout()
Date: Thu, 12 Mar 2009 22:51:10 -0600	[thread overview]
Message-ID: <fa686aa40903122151s1bce1a18x156130b97f4d19cd@mail.gmail.com> (raw)
In-Reply-To: <1236913421.25062.19.camel@pasglop>

On Thu, Mar 12, 2009 at 9:03 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
>
>> But that's the thing - I don't want a required delay inside the loop.
>>
>> I guess I'm going to have to think about this for a while.  I'd like
>> to see something like cycles_per_usec() as a companion function to
>> get_cycles().
>
> I think that's where you're wrong :-)

And I disagree.  :-)

> Just require the delay inside the loop, it will make everything nicer.
> There are also some good reasons to do that:
>
>  - The delay between "polls" of the register may have to be controlled,
> for example some HW will choke if polled too fast

Yes, but not all HW does.  There have been several times that I've
needed to spin on a register without any delay.  Requiring the loop
block to include an explicit delay nullifies most of usefulness to me.

>  - If you aren't in an atomic section, you may want to use msleep() and
> thus be schedule friendly

This I agree with, and I see a real use for.  However, if the contents
of the block don't have any form of constant delay, then it is less
clear how long the loop is going to run for.

OTOH, for the kind of delays that I see myself using it for, it if
doesn't have a resolution in the range of timebase ticks, then it
probably isn't going to be useful for me.  I certainly am not
interested in spinning for more than a handful of ticks if I can help
it.

>  - It fixes all the problems mentioned earlier

On another note; I'd consider calling it loop_event_timeout() instead
of spin_event_timeout() since it would allow the block contents to
sleep, and hence it wouldn't be spinning anymore.  :-)

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

  reply	other threads:[~2009-03-13  4:51 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
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 [this message]
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=fa686aa40903122151s1bce1a18x156130b97f4d19cd@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --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=timur@freescale.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

Powered by JetHome