From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932318AbbFIKE6 (ORCPT ); Tue, 9 Jun 2015 06:04:58 -0400 Received: from mail-bl2on0134.outbound.protection.outlook.com ([65.55.169.134]:51424 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752214AbbFIKEy (ORCPT ); Tue, 9 Jun 2015 06:04:54 -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: 0NPO9C0-07-327-02 X-M-MSG: Date: Tue, 9 Jun 2015 18:03:10 +0800 From: Huang Rui To: Borislav Petkov CC: Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , "Rafael J. Wysocki" , Len Brown , John Stultz , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "Fengguang Wu" , Aaron Lu , "Suthikulpanit, Suravee" , "Li, Tony" , "Xue, Ken" Subject: Re: [PATCH v2 2/4] x86, mwaitt: make delay method configurable Message-ID: <20150609100309.GB17030@hr-slim.amd.com> References: <1433819621-15093-1-git-send-email-ray.huang@amd.com> <1433819621-15093-3-git-send-email-ray.huang@amd.com> <20150609090543.GA22105@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150609090543.GA22105@pd.tnic> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD005;1:W2Z37jeDsj3q2XAYMqvUY/X2HWm18NroCre9t4dV8Xt7pGPzRYxC5oDKDa1B57ca8c2oj0irs0cJWkYz+qHpaHhHaznhYkIx1C5FZw9W3ph2I6dNzAhU20/eZAln/OMl1Jq/phITwlOFA9HidXI20bZfDHpCzdh4bO7QQ+qJNx6cgEoXrTtOF3SFJosT+rJ7CWhLzqG+iD7vHX4AlQcJ/Tf41FLNb6oZG2m2ivHmSVIi5i620S9kyJ7I5e2hsrS/GlcxeESYjZoMTOJxuNbveXSA/9bHVSSXTW6z6xxx2ic+Fg5V7rpByKGkwkVElv1MgWK3fv/9DoNQNvU8O/DlTg== X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(51704005)(189002)(199003)(164054003)(24454002)(19580405001)(92566002)(50986999)(54356999)(76176999)(4001350100001)(106466001)(86362001)(19580395003)(47776003)(53416004)(23726002)(189998001)(77096005)(62966003)(77156002)(110136002)(46406003)(50466002)(87936001)(101416001)(97756001)(83506001)(105586002)(46102003)(33656002)(2950100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB065;H:atltwp01.amd.com;FPR:;SPF:None;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB065; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:BLUPR02MB065;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB065; X-Forefront-PRVS: 06022AA85F X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2015 10:04:49.8628 (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: BLUPR02MB065 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2015 at 05:05:43PM +0800, Borislav Petkov wrote: > On Tue, Jun 09, 2015 at 11:13:39AM +0800, Huang Rui wrote: > > This patch introduces a kernel parameter (delay), user is able to configure > > it at boot loader to choose different types of delay method. > > > > Default schema is to use TSC delay. This update can be more flexiable to > > add new delay method. > > > > Suggested-by: Suravee Suthikulanit > > Signed-off-by: Huang Rui > > --- > > arch/x86/include/asm/delay.h | 7 +++++++ > > arch/x86/kernel/setup.c | 19 +++++++++++++++++++ > > arch/x86/lib/delay.c | 12 +++++++++++- > > 3 files changed, 37 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/include/asm/delay.h b/arch/x86/include/asm/delay.h > > index 9b3b4f2..99873ec 100644 > > --- a/arch/x86/include/asm/delay.h > > +++ b/arch/x86/include/asm/delay.h > > @@ -5,4 +5,11 @@ > > > > void use_tsc_delay(void); > > > > +extern unsigned long boot_option_delay; > > + > > +enum delay_type { > > + DELAY_LOOP=0, > > + DELAY_TSC, > > +}; > > + > > #endif /* _ASM_X86_DELAY_H */ > > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c > > index 0b10698..cc2886d 100644 > > --- a/arch/x86/kernel/setup.c > > +++ b/arch/x86/kernel/setup.c > > @@ -111,6 +111,7 @@ > > #include > > #include > > #include > > +#include > > > > /* > > * max_low_pfn_mapped: highest direct mapped pfn under 4GB > > @@ -844,6 +845,24 @@ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) > > return 0; > > } > > > > +static int __init delay_setup(char *str) > > +{ > > + if (!str) > > + return -EINVAL; > > + > > + if (!strcmp(str, "tsc")) { > > + pr_info("using tsc delay\n"); > > + boot_option_delay = DELAY_TSC; > > + } else if (!strcmp(str, "loop")) { > > + pr_info("using loop delay\n"); > > + boot_option_delay = DELAY_LOOP; > > + } else > > + return -1; > > What Peter said. > > And we did talk about this already in the last review. You guys want to > drop all those kernel parameters and use MWAITX delay by default when: > > 1. HW supports MWAITX > > *and* > > 2. delay fits in u32. > > Kernel parameters is a bad bad idea. > Sorry, I am suggested to make the mwaitx delay configurable firstly by our guys... Why do you think that method is bad? Thanks, Rui