Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933509AbcDERzl (ORCPT ); Tue, 5 Apr 2016 13:55:41 -0400 Received: from mail-db5eur01on0079.outbound.protection.outlook.com ([104.47.2.79]:14416 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758467AbcDERyN (ORCPT ); Tue, 5 Apr 2016 13:54:13 -0400 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=fail action=none header.from=mellanox.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 v12 09/13] arm, tile: turn off timer tick for oneshot_stopped state Date: Tue, 5 Apr 2016 13:38:38 -0400 Message-ID: <1459877922-15512-10-git-send-email-cmetcalf@mellanox.com> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> References: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:12.216.194.146;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(5003940100001)(189998001)(50986999)(36756003)(33646002)(92566002)(48376002)(586003)(1220700001)(50466002)(107886002)(76176999)(86362001)(85426001)(19580395003)(42186005)(19580405001)(5001770100001)(5001970100001)(50226001)(2950100001)(6806005)(47776003)(2906002)(4326007)(960300001)(229853001)(106466001)(104016004)(5008740100001)(4001430100002)(87936001)(105606002)(11100500001)(1096002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR05MB1684;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD006;1:NwCafewcKpQGeKfmxgzso16LLwfJKp0osa/3RlPNnq9zfIZkpQP6ZhiRDUlWmyjoZURoRY9sGPcK8IVhAgiseJXQlpqT9V9K/9Mlv4TBcuiuu1k6BYJXVZS+TMwd8/EEN+q0zpDBlJBSLGqcXG4Kg1YqCVGOoTOFLVSXc/jOKM9msrcuteD85TTVPDf71xVRDgto8UXPHGj69bH4h2KDEaDYko4CbAcyKyd0yfp7Q5l+vF8lf/pQjmlYRdxdrUvMVRRlIhNkOO3C0m+DSnIPjAAQQux6aUKOBDxHIPCcYd9KpFlfpNZh4tmAkno4J9oNGNcUk0T7ELWMSFRoOyMT3c1NITWM5NDB0xdAe5WTt3GFNx2XFsEjzsAs3Vwp1PSFrDeLkYvPfCz2YjcG+J22ChwsXEQ5uM7RezIHNn2tCs5EW0OXXBFElFjQZZ3nWqqh30s+vrFi9Drl79SNyDSqu8FCyEgiMebTFP33U/P8eHR+Pk2djEN472CkrqH2l8GxkLLQsUK9VSH9GaVE0J/rTYHzSM3DXfWM+t3kXaUYCVpL1DU5BLGg74jtW1C6AC9Gn8ewEHER37qTHH+pTTG9FEAgCtzDobt7winIOenTOy7wCZdHRSCMB8qNY9bQ3Rcq41te1NMNeFwZ71q+0Fn2MA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c9475dbc-525f-478f-ad55-08d35d793a91 X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1684;2:zxKxM9gTP2AtoSSQIrsxVawe6fwDutn7CGE68kNV0MDZMVH2gNdWyBotId8xI9vH8TDS2/hIW2EWs12q9JiAxfTERMpVPAmKG+/9ABcXgl0hcIOxYpYo9IN3jecE1NWcxAKEbS0sE95kafpJ493ISikN23EGr4hpNgqAlwaj/REHH0nMyRN7TAOvighTn3dl;3:Sqs7n18bPFI5/6J6drCuhCL728P3APBWOUl9t8TVzj0zBOZmst64W58SV/fASI63tCpzWwApzVatpG09UMZOjn7V8+rkfkBfuvAcsuJeiySZbxa84b4up8LpvqK7liYz36e19WYdq20FDacreYMWJU2eOsQv4stCtVk2z8G5VqPt+4fD+VOcCkbprLzmERRB9oYfwwP/E7fW6P/SD5mSR7wH6iBIBKhC1WVlC+s5WcQ=;25:2CAwRNph867ztxWQccEoIqLUZCO2/lPnqjp4B9vu6fOYuzubexNlrtwsmFnXSDMRqY/2l/PKbmBI5xstd8/nwynHe5jGwlq/JGTEeX+R/Lm8dkZeAAIl2Y/XCdcT3ro9IdJianYVCEy/PVYXuNxjw0zpqbid98zpVR5vnQumArnPO0l/E2fkLa/VCi2NC3inxsB8JKTu+2araYvHN/eu6IoItGGGpkJ0CImTjVWsT0yZ48Is5At7CYYwBPmq2cBAZC9mLtQQ1oz6Fo8rXl/fnrV1GwikassXCqkKHiB8SBzSkoojoSM4bvRmbWDtrHAGY9665RV5SWXXKDNwHm9eTIm5TINzvsQljeKpXoyFUZk= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1684; X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1684;20:XkTnobv4cIurLxH6jS/CJjROybybWRFP9ky9LKahWDjl6XxPjurHNTaM9eMbRBRGe3qXs0BjaM0JSLcqVWvfDqrjv26Y+IHd7wj1VsPTBbX1E7dYra7RU8SXWaD0yHL1p8kddNJZP1HrmxpghfCugNP+llfHTatNXlZWgqXd48bygFwjg4l9cN5VMR1vlWUn7dNcL1xk2TB6ebzqWNrNs+Jxt7tMKtWXixrmnYipjCduf8IdMcehW5YSCYW3R65nMtliLOq8YYj4izhI/MT+BmvU1E142REgBDm1orA08Q/g3cka481hXxdddKXv2Z9MLA4pfhD956W5ubRVREjyXxq6Uhb8vlzJJeAk+HdntRG18Tbj851T6pRddBxa/VqXJmPhWZPA2GrIvkuRda5rERhWaRKqlGkwfuoryOBYzlY8JwHsCaMDQxtChNlezqBroPLvBqVL50xwbfBJBvDvQ9Le0cg8NQNzvAgeqJcyPQIgLMP4vpPDDLAvA0lBx5dl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13018025)(13023025)(13024025)(5005006)(13017025)(13015025)(8121501046)(10201501046)(3002001);SRVR:AM4PR05MB1684;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1684; X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1684;4:zPbCU7NwsTgaI1dGDBryIuDm5X1GEqOqdo1uKWvDC5L5N4k4IptQfVBoQAxcTWWSxLPZnO2RZ0pcEUj/Gh4nToxYpYEtCjXTHS2VAua/QEY81WasUcrWak4LPCbHC6x47kiA42xQ5JXU48TmukA6Z13UiuslIHNou+nTRvgkIgkPoOGQMtL/YJqpA0jks4s1GBL2o+631JvzhvOjeS+4HaWNgug4d4WUpwUxCgSMmkeDAU2g44HgFSNpnreVeP1jBCbNq1C3vCoxaow/dSnKg0t9j8viK6lkkAzZ23lNYT7+/HbOiQuSKL0Nhq61+EH+zrOidUozyuJ7hxaYzPKevMO7wqdUQvJLiHHu82IsQqP6iLxdXL4+us8HDADs17r9Ewq6zOoDRPjmLcpiwCClSicmLpddSNnaHQpLPHkXwZPSIryI8mtjHWxHgERP1GnHioQ1EL5P0sv90Ijy7oOGOQ== X-Forefront-PRVS: 0903DD1D85 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM4PR05MB1684;23:R4N7DD8VfYfPK6wzVyLRfKobF3t8fu43+68cxrzzv?= =?us-ascii?Q?cB4hcynif2AGr69dWlgvvkmOOz9AIGAHBdb0CUKg7kKqqluyVgwveRWD3H+I?= =?us-ascii?Q?NkrVi9F9IbIShoXp6jyqh8q7ulyptpLLVUzjWjqxA/7UWEBGVMho71A6EKVt?= =?us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iW0t++urGsG3H1RP?= =?us-ascii?Q?ohCEig/qGfqbW8OwNuYHfZ7GENGV8RnxfFq6JcBKoLPZArZ8fV+YRatmBJUh?= =?us-ascii?Q?egCMtfUy8fDiznDJG92p6jnp78Xg8orhUGb6G6rt0kWQsCKOMAQdw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1684;5:z9wFHf+XtLaUukCvqgp0L0/NiA4xGV0yJC0K+kzDwBVvdnuZou8roUdyq0h5G+hV/qOPNMDZEvFml2QpLTGQEQxlqzcmoJxGVawuixu2UQ6Wgq2MQmS9kZ71EwweqpXOQ2NJjqxr1PbW4APR0rTydg==;24:AOyaCGbF6Eove9GbGHmBx54ip/6qYngjUXD3bYj2M86KYAF7zHHyoP9tNaplE3jiknNL4rfZPIWqkkCEUxHsTPcm+f9w+Olma7ROp7kbfOo= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 17:39:24.0211 (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: AM4PR05MB1684 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2519 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 5152b3898155..f2bcad21ecd3 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -306,6 +306,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.7.2