From patchwork Wed Oct 2 16:55:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2976331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D79E3BFF0B for ; Wed, 2 Oct 2013 16:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD1B520431 for ; Wed, 2 Oct 2013 16:56:56 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 672F7201FA for ; Wed, 2 Oct 2013 16:56:55 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRPj1-0006IE-Lv; Wed, 02 Oct 2013 16:56:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRPiz-0006uv-6w; Wed, 02 Oct 2013 16:56:33 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRPiv-0006tj-JA for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2013 16:56:30 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r92GtVYJ005381; Wed, 2 Oct 2013 11:55:31 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r92GtVtJ022924; Wed, 2 Oct 2013 11:55:31 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Wed, 2 Oct 2013 11:55:31 -0500 Received: from ula0393909.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id r92GtU3C011994; Wed, 2 Oct 2013 11:55:30 -0500 From: Santosh Shilimkar To: Subject: [PATCH] sched_clock: fix postinit no sched_clock function check Date: Wed, 2 Oct 2013 12:55:28 -0400 Message-ID: <1380732928-13897-1-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131002_125629_698141_799887A6 X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -7.6 (-------) Cc: Russell King , Will Deacon , Stephen Boyd , Rob Herring , arm@kernel.org, John Stultz , Santosh Shilimkar , Thomas Gleixner , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The sched_clock code uses 2 levels of function pointers, sched_clock_func() and read_sched_clock() but the no sched_clock check in postinit() just checks read_sched_clock(). This leads to kernel falling back to jiffy based sched clock even in presence of sched_clock_func() which is not desirable. Fix the postinit() check to avoid the issue. Probably the issue is hidden so far on most of the arm SOCs because of already existing sched_clock registrations apart from arch_timer sched_clock. One can reproduce the issue by just have arch_timer as sched_clock Cc: Stephen Boyd Cc: John Stultz Cc: Russell King Cc: Will Deacon Cc: Rob Herring Cc: Thomas Gleixner Signed-off-by: Santosh Shilimkar --- kernel/time/sched_clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 0b479a6..15c4d78 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -179,7 +179,8 @@ void __init sched_clock_postinit(void) * If no sched_clock function has been provided at that point, * make it the final one one. */ - if (read_sched_clock == jiffy_sched_clock_read) + if ((read_sched_clock == jiffy_sched_clock_read) && + (sched_clock_func == sched_clock_32)) setup_sched_clock(jiffy_sched_clock_read, 32, HZ); sched_clock_poll(sched_clock_timer.data);