Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934426AbeAHPvq (ORCPT + 1 other); Mon, 8 Jan 2018 10:51:46 -0500 Received: from mail-cys01nam02on0054.outbound.protection.outlook.com ([104.47.37.54]:13455 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933858AbeAHPvl (ORCPT ); Mon, 8 Jan 2018 10:51:41 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=fail action=none header.from=nxp.com; Message-ID: <1515426694.3207.28.camel@nxp.com> Subject: Re: [BUG] schedutil governor produces regular max freq spikes because of lockup detector watchdog threads From: Leonard Crestez To: Patrick Bellasi , Viresh Kumar , "Rafael J. Wysocki" CC: Linux PM , Anson Huang , "linux-kernel@vger.kernel.org" , Juri Lelli , "Peter Zijlstra" , Date: Mon, 8 Jan 2018 17:51:34 +0200 In-Reply-To: <20180108151450.GA30937@e110439-lin> References: <1515184652.6892.26.camel@nxp.com> <20180108040121.GB4003@vireshk-i7> <1515417622.3207.5.camel@nxp.com> <20180108151450.GA30937@e110439-lin> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131599002699692546;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(346002)(39380400002)(39860400002)(396003)(2980300002)(1109001)(1110001)(339900001)(377424004)(24454002)(189003)(199004)(104016004)(53936002)(6306002)(8936002)(68736007)(93886005)(103116003)(50226002)(305945005)(356003)(4326008)(6246003)(956003)(106466001)(76176011)(2906002)(2950100002)(5660300001)(966005)(23676004)(2870700001)(105606002)(229853002)(498600001)(59450400001)(53546011)(36756003)(50466002)(5820100001)(110136005)(47776003)(81156014)(8676002)(316002)(54906003)(81166006)(86362001)(85426001)(8656006)(97736004)(99106002)(42866002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR03MB2696;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11OLC002;1:fc8wBglb+vOuvN6yJQ6LCwcIMbaGMnfEdIKnb4LN1keD4NjWSTLXzGmF3aXrTmDxDMW1i2IMdwf5Rkq4YduU48v55tOEjSf8WvsqrNxRU2lZ2VM8LBONqt8X1UUxueO7 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c05dbc0e-81e0-42e6-fa02-08d556afa32c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307);SRVR:CY4PR03MB2696; X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2696;3:s06Y7r4mI4aOeUZU3XzwKFLbeqSXTbb4qNEhAPmIBjgjMNkBP/xqeMaS+qPTe+5DmXh9jw9MNfninTW4qOMYosyqz1pYVMRZ/mXL+mY536sHrHKFXwRIVZVE1c26b9BTjCwn0jDIF0q/24WeP1YWuZ9UU1yQWgpbgjz0MPqKI0UnkZBRNjSDJqdpPIxlYv3F1p4V+YJSpNjEytxS0JcrbFOIJNRscF4fXhmGNOJHWZatBTbw6yW4rkRczzheGMTOxMM9F3fP/xEiwT4ZglZbd3Nr81czbxYlTwys1y21Et/H4fJimnxxWIC39LS83U4UlxQENp0ihr+xg+MLxyzl+vdEnc+GBlsnkJ95ef+LdsA=;25:oFtYX7WzScoBCXaSZNF8tUak5smrZ9cJPKKz9flakeih5LrPd7cnfvT/iolS4ib38eluOplhXWOtcgzsj7VZFxIHAt7OeeqrqO8zEradRfJXL/XUvCSG1JbDJUZKNAoVBSRgLq5gDLznLRTYmAycEO6SsgH77jHffrV4egVCPP0JQs0WBgH10JBhwa+thfqorP2ja87Y9TjfXV18xAvg0sqkO01rTNqo4dk5jF3bQO7LSxLkjkN4reTYOFA+qO0Z897hX8B1zOzo7k3jiIb6x/CVnV9C9w0Ghvc+t/DcB82SFp6pspCqvQPYVi5b2EajuWtiRlRAzswJs9/4CmqiUg== X-MS-TrafficTypeDiagnostic: CY4PR03MB2696: X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2696;31:dS9IS1y41PKOnqUPIQzvii/hB6LnahWbPhEfPSs6OCxm8ohvlFnqCJxCaexcCiT7f+nyHwzf4j0uK/jpwG0kakniIWhTjPmgBiJ881IeQXtzGvlYInOC3rwX04Rl5stEWuoCRVk4CA3P9Hok6yPNHwY1tlEQB+y3ufYOlgGnro7072deykPYq/wyk26/m+ucVvViC7F2cQu8k9TXlqgUtV05QTkC91svHxO0WtAcn04=;4:F4JsbTicYxfEyOURua7tqDdAIVVpulzIexTvKywYgKIvtSarr0al8yeAK9D/iotfEPaI5nQ8Htr+ra31hTtzBZd5EyUiQKhp0tGbTZDTkmGLmpHSO9wIZ3c9ywqziaTjB1+e7UvAxC7lVZKa1Hj3EB/p7HATOFYrZv6pOS3Kjmta/2ir9MLzRxZM1GCwyoNy6cdL6DAtwBhLXH9iVGo9Zk0RRT6dI4GF9AkfB1eL0H/wqz+gmOJon5T/s5fFkTygSwIRXlirfu6KwqqlbUqLNOm92OJp0A48tO6sSHlFyA1JWIhl/LVsAQ476bp1P9SgA/3LdIP6m3bu47m+P2q9zBuy/0SeZO4zCspodSTKJGs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(84791874153150); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(6055026)(6096035)(20161123556025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(20161123561025)(20161123565025)(20161123559100)(201708071742011);SRVR:CY4PR03MB2696;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:CY4PR03MB2696; X-Forefront-PRVS: 054642504A X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjAzTUIyNjk2OzIzOi9jVE1YYUt3dzFYaFpkZ0Nna1dNa0NWSjVo?= =?utf-8?B?YWZqVit1bERlZGpCeHpoYU8yTmNkU2pqUk5NbCs2WTVIZ3NRd1RTd3FpeERx?= =?utf-8?B?Ny9zbUJTazdjbDBJNkw1eE5USWdCMUJ0TDRSNDhOV1ZTRXJIbGVsOFZJMlQ4?= =?utf-8?B?dUFSZWlnNkV0cE9IV1BZcnZ0eHRCY29qRHVLSUFBRTdocFlucGNOVTJ4Mkwz?= =?utf-8?B?U09hZ3dzNDd0bkpJZEg0dkVnblR6Z3BFR2ZiZ20zYXlPVEs1VDlnbytDbXVN?= =?utf-8?B?TUhZWi9rU3BWRkJpRFR2NFV5dUFNZlNOQU1jUGQvNTNrNmJVcWdESjUzZUNw?= =?utf-8?B?RE5OWmFzTkRwQ0pFQ0QxSmRkZEhEa2FtNmNsS0p1WE1QcU5LMSt2bFJ6NGZo?= =?utf-8?B?MjBvOGF3QnpoWm5NeEVXQkxKaSsrWS90cjZUY2xhemwvK2dodzYzSk56Vi9F?= =?utf-8?B?YVRLNERjQlpxTTNNdW85dk0xZFVXVVZ2Yi9zOFU1aEhyVFZWTk5ieEF4bElu?= =?utf-8?B?cGpycVpyQk1XanIxdnpnSy9uTUpKTnUrUzQ0WUNMTWhlL0RJRmtvYVJGSFYr?= =?utf-8?B?Sk8yVVdIcUtjMExDck1Qc3FaRVZWdk4ybGdjZzBFYklQTkVUNnErVDdLaS9l?= =?utf-8?B?bEl6MmoyT2pIV0M0OTNQU2ZTZnhVMVVxemY3bkJFZVRCVWFTNGdtUjdzMmp4?= =?utf-8?B?aFkwOTkwcmp3WlhDNzhrZVhMVDhybi8v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RZJEd+5ZPVFhlG6WiIINNdmZ/ErpJuSYC3hC6HahKWw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2018 15:51:09.2360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c05dbc0e-81e0-42e6-fa02-08d556afa32c X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2696 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, 2018-01-08 at 15:14 +0000, Patrick Bellasi wrote: > On 08-Jan 15:20, Leonard Crestez wrote: > > On Mon, 2018-01-08 at 09:31 +0530, Viresh Kumar wrote: > > > On 05-01-18, 23:18, Rafael J. Wysocki wrote: > > > > On Fri, Jan 5, 2018 at 9:37 PM, Leonard Crestez wrote: > > > > > > > > > > When using the schedutil governor together with the softlockup detector > > > > > all CPUs go to their maximum frequency on a regular basis. This seems > > > > > to be because the watchdog creates a RT thread on each CPU and this > > > > > causes regular kicks with: > > > > > > > > > >     cpufreq_update_this_cpu(rq, SCHED_CPUFREQ_RT); > > > > > > > > > > The schedutil governor responds to this by immediately setting the > > > > > maximum cpu frequency, this is very undesirable. > > > > > > > > > > The issue can be fixed by this patch from android: > > > > > > > > > > The patch stalled in a long discussion about how it's difficult for > > > > > cpufreq to deal with RT and how some RT users might just disable > > > > > cpufreq. It is indeed hard but if the system experiences regular power > > > > > kicks from a common debug feature they will end up disabling schedutil > > > > > instead. > > > > Patrick has a series of patches dealing with this problem area AFAICS, > > > > but we are currently integrating material from Juri related to > > > > deadline tasks. > > > > > > I am not sure if Patrick's patches would solve this problem at all as > > > we still go to max for RT and the RT task is created from the > > > softlockup detector somehow. > > I assume you're talking about the series starting with > > "[PATCH v3 0/6] cpufreq: schedutil: fixes for flags updates" > > > > I checked and they have no effect on this particular issue (not > > surprising). > Yeah, that series was addressing the same issue but for one specific > RT thread: the one used by schedutil to change the frequency. > For all other RT threads the intended behavior was still to got > to max... moreover those patches has been superseded by a different > solution which has been recently proposed by Peter: > >    20171220155625.lopjlsbvss3qgb4d@hirez.programming.kicks-ass.net > > As Viresh and Rafael suggested, we should eventually consider a > different scheduling class and/or execution context for the watchdog. > Maybe a generalization of Juri's proposed SCHED_FLAG_SUGOV flag for > DL tasks can be useful: > >    20171204102325.5110-4-juri.lelli@redhat.com > > Although that solution is already considered "gross" and thus perhaps > it does not make sense to keep adding special DL tasks. > > Another possible alternative to "tag an RT task" as being special, is > to use an API similar to the one proposed by the util_clamp RFC: > >    20170824180857.32103-1-patrick.bellasi@arm.com > > which would allow to define what's the maximum utilization which can > be required by a properly configured RT task. Marking the watchdog as somehow "not important for performance" would probably work, I guess it will take a while to get a stable solution. BTW, in the current version it seems the kick happens *after* the RT task executes. It seems very likely that cpufreq will go back down before a RT executes again, so how does it help? Unless most of the workload is RT. But even in that case aren't you better off with regular scaling since schedutil will notice utilization is high anyway? Scaling freq up first would make more sense except such operations can have very high latencies anyway. Viresh suggested earlier to move watchdog to DL but apparently per-cpu threads are not supported. sched_setattr fails on this check: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree /kernel/sched/core.c#n4167 -- Regards, Leonard