Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1356922ybg; Fri, 18 Oct 2019 16:37:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgNjO+jEpt/f2Ekx873bcBBJVzKekcQ4wKQ3FeFwLEZIdoXM4V0qhJPTLWCEMxLE1EcYij X-Received: by 2002:a17:906:3415:: with SMTP id c21mr11539183ejb.190.1571441878331; Fri, 18 Oct 2019 16:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571441878; cv=none; d=google.com; s=arc-20160816; b=UAPHWLmCLJ1PVX2HhJ8QPO9AsagTvWA3YPivPe/iK+uWXLwyarVyG3cbZQL8xKRV00 OfmcAmY+Y8YqLbdEYs7uycMgSN/65bHsu7VV5Vvx61qXX06m0tUkxMxPktXK73+5oGYc AnI04BplnanXAeSKR2MlpWw4xHp7fwuiS+dtK4AF8SovMd+enFd4I91lE3N6IC72EKzl glgU3dhymhNvRQ8XTI4JmgEm+80E2MfMUuTunvSxNLWjPS3Uqb8BhMNT/k6BRDelHqcP iUvFOQfmRk6f+S0vpGWNF1Htt9bCVPE/p+/xycpEAMW2ocPhWx1nswnyAP6Zx7oe3oeh FWcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=70RBmu/1BKwG1muO4mtJ8TJ8hCo34siAp8SqvZX3CFM=; b=vuR6/soXTYlIc4KlToEy880y/O1Iz5jRkh8JqMhHo+1FigFHSUbS/iGkz+WVydwhmg CHfph0fH+ElvAA05TWrV1c4C37hAu+9y//Fcy0MBi4LazWKNSuRz675I5648Z8Oezcz/ JCYiP/zl1PrmINGR6w+GFB6OX4toOwi2vH6VWKDCdtuIC47PxWpizFEdAA4C+8SM2tT4 s7SF5Mh3Q7XRwC1H9tDwWALy9efwIyNfKDQZuju+MoYPdsv4m3GKLytn5XfwctGALofZ 497A0islxa5J3T1TyCwiL7POYyiDSjoms0GoXAv1HKYRjNOAbXnz32vcvBSP5BTTtT9E TWsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MZmqGthJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si4493758edx.450.2019.10.18.16.37.36; Fri, 18 Oct 2019 16:37:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MZmqGthJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504543AbfJRHM3 (ORCPT + 99 others); Fri, 18 Oct 2019 03:12:29 -0400 Received: from merlin.infradead.org ([205.233.59.134]:33942 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728008AbfJRHM3 (ORCPT ); Fri, 18 Oct 2019 03:12:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=70RBmu/1BKwG1muO4mtJ8TJ8hCo34siAp8SqvZX3CFM=; b=MZmqGthJx7fbQD70+n0/DOoYl XZy310QUlkaYt0C572lLZ2EWBUV2zOOC4uODDZ+vSBp7x23sbJeZvNscfu1/8W+MqiqY1jn9WEjB2 vjJ09Q78/z7dpvr8htRb1FH3RndJn1EL6oJC6jLRrPtzuMO9USUfEnvn7Np282u2bXezEsfqF3K6s VN8hllpfC9hUDOKROgcDN6ZXAvRqi49o6O3wcu3bTf03IZNUtHQM8OwugR+idpkdei6mQLvHr3H+F BsCMLZlf4xYnTj+gsoUlSqVREG/PKKn2jsDZWVaIsZQgbVRQMrfCxyRpVCIdUWQ1ccCzSxdQc/OsI 7O/nMHFGQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLMQj-0007Bj-L3; Fri, 18 Oct 2019 07:12:09 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 19AFE305803; Fri, 18 Oct 2019 09:11:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A753B2B17E62E; Fri, 18 Oct 2019 09:12:06 +0200 (CEST) Date: Fri, 18 Oct 2019 09:12:06 +0200 From: Peter Zijlstra To: Zhenzhong Duan Cc: linux-kernel@vger.kernel.org, x86@kernel.org, tim.c.chen@linux.intel.com, Thomas Gleixner , Borislav Petkov , Ingo Molnar , "H. Peter Anvin" , Boris Ostrovsky Subject: Re: [PATCH] x86: Don't use MWAIT if explicitly requested Message-ID: <20191018071206.GZ2328@hirez.programming.kicks-ass.net> References: <1571370354-17736-1-git-send-email-zhenzhong.duan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1571370354-17736-1-git-send-email-zhenzhong.duan@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 11:45:54AM +0800, Zhenzhong Duan wrote: > If 'idle=nomwait' is specified or process matching what's in > processor_idle_dmi_table, we should't use MWAIT at bootup stage before > cpuidle driver loaded, even if it's preferred by default on Intel. > > Add a check so that HALT instruction is used in those cases. The comment in idle_setup(): /* * If the boot option of "idle=nomwait" is added, * it means that mwait will be disabled for CPU C2/C3 * states. In such case it won't touch the variable * of boot_option_idle_override. */ boot_option_idle_override = IDLE_NOMWAIT; explicitly states this option is for C2+ > Signed-off-by: Zhenzhong Duan > Cc: Thomas Gleixner > Cc: Borislav Petkov > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: Boris Ostrovsky > --- > arch/x86/kernel/process.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c > index 5e94c43..37fc577 100644 > --- a/arch/x86/kernel/process.c > +++ b/arch/x86/kernel/process.c > @@ -667,6 +667,10 @@ static void amd_e400_idle(void) > */ > static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) > { > + /* Don't use MWAIT-C1 if explicitly requested */ > + if (boot_option_idle_override == IDLE_NOMWAIT) > + return 0; And this is very much about C1... OTOH, "idle=halt" should be forcing HLT over MWAIT, so did you want to write: if (boot_option_idle_override == IDLE_HALT) return 0; instead?