From patchwork Thu Jun 20 15:00:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Kleine-Budde X-Patchwork-Id: 2756731 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 09556C0AB1 for ; Thu, 20 Jun 2013 15:01:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DB4520219 for ; Thu, 20 Jun 2013 15:01:50 +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 441AE2017E for ; Thu, 20 Jun 2013 15:01:45 +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 1UpgMn-00086B-NB; Thu, 20 Jun 2013 15:01:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpgMk-0001lH-Rw; Thu, 20 Jun 2013 15:01:38 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpgMg-0001j9-Nt for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2013 15:01:35 +0000 Received: from gallifrey.ext.pengutronix.de ([2001:6f8:1178:4:5054:ff:fe8d:eefb] helo=bjornoya.do.blackshift.org) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UpgM6-0008Nd-Di; Thu, 20 Jun 2013 17:00:58 +0200 Received: from [172.17.34.65] (hardanger.do.blackshift.org [172.17.34.65]) (using TLSv1 with cipher ECDHE-ECDSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: frogger) by bjornoya.do.blackshift.org (Postfix) with ESMTPSA id D08905E8CC; Thu, 20 Jun 2013 17:00:55 +0200 (CEST) Message-ID: <51C31926.3060400@pengutronix.de> Date: Thu, 20 Jun 2013 17:00:54 +0200 From: Marc Kleine-Budde User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130518 Icedove/17.0.5 MIME-Version: 1.0 To: Thomas Gleixner Subject: Re: RFC: [PATCH] clocksource: tcb: fix min_delta calculation References: <517687AB.1040309@pengutronix.de> <1366722524-25991-1-git-send-email-mkl@pengutronix.de> <51794385.1030308@pengutronix.de> In-Reply-To: <51794385.1030308@pengutronix.de> X-Enigmail-Version: 1.5.1 X-SA-Exim-Connect-IP: 2001:6f8:1178:4:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130620_110135_137014_062D6395 X-CRM114-Status: GOOD ( 25.96 ) X-Spam-Score: -3.2 (---) Cc: Nicolas Ferre , linux-kernel@vger.kernel.org, arm@kernel.org, John Stultz , "kernel@pengutronix.de" , Andres Salomon , Shawn Guo , 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=-5.5 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 Hello Thomas, On 04/25/2013 04:53 PM, Marc Kleine-Budde wrote: > On 04/25/2013 04:21 PM, Thomas Gleixner wrote: >> On Tue, 23 Apr 2013, Marc Kleine-Budde wrote: >>> The commit >>> >>> 77cc982 clocksource: use clockevents_config_and_register() where possible >>> >>> switches from manually calculating min_delta_ns (and others) and >>> clockevents_register_device() to automatic calculation via >>> clockevents_config_and_register(). During this conversation the "+ 1" in >>> >>> min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; >>> >>> was lost. This leads to problems with schedule_delayed_work() with a delay of >>> "1". Resulting in the work not scheduled in time. >> >> Errm. How is schedule_delayed_work() related to this? Coming back to the this problem after some time. I'm on at91sam9263 (armv5) using latest linus/master (v3.10-rc6-84-gc069114). I can illustrate the problem running cyclictest. Here's the output of unpatched linus/master: > root@halo22:~ cyclictest -i 10000 -n -t 4 > policy: other/other: loadavg: 0.10 0.19 0.10 2/31 133 > > T: 0 ( 130) P: 0 I:10000 C: 30767 Min: 57 Act: 165 Avg:909453 Max: 201897444 > T: 1 ( 131) P: 0 I:10500 C: 29302 Min: 68 Act: 144 Avg:906651 Max: 204005666 > T: 2 ( 132) P: 0 I:11000 C: 27970 Min: 79 Act: 188 Avg:905068 Max: 204008666 > T: 3 ( 133) P: 0 I:11500 C: 26754 Min: 52 Act: 132 Avg:904438 Max: 203665111 Cyclictest runs for about two seconds, but then shows no output for about two seconds, then it runs again, then stops and so on... With my patch applied, the numbers are back to normal: > root@halo22:~ cyclictest -i 10000 -n -t 4 > policy: other/other: loadavg: 0.34 0.15 0.06 2/32 109 > > T: 0 ( 106) P: 0 I:10000 C: 292 Min: 112 Act: 208 Avg: 189 Max: 1715 > T: 1 ( 107) P: 0 I:10500 C: 277 Min: 107 Act: 198 Avg: 201 Max: 1464 > T: 2 ( 108) P: 0 I:11000 C: 265 Min: 104 Act: 148 Avg: 195 Max: 1530 > T: 3 ( 109) P: 0 I:11500 C: 252 Min: 113 Act: 205 Avg: 167 Max: 269 Cyclictest keeps running without 2 second stops. Is my patch a valid solution to the problem? If so, I'll write more specific commit message. regards, Marc --- The commit 77cc982 clocksource: use clockevents_config_and_register() where possible switches from manually calculating min_delta_ns (and others) and clockevents_register_device() to automatic calculation via clockevents_config_and_register(). During this conversation the "+ 1" in min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; was lost. This leads to problems with schedule_delayed_work() with a delay of "1". Resulting in the work not scheduled in time. This patch fixes the problem by increasing the min_delta to "2" ticks. Signed-off-by: Marc Kleine-Budde --- drivers/clocksource/tcb_clksrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.8.2.rc2 diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c index 8a61872..7cf6dc7 100644 --- a/drivers/clocksource/tcb_clksrc.c +++ b/drivers/clocksource/tcb_clksrc.c @@ -197,7 +197,7 @@ static void __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) clkevt.clkevt.cpumask = cpumask_of(0); - clockevents_config_and_register(&clkevt.clkevt, 32768, 1, 0xffff); + clockevents_config_and_register(&clkevt.clkevt, 32768, 2, 0xffff); setup_irq(irq, &tc_irqaction); }