Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754081AbXLGKel (ORCPT ); Fri, 7 Dec 2007 05:34:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751406AbXLGKec (ORCPT ); Fri, 7 Dec 2007 05:34:32 -0500 Received: from smtp2.linux-foundation.org ([207.189.120.14]:51668 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385AbXLGKeb (ORCPT ); Fri, 7 Dec 2007 05:34:31 -0500 Date: Fri, 7 Dec 2007 02:32:41 -0800 From: Andrew Morton To: Ingo Molnar Cc: Stefano Brivio , Robert Love , linux-kernel@vger.kernel.org, Dave Jones , "Rafael J. Wysocki" , Michael Buesch , Thomas Gleixner , Len Brown Subject: Re: [PATCH] scheduler: fix x86 regression in native_sched_clock Message-Id: <20071207023241.15274ef6.akpm@linux-foundation.org> In-Reply-To: <20071207084559.GA11162@elte.hu> References: <20071207021952.6f0ac922@morte> <20071207084559.GA11162@elte.hu> X-Mailer: Sylpheed 2.4.1 (GTK+ 2.8.17; x86_64-unknown-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: 2461 Lines: 67 On Fri, 7 Dec 2007 09:45:59 +0100 Ingo Molnar wrote: > > * Stefano Brivio wrote: > > > This patch fixes a regression introduced by: > > > > commit bb29ab26863c022743143f27956cc0ca362f258c > > Author: Ingo Molnar > > Date: Mon Jul 9 18:51:59 2007 +0200 > > > > This caused the jiffies counter to leap back and forth on cpufreq > > changes on my x86 box. I'd say that we can't always assume that TSC > > does "small errors" only, when marked unstable. On cpufreq changes > > these errors can be huge. > > ah, printk_clock() still uses sched_clock(), not jiffies. So it's not > the jiffies counter that goes back and forth, it's sched_clock() - so > this is a printk timestamps anomaly, not related to jiffies. I thought > we have fixed this bug in the printk code already: sched_clock() is a > 'raw' interface that should not be used directly - the proper interface > is cpu_clock(cpu). Does the patch below help? > > Ingo > > -----------------------> > Subject: sched: fix CONFIG_PRINT_TIME's reliance on sched_clock() > From: Ingo Molnar > > Stefano Brivio reported weird printk timestamp behavior during > CPU frequency changes: > > http://bugzilla.kernel.org/show_bug.cgi?id=9475 > > fix CONFIG_PRINT_TIME's reliance on sched_clock() and use cpu_clock() > instead. > > Reported-and-bisected-by: Stefano Brivio > Signed-off-by: Ingo Molnar > --- > kernel/printk.c | 2 +- > kernel/sched.c | 7 ++++++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > Index: linux/kernel/printk.c > =================================================================== > --- linux.orig/kernel/printk.c > +++ linux/kernel/printk.c > @@ -680,7 +680,7 @@ asmlinkage int vprintk(const char *fmt, > loglev_char = default_message_loglevel > + '0'; > } > - t = printk_clock(); > + t = cpu_clock(printk_cpu); > nanosec_rem = do_div(t, 1000000000); > tlen = sprintf(tbuf, > "<%c>[%5lu.%06lu] ", A bit risky - it's quite an expansion of code which no longer can call printk. You might want to take that WARN_ON out of __update_rq_clock() ;) -- 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/