Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755544AbcCBUKh (ORCPT ); Wed, 2 Mar 2016 15:10:37 -0500 Received: from mail-db3on0090.outbound.protection.outlook.com ([157.55.234.90]:9495 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755366AbcCBUKc (ORCPT ); Wed, 2 Mar 2016 15:10:32 -0500 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none;ezchip.com; dmarc=none action=none header.from=ezchip.com; From: Chris Metcalf To: Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , "Rik van Riel" , Tejun Heo , Frederic Weisbecker , Thomas Gleixner , "Paul E. McKenney" , Christoph Lameter , Viresh Kumar , Catalin Marinas , Will Deacon , Andy Lutomirski , Daniel Lezcano , CC: Chris Metcalf Subject: [PATCH v10 08/12] arm, tile: turn off timer tick for oneshot_stopped state Date: Wed, 2 Mar 2016 15:09:32 -0500 Message-ID: <1456949376-4910-9-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1456949376-4910-1-git-send-email-cmetcalf@ezchip.com> References: <1456949376-4910-1-git-send-email-cmetcalf@ezchip.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CPI:12.216.194.146;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(339900001)(189002)(199003)(19580405001)(105606002)(87936001)(1096002)(106466001)(5008740100001)(92566002)(6806005)(189998001)(104016004)(85426001)(81156011)(1220700001)(19580395003)(5003940100001)(47776003)(4326007)(48376002)(5001970100001)(33646002)(36756003)(50226001)(5001770100001)(586003)(11100500001)(4001430100002)(50466002)(229853001)(2950100001)(50986999)(76176999)(42186005)(2906002)(107886002)(921003)(42882005)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR05MB1695;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD006;1:KzyiX0uYox8utBM10LNF+TqanQpbuo9qpgqz9KpyGbjIRGf8JKUM6yieVzrKuyqczKFQOZbXmBCNSMNgh5kpJ0PYl1lIunus297F3aKgrIx9y/5kXBD582XSZtwrRfdi9PXXCol1rLWSSQppoiHJjUNZwuzJsStPOYMrV2zcdjZtf29EsSrzt6nctUXir5iJQxIhkgDL6DH9YwfmRmrVP2xtMa2UrsQVv+YLOXr2ZwOg3pYA8ji0bQNyoPyxrbPxP2jU1WhOE0E+rjqcpsxkAgpecbXZu7zk+iMMAeAmA4Lo6RK/6Jqz9oN6yYNuuUmSQOJ1ebASFlgakpDUuab3Gi71/NX43uzWJr7DGWdOuyTJydJJcMy5bQ9jfTipJ20PteMeB98xssDEcoI3hxYi7oQC1pUEu6KkxwrB2SDktxmGRe6eVOJ67ZCFaoNgkLY9HGXcGs2lepQR+MNEV0cCuaYWfO02I6AwQQfFzwOidXxRnI7jVNHRvjcpjJJnqMKb MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: efd1799e-66f5-470b-ba97-08d342d6b18d X-Microsoft-Exchange-Diagnostics: 1;VI1PR05MB1695;2:uKjOsNq2DyvrDz3Yvat1Y8a2mQy6NPItid97iX6nC3EuFxm8i8wJAZpZItQGsrTwmycPWZ640dx2sNqbRM16zE9UBlGpI9seEtbbB0aNISLbP+JxIzjWGJFc9KCyagSbyy5KSN6WEg0YCm64ozjybvb1Tpf8Zdax7++6SWlqRm3bC83sI39knMAyifg/2dsV;3:kbjRdoB7Nk4m7kehj2M/yCGfkXvffKhHMn2ipXj72GaK2UZod+dyoVRhbBLqRuUI1uNg1RvSQ3pLT73FEbmBdxOxsSHisEhdtLMPGL+HYTNG8k1hkAMxbf2/L9RQWlTVl3zEFpgX0bqj8hrOjZb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uKWCTk3vv+lxBXek6Sh82d9meVz1ADIyCEU/Bpdg5iwYu5rkDmEaZg9puzjcJ3kNR3a/nnvd8bcJaVZ2ayveST4Y= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(5005006)(8121501046)(13018025)(3002001)(10201501046);SRVR:VI1PR05MB1695;BCL:0;PCL:0;RULEID:;SRVR:VI1PR05MB1695; X-Microsoft-Exchange-Diagnostics: 1;VI1PR05MB1695;4:45LsYsRfSPk1KG1pZ4bI2T5p9x1R1GdwrZu1kJ1wAUDAqiMbpqz63yHZMLvaOtoqgxRVOVpjHeisvQ0EgaTphHdNO0UIrop1V1k7ouT+EDDBU7k5Yo1LJkcZroL1WkEo0QeJ99vQXuAWi7cVOBeuNzG/HthIB/AX7iNWc7pKSPwxfP2xD7CSo12yTQVBV/rkzHspu6GzLuXMelBcRssQN1PSe6LVu/NxATbLq7ajL8dL9TkiChz7y6Wro1d6aPtsCyC8dhCv/rR8N8QLWWogqoSE3L31xU6pCIcJlq3MyNhr8Fd/8zw8INJ6xZn3uI5JhLIbLCr1VSOrdMQlO5ZZUGHngUosmCTsiEjo28f7jYBRR6aJv+n20QSCLdZ0VbLtqUvOJ+fLYDBkyrRteAwQpOAvJmvvwqqFvZoBmOFKF4rCsjUFef8xkuLisk1bUPJlSrJjWqrQbnaHjUaaXHJmUw== X-Forefront-PRVS: 086943A159 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR05MB1695;23:Eckm3fxx2x7IJML/KNfKJvVZdaJMlgU4VPRPur9PP?= =?us-ascii?Q?AS0y2p+ixG+BIBrXK5tdPeH8U7xzOs7SKgYzLDPD7H6NvwpXqf7i39t8Kcsi?= =?us-ascii?Q?WyGz9/TC814xuVvu2sSy7JreXB4R6gK+0O1vYm7IL2Z4HTy6ZTQVQ1JeBnCi?= =?us-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BmQ/M0/wq0uL2J1RMxNZl14?= =?us-ascii?Q?W+j7i76/yvp9WSLei3kic7/MY/rnBCa0pZ2Q/vaD1HhRLDmMbn2xZ4OBCnQY?= =?us-ascii?Q?/B7+oLc4Oypu1B5PFW0WiFZKmhZ1He9?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR05MB1695;5:smXcq6h0ipNj7h1x8IOLbBVRFzDOQSPkjO8J3Z1oeHEqqaNqcONQg7wX3XSnbsnw1yFrUBYGcydR3gzbvEihy/NdVR1lkWgevQOD7yQpnXrLRlUF/hkR8g4K/ZiBsMe/S5iEfSttfsm0sroTVvtIUg==;24:iKy+HaPwRWNd9J6ypi1uAjYQ99/gFm/3FGZ+X5KLVu8f+4DLFTo6QspJSRfBlXPnkpWKOeq6gSqw02ZsqoOUkxQKe7GS7WuW2ovqwEj4nEE= X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2016 20:10:25.4450 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1695 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2517 Lines: 59 When the schedule tick is disabled in tick_nohz_stop_sched_tick(), we call hrtimer_cancel(), which eventually calls down into __remove_hrtimer() and thus into hrtimer_force_reprogram(). That function's call to tick_program_event() detects that we are trying to set the expiration to KTIME_MAX and calls clockevents_switch_state() to set the state to ONESHOT_STOPPED, and returns. See commit 8fff52fd5093 ("clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state") for more background. However, by default the internal __clockevents_switch_state() code doesn't have a "set_state_oneshot_stopped" function pointer for the arm_arch_timer or tile clock_event_device structures, so that code returns -ENOSYS, and we end up not setting the state, and more importantly, we don't actually turn off the hardware timer. As a result, the timer tick we were waiting for before is still queued, and fires shortly afterwards, only to discover there was nothing for it to do, at which point it quiesces. The fix is to provide that function pointer field, and like the other function pointers, have it just turn off the timer interrupt. Any call to set a new timer interval will properly re-enable it. This fix avoids a small performance hiccup for regular applications, but for TASK_ISOLATION code, it fixes a potentially serious kernel timer interruption to the time-sensitive application. Signed-off-by: Chris Metcalf --- arch/tile/kernel/time.c | 1 + drivers/clocksource/arm_arch_timer.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index 178989e6d3e3..fbedf380d9d4 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c @@ -159,6 +159,7 @@ static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = { .set_next_event = tile_timer_set_next_event, .set_state_shutdown = tile_timer_shutdown, .set_state_oneshot = tile_timer_shutdown, + .set_state_oneshot_stopped = tile_timer_shutdown, .tick_resume = tile_timer_shutdown, }; diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index c64d543d64bf..727a669afb1f 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -288,6 +288,8 @@ static void __arch_timer_setup(unsigned type, } } + clk->set_state_oneshot_stopped = clk->set_state_shutdown; + clk->set_state_shutdown(clk); clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff); -- 2.1.2