Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753585AbYFAQQY (ORCPT ); Sun, 1 Jun 2008 12:16:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751066AbYFAQQL (ORCPT ); Sun, 1 Jun 2008 12:16:11 -0400 Received: from one.firstfloor.org ([213.235.205.2]:36475 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbYFAQQJ (ORCPT ); Sun, 1 Jun 2008 12:16:09 -0400 Date: Sun, 1 Jun 2008 18:25:17 +0200 From: Andi Kleen To: Marin Mitov Cc: LKML , Steven Rostedt , Thomas Gleixner , linux-rt-users , akpm@osdl.org, Ingo Molnar , Clark Williams , Peter Zijlstra , "Luis Claudio R. Goncalves" , Gregory Haskins , Linus Torvalds , Andi Kleen Subject: Re: [PATCH][resubmit] x86: enable preemption in delay Message-ID: <20080601162517.GH20824@one.firstfloor.org> References: <200805252108.25011.mitov@issp.bas.bg> <200806011901.23619.mitov@issp.bas.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200806011901.23619.mitov@issp.bas.bg> User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 741 Lines: 23 > static void delay_tsc(unsigned long loops) > { > - unsigned long bclock, now; > + unsigned prev, prev_1, now; > + unsigned left = loops; > + unsigned prev_cpu, cpu; > + > + preempt_disable(); > + rdtscl(prev); The unsigneds should be probably u64 and the rdtsc rdtscll. Otherwise this will all overflow for longer waits on a very fast systems (e.g. a 5Ghz system wraps 32bit in ~1.1 seconds) Normally such delays shouldn't be that long, but why risk overflow even in extreme cases? -Andi -- 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/