Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756549AbZKRBEM (ORCPT ); Tue, 17 Nov 2009 20:04:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756403AbZKRBEI (ORCPT ); Tue, 17 Nov 2009 20:04:08 -0500 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:47175 "EHLO www.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756345AbZKRBEF (ORCPT ); Tue, 17 Nov 2009 20:04:05 -0500 Date: Wed, 18 Nov 2009 01:05:20 +0000 From: Alan Cox To: Leon Woestenberg Cc: Mark Brown , Thomas Gleixner , Jean Delvare , Sven-Thorsten Dietrich , linux-i2c@vger.kernel.org, rt-users , "Ben Dooks (embedded platforms)" , Peter Zijlstra , LKML Subject: Re: yield() in i2c non-happy paths hits BUG under -rt patch Message-ID: <20091118010520.4cd397d4@lxorguk.ukuu.org.uk> In-Reply-To: References: <20091107210147.3e754278@hyperion.delvare> <4AF7148C.9090706@thebigcorporation.com> <20091112211255.09cd884a@hyperion.delvare> <20091116155606.GC29479@sirena.org.uk> X-Mailer: Claws Mail 3.7.3 (GTK+ 2.14.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1251 Lines: 30 > 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. The reason for that is that doing do { inb(); } while(!something); which is what yield can end up as being if there is nothing else on that CPU is extremely bad for bus performance on most systems. It's almost always better to be using msleep() or even mdelay + a check to see if a reschedule is needed/schedule(). > I assume this is rather dirty and has too much overhead on the timer interfaces. 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. Be that as it may, yield() in a driver is almost always the wrong thing to do. -- 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/