[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed82fe3e0903110948w542a864dj821106900755f14e@mail.gmail.com>
Date: Wed, 11 Mar 2009 11:48:05 -0500
From: Timur Tabi <timur@...escale.com>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
linux-kernel@...r.kernel.org, rdreier@...co.com,
jirislaby@...il.com, peterz@...radead.org, will.newton@...il.com,
hancockrwd@...il.com, jeremy@...p.org
Subject: Re: [PATCH v4] introduce macro spin_event_timeout()
On Tue, Mar 10, 2009 at 7:37 PM, Alan Cox <alan@...rguk.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists