From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from az33egw02.freescale.net (az33egw02.freescale.net [192.88.158.103]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "az33egw02.freescale.net", Issuer "Thawte Premium Server CA" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id B3E83DE223 for ; Thu, 12 Mar 2009 09:49:42 +1100 (EST) Message-ID: <49B83FF9.1020703@freescale.com> Date: Wed, 11 Mar 2009 17:49:29 -0500 From: Scott Wood MIME-Version: 1.0 To: Timur Tabi Subject: Re: [PATCH v5] introduce macro spin_event_timeout() References: <1236723118-3577-1-git-send-email-timur@freescale.com> <49B6EAA4.9000803@freescale.com> <20090310223753.GB26415@zod.rchland.ibm.com> <1236729551.7086.26.camel@pasglop> <1236731097.7086.32.camel@pasglop> <1236808190.7086.61.camel@pasglop> <49B83332.9040201@freescale.com> In-Reply-To: <49B83332.9040201@freescale.com> Content-Type: text/plain; charset=UTF-8; format=flowed Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Timur Tabi wrote: > Benjamin Herrenschmidt wrote: > >> Well, there's a non-empty set of HW where polling as fast as you can >> will effectively prevent it to make fwd progress... > > Alan Cox mentioned this. He gave PCI and 10us as an example. I > suggested adding a third parameter that would be a udelay() inserted > into the loop. He countered with this: > > spin_until_timeout(readb(foo) & 0x80, 30 * HZ) { > udelay(10); > /* Maybe do other stuff */ > } Hmm, the person objecting that it could lead to people using it for excessive timeouts suggested a timeout of *30 seconds*? > But I don't know how to make that work *and* have it return a value > indicating timeout or success. And it also doesn't allow using the udelay as part of the timeout mechanism. -Scott