lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa686aa40903120901me307a54y3511f4bafc6242e6@mail.gmail.com>
Date:	Thu, 12 Mar 2009 10:01:27 -0600
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Timur Tabi <timur@...escale.com>
Cc:	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	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 Thu, Mar 12, 2009 at 9:54 AM, Timur Tabi <timur@...escale.com> wrote:
> On Wed, Mar 11, 2009 at 9:45 PM, Grant Likely <grant.likely@...retlab.ca> wrote:
>
>>> The other big advantage of that approach is that drivers that aren't in
>>> an atomic section can use msleep() and allow the kernel to schedule on
>>> that processor.
>>
>> Ack!  I totally agree.
>
> I'm glad everyone agrees.  I still don't know how to solve the
> problem, though.  I came up with this:
>
> #define spin_until_timeout(condition, timeout)          \
>       for (unsigned long __timeout = jiffies + (timeout);     \
>               (!(condition) && time_after(jiffies, __timeout)); )
>
> Now how do I modify this so that the caller knows whether the loop
> terminated because of a timeout or the condition became true?

How about this:

#define spin_until_timeout(condition, timeout, rc)          \
      for (unsigned long __timeout = jiffies + (timeout);     \
              (!(rc = (condition)) && time_after(jiffies, __timeout)); )

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ