From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753157AbbJTUio (ORCPT ); Tue, 20 Oct 2015 16:38:44 -0400 Received: from mail-am1on0099.outbound.protection.outlook.com ([157.56.112.99]:47939 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753021AbbJTUhY (ORCPT ); Tue, 20 Oct 2015 16:37:24 -0400 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 , CC: Chris Metcalf Subject: [PATCH v8 13/14] arch/tile: turn off timer tick for oneshot_stopped state Date: Tue, 20 Oct 2015 16:36:11 -0400 Message-ID: <1445373372-6567-14-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1445373372-6567-1-git-send-email-cmetcalf@ezchip.com> References: <1445373372-6567-1-git-send-email-cmetcalf@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD011;1:T79co+McK2b0FKq4/BZcyVn/wljCh9q7QksRw4PZ/Hhj+TPSrqFU0z1v4TSMnkKyvqFqhhnf+DtBF3XjejbpyNnYW0tecC/pt2uE9DxhbbbAz7zBZpSnUZFrI27IQ/poPAUz2p8v2ecUxw773QkmUO/isHPxvFTBfWqUZYxewgLV6wh3GjS37tzf3iO2ChiT8w+n7AbBLTNc4X3xHUQxDCm4GnBZJDn5fE+WAApDFT8LNvsATO6qJ1dUf0eBZPBvOXeKnZQkg/0ZsNEtb9yVEhwulzika83MQuC4Re9sbgFuieEIQrEjHhdn7g2UPYQx6XJ0Qj2TAYHrykEbIqjdCUj8h1c2YmEt96wOICVn9qg= X-Forefront-Antispam-Report: CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(42186005)(92566002)(64706001)(5001960100002)(229853001)(106466001)(19580395003)(50986999)(106476002)(76176999)(87936001)(19580405001)(106356001)(105606002)(97736004)(81156007)(86362001)(6806005)(5001770100001)(5007970100001)(85426001)(104016004)(11100500001)(47776003)(50226001)(36756003)(50466002)(5008740100001)(48376002)(107886002)(5003940100001)(46102003)(5001920100001)(2950100001)(33646002)(189998001)(9376005)(921003)(4001430100001)(83996005)(2101003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM2PR02MB0772;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;PTR:InfoNoRecords;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;AM2PR02MB0772;2:d5kyKmGkT/YQi5nOBApwa3YCeCyxk/iN8TbD+AG6OF6Akx5RwJ1hKs3TH5meWvVxg1qRQ+woFiFevthragBILrqNH5uIrAD7ylLsgU/SLspdeqe8z/eBT8lQ9YOqevXoELwJ4ULoVa+1nTEWRfeihLhAsRYq8LYNEZs2tsGAfRM=;3:GCtzNQcVDWs2/O9APGGljf/ma85fg0KtPfrqJPF7WiCXavAVUymlhwmksbSvPSxveUZmtTjgbQo32Sq3yemJNKiUXCAtAj7B4adv2I06itoJEB1niknGHzkaRPC4afC0X6UrpUU8mxxVgjuQn5vSpJA4VXV4+wbLobIERZ4HHqUkkUa4j3KT588BUVzQboaCZ3lkAtB+4p1Ba/5tfKTKQhBYgVm6QVk6mit9DOwfqA7CfcXkTGfobVz9uTGgiRal;25:z+FUJ8/FBrrEh+FKP231AO7+xCRfXpU39CoUZXt8+pnn9ZGXtBRoK8ldF+Cukkp6fOrqsP5kQzw7/6uRnstTbg4akIczg3ntUO0KYRKukDXUr4NbCMLKcgAcUzEVdN9dplyPNKDAJwosnS66aqhKWn1YYaVF38uLFZgcIseGssyJF6exc9ZS3RhQHHsv03mN9nAwuqbW4tXUsDhT2JqgtTRV999McNNdeiWPjjVYbnxucPybftvxoRntOQW31886O6zmdyMudV4XEjJKPe0TuQ==;20:N/ODBIe1rAPcnlPoqSQESj/yt2yEBGPDgana6ID2WAD9ddzE/IFFetC2M0pe5hv7tu7gxeVPEaEluYd9p6m40LdFUegCFBGq1uFDoO6uYpdZq8OmcJfEnl0zH7ec1/PrgkBCyi191rOaqGfkO7evbUh9o66XMLqprE6A4amNj74= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0772; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001);SRVR:AM2PR02MB0772;BCL:0;PCL:0;RULEID:;SRVR:AM2PR02MB0772; X-Microsoft-Exchange-Diagnostics: 1;AM2PR02MB0772;4:2CLElySX8m914+eqPKEzrESzqqs3wWsEq70bKghU99s9wbMi4uGeJC9xkXtdyiJPZln3JreNKUWp2ll11gcAdY1G3lk50lZYfv6s1s5WHaTMIxOeAmCOJrrYaQ3kRmt7WD2FepUBzAM+qvj7vL6DBpX5e6wt6PX8jXS27xHiMJkRhuF/OxvMeVboKERhIl9OSK/VWgZL2YawqI0d3QzSAtY5K4Wq5Yn/iuKoWjzgCuXYMk+lN7tCrekDUbz0WdBMRW2G7ntZHPw4SgQU+vZ7PACPTSKEcocyqygknaik+ZtZjPjlymu3L/PLtK1Yye/leiHDL420+dMGVkzXkPndphWN6aVIxVkIOxztOXMt40Y= X-Forefront-PRVS: 073515755F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM2PR02MB0772;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= =?us-ascii?Q?tj9fa8LzRcGxF1Xz3PCEm9yGLAi/lH02Tyf41nYXxCXepkz2jgsCdzPB98tN?= =?us-ascii?Q?jF6F2js6KNbgbiVUJRufSaOiDPN3khp0WxkiIa+rClSZspBVrZORKaLTh+O2?= =?us-ascii?Q?qe/vQv6pKUfv72QxLl+Tk8g22UM6IjXzvLrfC6HYvDbuyvQS0R1vrjag65Vt?= =?us-ascii?Q?HhknANqIpzelmI1PDMOLp9tsxZHXeA6THHnvhA8IkMclmL8tpGJ49VrO9bSQ?= =?us-ascii?Q?wzywaieuslUbfTbu5L7uuVOqF2NMMqYNxiVWeYMJKBOrWVtfprOWoHFV0w47?= =?us-ascii?Q?Y0rHi3YJ7De1b1wQCu8Jm9yi12v6ONc6wpExbqsndGTyLHNp+aBR+4MpPmPa?= =?us-ascii?Q?yQblmS/9gEC24jvU65dPEaZ2sUASI5SPPK/TtH5q4aQ/BAE2i+tbpcWxCjbB?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1;AM2PR02MB0772;5:MaacqTfY9gxz0IqUPHvTvR2q5hInLP4fxC25pfuG2PVJYHpXOnX7pdN0ZpH3e+Thsw2js1vyb744ffFmcteqO9zppBZZDNJiOVgVT0YhjwnlJdcqbP82vBzHr8RYPqpERWdy6Io6uAa035yilJvV9w==;24:qS4VtSq4x4J7vf8tHD9ikSKkchui2JHxlRxSJrNeB8PIWlkCc4JDRdafkpqyD6VHzC4SAZz2TM+d54oU4CR3vJi5C6DGHJWLnwlcYxEyhvI=;20:z57o+nQW8ccuV2L5flNTd/PfqMEYRPCi3RfSLeofx3xr9l4qnTdNBXymPComZiuFqGm6BLKX4t0ZBHxAjA2lpg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2015 20:37:19.7449 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR02MB0772 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. However, by default the internal __clockevents_switch_state() code doesn't have a "set_state_oneshot_stopped" function pointer for the tile clock_event_device, so that code returns -ENOSYS, and we end up not setting the state, and more importantly, we don't actually turn off the tile 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 for tile, 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 disastrous kernel timer interruption that could cause packets to be dropped. Signed-off-by: Chris Metcalf --- arch/tile/kernel/time.c | 1 + 1 file changed, 1 insertion(+) 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, }; -- 2.1.2