From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbbEYDAi (ORCPT ); Sun, 24 May 2015 23:00:38 -0400 Received: from mail-bn1on0136.outbound.protection.outlook.com ([157.56.110.136]:54048 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750862AbbEYDAg (ORCPT ); Sun, 24 May 2015 23:00:36 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; amacapital.net; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NOVXOP-07-SI9-02 X-M-MSG: Date: Mon, 25 May 2015 10:42:14 +0800 From: Huang Rui To: Ingo Molnar CC: Borislav Petkov , Len Brown , "Rafael J. Wysocki" , Thomas Gleixner , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Fengguang Wu , "Aaron Lu" , "Li, Tony" , Andy Lutomirski Subject: Re: [RFC PATCH 2/4] x86, mwaitt: introduce mwaitx idle with a configurable timer Message-ID: <20150525024214.GA24823@hr-slim.amd.com> References: <1432022472-2224-1-git-send-email-ray.huang@amd.com> <1432022472-2224-3-git-send-email-ray.huang@amd.com> <20150519113121.GD4819@pd.tnic> <20150520085520.GA8566@gmail.com> <20150520091213.GA3645@pd.tnic> <20150520102258.GA21245@gmail.com> <20150520105032.GD3645@pd.tnic> <20150520111120.GA25215@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150520111120.GA25215@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC008;1:Cekb86G33hmbefoe5XUtI6mxJot8yfUKzAtx6qk783aFo2QjHCGrPA/Mg3NJaiHtxMUQCHCBJxAa0WD9KrFT0XUiCrwdLiFz3Cu2DAV9b1hnNTIWEO3N6SHXYxf3BSCXruXn24fNJ7WmxyQHke4DYds2Of2Mz1GzfKzjLN53yJ4az0GyvJwQEYDG9HoTRxM/N0ZeSE/4zDaRcbgGO3eeigRxTNH6YNwSXx6BPc5dy5EQ0on2owwLO/Sq68nnmlY1Z5iiYqZOJdMhEc8OyOLz+KxvNR3HBQNkQgDPTzdcRqUw9luQ4v5zRbt7Z7zpBMDz5bsCCd/RMNVoHKyw50kJ2w== X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(51704005)(164054003)(199003)(24454002)(189002)(4001540100001)(77156002)(19580405001)(97736004)(83506001)(97756001)(54356999)(64706001)(101416001)(47776003)(4001350100001)(76176999)(50986999)(93886004)(77096005)(23726002)(50466002)(46406003)(110136002)(19580395003)(5001920100001)(106466001)(2950100001)(105586002)(68736005)(86362001)(62966003)(46102003)(92566002)(5001860100001)(189998001)(33656002)(53416004)(87936001)(5001830100001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR02MB069;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB069; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520002)(3002001);SRVR:BN1PR02MB069;BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB069; X-Forefront-PRVS: 058707456E X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2015 03:00:27.1059 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR02MB069 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2015 at 07:11:20PM +0800, Ingo Molnar wrote: > > * Borislav Petkov wrote: > > > On Wed, May 20, 2015 at 12:22:58PM +0200, Ingo Molnar wrote: > > > > > Well, HLT does not get any hint from the OS how long the idling is > > > expected to last. > > > > MWAIT on AMD doesn't either: > > Yeah, MWAIT clearly doesn't, but I was talking about MWAITX, which > takes a timeout parameter as per these patches. > > > > Another MWAITX round - we've got no crystal ball, so the hint > > > might be wrong if an external event occurs that we did not > > > anticipate. > > > > So if we end up doing a bunch of MWAITX rounds instead of HLT and > > MWAITX saves less power than HLT, then we practically are worse. > > So the way I think it would work ideally is (and note that this is > different from how you think it works): > > - MWAITX takes a 'timeout' parameter, but otherwise behaves exactly > like MWAIT: i.e. once idle it won't exit idle on its own > > - based on the 'timeout' hint, MWAITX can internally optimize how > deep sleep it enters. If the timeout is large it goes deep, if > it's small, it goes shallow. This does not change the fact that no > matter which state it enters, it will come back the moment an > interrupt is posted. No, the timeout value doesn't decide how 'deep' the power state enters. Basically, the same power consumption with any timeout. I summarized the comparison of mwait and mwaitx MWAIT MWAITX opcode 0f 01 c9 | 0f 01 fb ECX[0] value of RFLAGS.IF seen by instruction ECX[1] unused/#GP if set | enable timer if set ECX[31:2] unused/#GP if set EAX unused EBX[31:0] unused | max wait time (loops) MONITOR MONITORX opcode 0f 01 c8 | 0f 01 fa EAX (logical) address to monitor ECX #GP if not zero Thanks, Rui