Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757734AbZKRQ2v (ORCPT ); Wed, 18 Nov 2009 11:28:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757712AbZKRQ2u (ORCPT ); Wed, 18 Nov 2009 11:28:50 -0500 Received: from mail-gx0-f226.google.com ([209.85.217.226]:43258 "EHLO mail-gx0-f226.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757697AbZKRQ2s (ORCPT ); Wed, 18 Nov 2009 11:28:48 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=QkEsIaJIkvR74T8fIdGN4h2OF5IUpBO4WjrzFUwLx4GO/c6MEsGS77zqS3euYR1Cbt 2erh9NrtTJG3O1KsJ2VVcO0vDsyhL9TGnW1VSHPVzAPKcbzYZFxfZP0mjwPGtJaCt7dc SzTuLEBq2+YYev2T/BVQIRJQiL/NOn2+qX/50= MIME-Version: 1.0 In-Reply-To: <20091118010520.4cd397d4@lxorguk.ukuu.org.uk> References: <20091107210147.3e754278@hyperion.delvare> <4AF7148C.9090706@thebigcorporation.com> <20091112211255.09cd884a@hyperion.delvare> <20091116155606.GC29479@sirena.org.uk> <20091118010520.4cd397d4@lxorguk.ukuu.org.uk> Date: Wed, 18 Nov 2009 17:28:53 +0100 Message-ID: Subject: Re: yield() in i2c non-happy paths hits BUG under -rt patch From: Leon Woestenberg To: Alan Cox Cc: Mark Brown , Thomas Gleixner , Jean Delvare , Sven-Thorsten Dietrich , linux-i2c@vger.kernel.org, rt-users , "Ben Dooks (embedded platforms)" , Peter Zijlstra , LKML Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1667 Lines: 44 Hello, On Wed, Nov 18, 2009 at 2:05 AM, Alan Cox wrote: >> I think the yield()s in the device driver code means "I need a small >> delay before the hardware is ready" which might translate to some >> arbitrary "let me msleep()" or "do not select this task in the next >> scheduler run, EVEN IF this task is highest priority". > > Yield() in a driver is almost always a bug. > I know and that's exactly why I started this thread (and of course, because I ran into the bug on my system). > Our timers are very efficient and some day we will need to make jiffies a > function and stop the timer ticking for best performance. At that point > timers are probably the most efficient way to do much of this. > The problem with I2C bitbanged is the stringent timing, we need a way to have fine-grained sleeping mixed with real-time tasks in order to make this work. As Thomas already said, the hardware is broken (in the sense that I2C should really rely on hardware timers, i.e. an I2C host controller). However, much of the cheaper/older/... embedded hardware is broken. Given that I2C devices are relatively easy on the timing, we need the least-dirty way that is not buggy in the kernel. > Be that as it may, yield() in a driver is almost always the wrong thing > to do. > Yes. What is your idea on removing those without breaking functionality? Fine-graining sleep()ing? Regards, -- Leon -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/