Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751953AbdHAIRA (ORCPT ); Tue, 1 Aug 2017 04:17:00 -0400 Received: from mail-he1eur01on0133.outbound.protection.outlook.com ([104.47.0.133]:61801 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751672AbdHAIQw (ORCPT ); Tue, 1 Aug 2017 04:16:52 -0400 X-HPESVCS-Source-Ip: 10.151.72.59 Subject: Re: [PATCH] timers: Fix overflow in get_next_timer_interrupt To: Matija Glavinic Pecotic , , , , , , References: From: Alexander Sverdlin Message-ID: <66d27e1f-5b57-aa75-bf46-91f0427b45be@nokia.com> Date: Tue, 1 Aug 2017 10:16:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.241;IPV:CAL;SCL:-1;CTRY:FI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(39850400002)(39840400002)(39860400002)(39450400003)(39410400002)(39400400002)(2980300002)(438002)(189002)(199003)(24454002)(81156014)(4001350100001)(6246003)(53936002)(356003)(2201001)(23676002)(626005)(6306002)(22756006)(478600001)(38730400002)(65956001)(106466001)(47776003)(33646002)(31686004)(65806001)(36756003)(50986999)(26826003)(189998001)(54356999)(31696002)(77096006)(76176999)(8936002)(64126003)(86362001)(97736004)(2950100002)(966005)(229853002)(50466002)(83506001)(81166006)(65826007)(53546010)(5660300001)(68736007)(230700001)(8676002)(2906002)(305945005);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR07MB1097;H:mailrelay.int.nokia.com;FPR:;SPF:Pass;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM5EUR03FT064;1:27wlGVpi6m5ge0g9oBYQB3zBSWg1W8gpBgTKwvlO0Zj8gkFiQiTIhpzOF6kr3J0PF4H5UABptskXUznfHILRLD2KjwSj2/i62kOhcTkfkpw70Gucv2sDH4bUPF7tdHseHWPtSCKvPw6yu5TOJJoO9zL00GWlDo0WW1sxnIsqFb0jkFMOHaj1hB65jqDIt8IlRFFAnZNbZlZqkz0Lg0lUgzWsBFk9jFJAtIJHgl9TAJ761g6SCXoyHo/9C//qqC25zcjcgKbS9zVJS6w4LIkA6jkGQFrTEebY+MNyEtDItO2BRsRVEmkNyRJ90bZP/lV+nR1r/WEaiFbFz9cSZ4CPip64G+C/+x6vspTYLID6qirbCjHMKLLy2olFt/87M8SAcsqrzptcgFNWLhXLc3d+m2xnZTQ+3tptPMD8cz+7uyb6rx1hGfzUxF1aGB8Q4iZxKRyCw8KWqn61ybRS5B2ziPpt7W1bY0Pp2cUBtdwiMWdYc2gv8M1Q25c20I7TwI54M66Cqf0i6WBX0s7L02WiI/YkEuNtVAh/pPhsvxKNJOVLG2p1oGcs1JrN8tkMiwZOVPs38D5C5zptMkzScawDkdD/KJterJiMVa1pXuHzlsf7an6koRsbQT0e+88w0XhaimTnv0esUnUnBYf7o9qcS/7hd7Z5u4zRASO9FfZxpJENGVNDHmCvr6VMDP1Ed2JmMFVcP9yR5gKuzvYFTNgwoeKloL1Y1xJ9dwSnK4j6RtPzutN4TKbC0aaiMyTGdRxpO41H17toFtmblIQlZFQFxEMf68E2aEPmVmW2AOYhLt5Ml/+kFuwxlNUg5WLukN/tPHGhNWuL1slF3GinePS+xC+tFRcsKM6ZS2bCVPqmf/sC+b++CnlJK1J12EF34S3yzEDS/kg+TCswDi4B0Ux4d0FafvJGMUdsP8ym+gOuIRo= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75a5b686-18da-40ed-41d6-08d4d8b5a801 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(8251501002)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:HE1PR07MB1097; X-Microsoft-Exchange-Diagnostics: 1;HE1PR07MB1097;3:8ojdnRxAOIR3ufqdq4Jx7J8PAILiVI9jruRbUnSbRyqspcf9HCpVxRaa4i0I62+bn2joc3g/Whg7tWWG/Aoi3rId468f0IKVf2zbCSM+ykv2PGXtVsquHvMfYm+PZ3wsuWv6w3Ivqch+kA1x0JbrgsfH+BahctXQub2tE20ND23zVrdQGARogftR+g+SEegv0fRQMWRWlYvJPRTD7zIJ/JEU3MzqrdNxPflU3hDLuH/fS4KuOlEzamyEEfGD8U0p1HO+KvGIlQ2ywlUOHUQ8mLevD+4fGmf7HS7b+ocZtNdfzgL/cSlG02Vy7KYmeP53miHArv8cKbh5Gkt0MxKapnTbgzGRyyFBFGAmogfc9F8=;25:2bPTCUyMFo/Ze9L6R/0OPnoF0nMekGYXhUeu1tbAsnYxKfySranAiiErfhVRt/C1uGbnaxkBg5HujmiAgaCu4flwybDqnraGbBZ0Np9G7RhGrVUDKsJLMf/oFwQTSNf4p/FzlU+C4N+tbOUUs9JDbX647FBsp5VoiMRVvtgxHX3rLk1wY0MuR2MWYrayEws5c2RrqqR/1XoNHyBMjR3hiNU2SyTa4BT0kJCpRM2y4iPWrhlxGlLBImQvbFjEUH+pt1MrkRHfu2FSPOclDFt8QcR+vMZ7NlwuK0JSFx0iLKvXkGRcggHWtZUHzfNcVwWbbuq1njozJ1MRJNPASUy0TA== X-MS-TrafficTypeDiagnostic: HE1PR07MB1097: X-Microsoft-Exchange-Diagnostics: 1;HE1PR07MB1097;31:JWZacCMjMsZdmQI0Ocw0TVWdo7zuYGvTTfVkq+p/TwTTD7NXhWOKCTr7NPGj3SSJsAcSYGb6ftkB/Fp2CAU8Bi1Vn8zLMUPw2+DJ2edenDaOIWGCqXXtE2m4XS73pw4QUjazRST3dcv48XPNZIGVSIc7LNKoRirp81Qr34gJACnDEVUMOZTorocM9XmplsaMZJnEngF5mK16LMYU+5Fltp1//sDNNzSYqpTTWmWuTI8=;20:05qAZdaTD7dFyirCl3ji91T/IDm0sfGmI034VO7kps4qAxvHKQ4m6HHmqMQ1O5Qa7totVgzteQ4SrDGK1+L0B76sITn7AtU/wMV4YKjnnoBtXeemwLB6VmS4U8/D6H1yvVlDuwfu9zm2E02NoB5DoGLxQOfPouz2B3UGK8aYrA3GzCXpAn2CGTpO3TkYyeQ4HVnYjuLIvPDeY+gYgLko+Yy7WSp3ryH9ybHHljyCiQV4GC8/n/3cZzWF9lwRhjpsnSjziyQdlki4745ErbHbNa8a8bxusyaPdiLGmXkT120ht8mWpqa8g6tnqBc62tiQpyn4Y/UEMi26cNZn425rvMQFyO3tNQ4AmeufgTu+2FTxwRylJJo/lXOMKHNfJ+f57CYtQdwqwuj6vFhFzrS+S680YGITTV0O+XMr4FC/BTu9frpGuU0L7UXbYvP8UNjcLABZ6BN86bP8Uu3K1F4GVXnv5TlHnVyJyjxR3jOahPSJEDcapzUxii/0YKRy7vZdCGfd3DQPWasXkufWTU0jHjsHIzxKq6OOumw6HMuY606VDsQ0LrvnQeSBmGot5PHW1y2ittxSmWDcmJ5XiQCnJusyvd8VvEaPmOvMGCKC/Ac= X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(13013025)(13021025)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(93006095)(93004095)(10201501046)(6055026)(6041248)(20161123558100)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR07MB1097;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR07MB1097; X-Microsoft-Exchange-Diagnostics: 1;HE1PR07MB1097;4:oBOhuzyjHFD3gLo+wJUDciGEzIYSXRKKKymurCIzUkf94tXqt92uUIjweq6xL1ADinIBfgb4Wyv6blePBFAKSwdzWZnowPAHT0BuJ9YGV2eBcyWL+uYdRRZM60tFSVeLubNgY830cdGkXvaO3jSyuAa6zvydz7E7BkQ/tF85N+qCCMQoU0pQNrLmCbnZpECoMyqW7bha8nvYaRnyKyhQ4he4HMU/bqwd6fRvVao51DFICNnOsAUcUzvV+dRtBW6oRAmiV8Bu06BA89+XcljFsu1Xfz2Be5kOWXO8Ao8KQHs= X-Forefront-PRVS: 0386B406AA X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA3TUIxMDk3OzIzOll3SUdPTVZGY1J6ekwxWmY2aDdjSTBORTI1?= =?utf-8?B?d2orMEFrNmozSTc2OHhNZEpsYWROM21MbmNLYWVsT3hYbXFBQXlVV3pUZWdu?= =?utf-8?B?bVhROU92emdqM0VnV2RzRzV1b0pVWTVUSlczZEM4cXVEekIxWThIZUZBT3V0?= =?utf-8?B?YzBkT09tenYvWXFFUGVHbklWZ2FFZVI0a2Z0SE9IcUZqcndOV1BUZWYydXhr?= =?utf-8?B?N2tONW8vOW5wRk1Sak9UTEZObG1PUTd0eGRTKzJ0MW1ZQ0VaMyt5dEZ0RG1B?= =?utf-8?B?REx5OHJnWWwvdm85L2krYUVaRmlVR2VDRjduWTVJbTRPU1N2elRkbDlVNGdS?= =?utf-8?B?VWF0K2l5c2tQTU5yNnpvUWtoeVJpeXY4Z0NJb3RVRjloUWtVQXJSNnJpL2x1?= =?utf-8?B?MFJzUFp5UGsrb0o3RTJkaEswME5yS2E1aDZ6Q1haU0RrQ2diaGJqOUl1QXVR?= =?utf-8?B?eTcyak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4kd8vB3C36BnS5SE8Ol7jO0Wx64uI1RRztMHHwQ==;24:tvSANCdd3WSi5mHaphTvJNe1pOTHkmd5uElqSOu0ZgfHq8ypB6AHPHFM3klVbklFwFSeiRiw8X+6VNqYf/79SAC9guOAOI5NQuCCUH7CKMM=;7:uiDKN402i8DZ4Z+23vykjWCwxAj+3jNVXskRIm28OCHCw8NIzXkQiGNcGqu/TnVaqd5wuhPSZy49psBD9OIpPmkzzHBNdLUTBN0BuKaiijMxmXUH3+toJv76C3uoimgMkZ4x1Qb3fQFWVMTOeOGG1bGRJ5VLDPl8wT756NvNfOUFXn7oA+FrozGJZFbF9zns8/PWjRix9ldVW3ILEmF/RtEPZUJHHRKMHhZ7EysK1Kk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2017 08:16:48.2917 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0;Ip=[131.228.2.241];Helo=[mailrelay.int.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB1097 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1205 Lines: 35 On 01/08/17 09:11, Matija Glavinic Pecotic wrote: > For e.g. HZ=100, timer being 430 jiffies in the future, and 32 bit > unsigned int, there is an overflow on unsigned int right-hand side > of the expression which results with wrong values being returned. > > Problem was observed on tickless core and with following applied: > > sched/nohz: add debugfs control over sched_tick_max_deferment > https://lkml.org/lkml/2013/9/16/499 > > Signed-off-by: Matija Glavinic Pecotic Reviewed-by: Alexander Sverdlin > --- > kernel/time/timer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/time/timer.c b/kernel/time/timer.c > index 71ce3f4..8f5d1bf 100644 > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c > @@ -1495,7 +1495,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) > base->is_idle = false; > } else { > if (!is_max_delta) > - expires = basem + (nextevt - basej) * TICK_NSEC; > + expires = basem + (u64)(nextevt - basej) * TICK_NSEC; > /* > * If we expect to sleep more than a tick, mark the base idle: > */ -- Best regards, Alexander Sverdlin.