From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932246AbbFIDaQ (ORCPT ); Mon, 8 Jun 2015 23:30:16 -0400 Received: from mail-bl2on0146.outbound.protection.outlook.com ([65.55.169.146]:6543 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753647AbbFIDaI (ORCPT ); Mon, 8 Jun 2015 23:30:08 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; amacapital.net; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NPNQCA-08-6I5-02 X-M-MSG: From: Huang Rui To: Borislav Petkov , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , "Rafael J. Wysocki" , Len Brown , "John Stultz" , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Weisbecker?= CC: , , Fengguang Wu , Aaron Lu , Suravee Suthikulanit , Tony Li , Ken Xue , Huang Rui Subject: [PATCH v2 0/4] x86, mwaitt: introduce AMD mwaitt support Date: Tue, 9 Jun 2015 11:13:37 +0800 Message-ID: <1433819621-15093-1-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD022;1:/L2gJHUoiuCR/LMzdyJQbj2azMti5JXsJ75oSQvd/dAcjBiSLhyizgYfoQ3dvnLL/0+NskvIxsXD5Af2Ya2Nf57WRlaQc/f95WYOUZna1RZlrlgTiRW2NVxUT4GjZYBLN4w0Rbj2QeIUaT1XcuR8axPHYOcp7JgDeknC+mXzNK8HKx5D3E86cAtrREPyXwb6/uumxh6YC6AnlcHX0RJfdSdSiUaKu0usJbE8sCl1a2wuqxcrsg+jgCpIzWD6/zlALy28h7vBxMRrZad+N3ACkFxJJ4uzNbn5U7xrkJX1GeUl/yjRWe32SNXLWhVNVEXtxYcnnUC5uwPsbG0QcjTXOg== X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(209900001)(164054003)(199003)(189002)(77096005)(62966003)(106466001)(50226001)(19580395003)(87936001)(15395725005)(48376002)(189998001)(229853001)(53416004)(86362001)(36756003)(105586002)(47776003)(92566002)(101416001)(33646002)(77156002)(5001770100001)(46102003)(50466002)(15975445007)(50986999)(6606295002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB067;H:atltwp02.amd.com;FPR:;SPF:None;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB067;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB1186; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BLUPR02MB067;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB067; X-Forefront-PRVS: 06022AA85F X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2015 03:14:37.7136 (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.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB067 X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This patch set introduces a new instruction support on AMD Carrizo (Family 15h, Model 60h-6fh). It adds mwaitx delay function with a configurable timer. Andy and Boris provide a suggestion which use mwaitx on delay method. Some discussions of the background, please see: http://marc.info/?l=linux-kernel&m=143202042530498&w=2 http://marc.info/?l=linux-kernel&m=143161327003541&w=2 http://marc.info/?l=linux-kernel&m=143222815331016&w=2 They are rebased on tip/master. Changes from v1 -> v2 - Remove mwaitx idle implementation since some disputes without power improvement. - Add a patch which implement another use case on delay. - Introduce a kernel parameter (delay) to make delay method configurable. I already do some testing with mwaitx on udelay. Test scenario: glb_loops = usec_to_tsc(delay_usec) rdtsc -> read TSC counters as start mwaitx_delay(glb_loops) rdtsc -> read TSC counters as end diff = end - start Compared the real TSC counts (diff), that means the loops of counter goes. And glb_loops is the input value of the EBX, that is the expect loops which user configures. Below is 10000 us of mwaitx delay, we could see about 1200 (diff - glb_loops) delayed with mwaitx. [ 2369.008651] start=4401974718758, end=4401992576888, diff=17858130, glb_loops=17856939 Thanks, Rui Huang Rui (4): x86, mwaitt: add monitorx and mwaitx instruction x86, mwaitt: make delay method configurable x86, mwaitt: introduce mwaix delay with a configurable timer x86, mwaitt: add documents of delay option Documentation/kernel-parameters.txt | 7 ++++++ arch/x86/include/asm/cpufeature.h | 1 + arch/x86/include/asm/delay.h | 8 ++++++ arch/x86/include/asm/mwait.h | 26 ++++++++++++++++++++ arch/x86/kernel/setup.c | 22 +++++++++++++++++ arch/x86/lib/delay.c | 46 +++++++++++++++++++++++++++++++++-- 6 files changed, 108 insertions(+), 2 deletions(-) -- 1.7.9.5