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 AD5B3DE107 for ; Thu, 12 Mar 2009 03:52:10 +1100 (EST) Message-ID: <49B7EC27.3030305@freescale.com> Date: Wed, 11 Mar 2009 11:51:51 -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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Cc: linuxppc-dev@ozlabs.org, Roland Dreier List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Timur Tabi wrote: > On Wed, Mar 11, 2009 at 12:09 AM, Roland Dreier wrote: > >> Are there really cases where spinning for 1 jiffy is too long of a >> timeout? > > If the result is a timeout, then I say no. A timeout is an error > condition, and the code will usually terminate. [snip] > Two jiffies can be a very long time. One jiffy is fine, but two is just too long? Given that it only happens in cases of malfunctioning hardware (or a buggy driver), it seems reasonable as long as preemption isn't disabled (I'm assuming anyone that cares about a rare latency of a couple jiffies is using a preemptible kernel). > Besides, if this function is > used when interrupts are disabled, I believe that on some platforms, > jiffies never increments. If so, we can't use the actual 'jiffies' > variable. Disallow that, enforced with a call to might_sleep(). Alternatively, do something with get_cycles(), and have some sort of #define by which arches can say if get_cycles actually works. In the absence of a working get_cycles() or equivalent, timeouts with interrupts disabled aren't going to happen whether we abstract it with a macro or not. -Scott