Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757525AbcCURob (ORCPT ); Mon, 21 Mar 2016 13:44:31 -0400 Received: from mail-am1on0073.outbound.protection.outlook.com ([157.56.112.73]:35872 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756863AbcCURo3 (ORCPT ); Mon, 21 Mar 2016 13:44:29 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=mellanox.com; Subject: Re: [PATCH v2 4/4] nmi_backtrace: generate one-line reports for idle cpus To: Peter Zijlstra References: <1458147733-29338-1-git-send-email-cmetcalf@mellanox.com> <1458147733-29338-5-git-send-email-cmetcalf@mellanox.com> <20160321154201.GA6344@twins.programming.kicks-ass.net> <56F01E10.6030909@mellanox.com> <20160321163215.GC6344@twins.programming.kicks-ass.net> CC: Russell King , Thomas Gleixner , Aaron Tomlin , Ingo Molnar , Andrew Morton , Daniel Thompson , , , , From: Chris Metcalf Message-ID: <56F02B87.2000307@mellanox.com> Date: Mon, 21 Mar 2016 13:12:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160321163215.GC6344@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: CY1PR1201CA0014.namprd12.prod.outlook.com (25.169.17.152) To HE1PR05MB1692.eurprd05.prod.outlook.com (25.169.119.158) X-MS-Office365-Filtering-Correlation-Id: 5c484ab1-c9a8-4c4a-4342-08d351ac0d54 X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1692;2:9d2P8AFc2LAvWsG8ANfrLPI/MItWXH4+lIJ3acvSGwiRKxv38JKRHdtEuBjEcKGmIHxpf3Jv/DkW6edjEtKIWrSVz9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HI/34YQieZTFsN2/Gy7m6EL1DMKpqKEYpCH59wbwagi5hmkg9aF5Ra0x4tSuoMaFd3KLpGn+7yXGCMjppwAcuU3LgpflXRGBzlIdTU1Tti2kVfGcCkIVscHc3qLIvQuxGsEnH5cXp27sW7xfKBJMR2+tpviyOJWPU4AkWB+ktdjA4suXCKgX6EqZDvCCaSvqLHiP38kTQTB2fYe0QozEBnB97f5IXbWoq9dTTtFAL7yFA86nIje7kHBOryh66COSMLXA0RbMfQENTbkKP92JyolGIBgYjNDByuHrl/xnvi/l45VJzKVqjDtKw0wWvOS+pA972sKrL/xt3QXbDlzU8rgF+JAUq4WHxvAiEKLHMAz2wm2cCZ4Sk2iG8IGJe;4:DOvJIa63XEg7NW/OC19uiW8cRtS/UVePA39eYVzLTZPK1xdXwfmXHuw9jYs5dcqi/UVMY6wIbuiyzIuFje3vjEnSy0tbg+y6D3QpOCLI4C1T7vEc5VHwYlNpqmyCjiyt4a2fCKJcAxqBtirXWW7xiN0C0zRgxDEdKzhZOUgnBlQgIR6+vvzkJc/fJzuSkVl6hYaj6BpKrd9CANtbenqEhiaDN/HyzugWM+RO1wAYGT1LO4e2AnaOl5BDDWmjXuS2goqOOeX7grIpe6og6ylbmF1H86oIlcf+CPPe7sz00RL0m53Vv+mxdDjsaFvj2JZAO3ih1p2IbIt5ga9eBXvd5kNgSPinTseGZSmvCkikZ7d0RUVHK9ZsiLty8d6c5XtF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:HE1PR05MB1692;BCL:0;PCL:0;RULEID:;SRVR:HE1PR05MB1692; X-Forefront-PRVS: 0888B1D284 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(24454002)(377454003)(54356999)(76176999)(87266999)(50986999)(36756003)(50466002)(86362001)(83506001)(64126003)(42186005)(33656002)(65816999)(81166005)(4001350100001)(93886004)(2906002)(4326007)(189998001)(586003)(230700001)(1096002)(3846002)(110136002)(6116002)(5004730100002)(5008740100001)(15975445007)(77096005)(2950100001)(92566002)(59896002)(19580395003)(47776003)(65806001)(65956001)(66066001)(80316001)(23746002)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR05MB1692;H:[10.15.7.41];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;HE1PR05MB1692;23:LQxE8WQ4SJkRAb/GS1cQII2AGHOfd9ibAv5IN?= =?Windows-1252?Q?z2rArKB1sWGn97TRSAkqKtrsDYzGoWZiVgUjomn+V+a+0UVfrDTTvlOu?= =?Windows-1252?Q?9rFAEJYmYRm05JeNgrv01/Fz47KbnDu2l/3Q7ovKp9IBOja356TgC3u2?= =?Windows-1252?Q?+5Gb5H/29mTU87I4CnnCtqrfmOO3xtbV+VatFqqN6e7JfBQ7dJVKNA21?= =?Windows-1252?Q?L/V04lq6RCcO9X/5FZJ1YRUD4rWmJChWDHHlRi+zIxVLuDZwaFqoqL0K?= =?Windows-1252?Q?NYYql1Nt+fpgweZUzkxOvvdQuqt96nu2KqcqJXjtPFrfPhPZSK+XNkvm?= =?Windows-1252?Q?wB0ysjRoagaGRvzHnYJrKDTW9C6J+VBU99IJ+jivE7p864VIeQbEVp8T?= =?Windows-1252?Q?tzxF/xE9zxt1jNK9wtfeqQcM6JrG0SYuinGLOdim+AOHDVhCEwNFc2kX?= =?Windows-1252?Q?vGxclZ0uowG86SfxfEFy3i9rR8jMf020Q+8EOHrRSRbwhlDWXqxY9G30?= =?Windows-1252?Q?ioJRXG65H6ftui6Goe4XzvHdOR6udF+T2lJ+1HyTP4eSf/XfUI4kHuU4?= =?Windows-1252?Q?RpW0+2T5N/YNrAm5ttL+FNBzI1R4Ic9f9rkt8AUP3pInXRxUTYhaXuPP?= =?Windows-1252?Q?+o4EtMP7JMOalY0M2mrV1VC1173BbAi3WsNdsN6C3WLlPWA54F+E9NMa?= =?Windows-1252?Q?D7dxTniL/7t0954AN1ya04qqsR4IAw21h/kPlUgeoZDjY2kppYkrIyq9?= =?Windows-1252?Q?i7S5eJZXg9Dydd1FkTPXRGfTHb4bIPs5P/i8n7TSDRH92LwIbowhi1Rt?= =?Windows-1252?Q?mXeNmt4LxZVoGaEFlP5Fcx3JdlzKlS5cZZ9uUhC+qbX/EirknVkhGtCg?= =?Windows-1252?Q?VoYV2WUkHiq5cKvtgZKKd5BGWUJjLwX3zSW3JnNHEa/RxYtxUT/IXoz/?= =?Windows-1252?Q?y4Fe/Q0kG2JwqSVUWvrNqN0kxTcHItPXETIctuHNNXM+3mrMl34GbAxi?= =?Windows-1252?Q?FrBXP9iZAO9dJ0YpQK+L9INBBwIoaNHvds+Vr/OOZ8Y/HjhNbkaGC0z9?= =?Windows-1252?Q?cBmsLBvJiQPzP6owoM3C4soMjX67sh7N9ManOOUuwA+tRo05f3Hs179M?= =?Windows-1252?Q?OfRSc+CR2YelvPBWXGj6qmd/qXeBzCkqAAoe0m28TkfDXOXYWibki4D/?= =?Windows-1252?Q?Wadb1CDutUo23oIvOCguJS7kpl1CK2zZPoMmItlNpD3ADfeU3fo9Qh9P?= =?Windows-1252?Q?sqnVLbAfWTWQ80wpQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1692;5:jb+kjvAe2lGBiehoVEPpxkDbcAfAtawqEpohIhDIaSazYWtQS/GvAcuL3psQm98lTUpqVQHhrHAIKVv7v4gnV6jguFkMRiJLsBYvZu7oN3jZV/vSYm38ll+AExY31d04XnEBUOj2KPLaacvPNOsRow==;24:flaDq9bCaqgoiaH0l/R0shYd+oNEA/QVaP1VCB/lxL7m9yPcnP4OLjvqaMR+e9V50ojauMW45giO/wWZb/Mk9qVGP/njFW9YOb6nSy/INRc= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2016 17:12:55.8909 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1692 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2500 Lines: 57 On 03/21/2016 12:32 PM, Peter Zijlstra wrote: > On Mon, Mar 21, 2016 at 12:15:12PM -0400, Chris Metcalf wrote: >> On 03/21/2016 11:42 AM, Peter Zijlstra wrote: >>> The most common idle function for x86 is: mwait_idle_with_hints(), >>> trouble is, its an inline, so I'm not sure adding __cpuidle to it does >>> anything. >> No, you're right, it wouldn't help. I didn't look at the drivers/cpuidle >> subsystem at all in my patch, since I'm not that familiar with it, >> but it seems like tagging acpi_processor_ffh_cstate_enter(), as the >> only user of mwait_idle_with_hints(), will do the job. > intel_idle() also uses it. Ah, of course. I was only looking at the config options enabled in the kernel I was building. I've added INTEL_IDLE now and grep'ed the whole kernel tree as well, finding a couple of extra possibilities: I do see mwait used in the ACPI 4.0 Processor Aggregator Device driver, but this seems sufficiently far removed from regular cpuidle that I don't think it's appropriate to tag the power_saving_thread() function - the initial commit talks about using the mechanism "to ride-out transient electrical and thermal emergencies." There's also the thermal "powerclamp" driver that enforces a particular amount of idle time across the system. For this one it's less clear to me whether this is a valid "idle" state that we should ignore when doing NMI backtracing. This would be the clamp_thread() function in drivers/thermal/intel_powerclamp.c. For now I'm not including it, but what do you think? > # nm -n ivb-ep-build/vmlinux | awk '/__cpuidle_text_start/ {p=1} {if (p) print $0} /__cpuidle_text_end/ {p=0}' > ffffffff81b16ca8 T __cpuidle_text_start > ffffffff81b16cb0 T default_idle > ffffffff81b16e50 t mwait_idle > ffffffff81b17080 t cpu_idle_poll > ffffffff81b17280 T default_idle_call > ffffffff81b172be T __cpuidle_text_end > > So no intel_idle for me.. With the changes discussed so far in this email thread, we've gotten to: ffffffff818df178 T __cpuidle_text_start ffffffff818df180 T default_idle ffffffff818df260 t mwait_idle ffffffff818df3f0 T acpi_processor_ffh_cstate_enter ffffffff818df4a0 T default_idle_call ffffffff818df4e0 t cpu_idle_poll ffffffff818df600 t intel_idle_freeze ffffffff818df6a0 t intel_idle ffffffff818df7b5 T __cpuidle_text_end This is about 1,600 bytes (or about 450 instructions) that will cause NMI to skip doing a backtrace if the PC is anywhere in the range. -- Chris Metcalf, Mellanox Technologies http://www.mellanox.com