Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10282854rwd; Wed, 21 Jun 2023 20:13:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5lqN8M9KZRToanCVNYgFmJE+X3vdzV3XxjtBPraWtv/RtPWnsD+W07CpW1JvV9lWPYgjhr X-Received: by 2002:a17:90b:11d2:b0:25e:aedf:e82b with SMTP id gv18-20020a17090b11d200b0025eaedfe82bmr16457176pjb.15.1687403586823; Wed, 21 Jun 2023 20:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687403586; cv=none; d=google.com; s=arc-20160816; b=SOTsJRSaJM62XrOlHYoSuia38DYy5k8pyqWOQsQCR5fUQ3ivZX23fZT2DlpvmkzVg+ Hju0w12i7TdiX3+ZbKEgknZYXgr4IBsXqqQd8Vvn91FUmokkFL2VjrqO1rks3rKmRHsh +FAifacResFa9gG3+n2xoKmfZst2t4GrPnYko0/4ApdhZ2wr8EjLwobHk+8A5us0b3VZ B/dJGLTXrq4ZKg4te/pc7SRpniL2pOuzYIVfR9gCwP5A2OH/CBBcRgw0icGKv07vWBtJ lmBTeIMbq2YAN0f1fo9nzh5IE5BpJTjSQnAF9FEAGvA6Zt8KxMdJr68l+Po+DGbqRtMO f9vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9Q+RVMxQTnESFWq3dEuCfX1ILCA2ks3wZlSRkHE8toQ=; b=HnGGFNbfN2+zODVH8eCihRFx93g8xACuS2UW9U0xDSg9jSB8oGaSPJsmhYlazlekNc tP2A8z5aG2xbEjMTeXlUVypKp4LqqJ5jzcgS+UqLhswX/AKnsYVNHktyJt5FVnGdlqQW 8Z329CdaPU56Ibger1UhNu2o9/5ZOPgqeZG9XjvAR4rK7wtCULuO2P/DLRZUWNIuLyGm 9jzSr5KApRW2a+P9mavqgFkGbAfnAZ2yWa7p7/iwNrCWr3GhU8dCnbNCeI4+iCVGMWRb ZAV/clgtEcyDn36weoJzfBgpgday+1Vp4Au3RPJFDazKn/StkGInLDjz0lVjWlBth1s4 SEDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=cMxr7XNo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u186-20020a6385c3000000b0053ee9b21820si5661783pgd.72.2023.06.21.20.12.55; Wed, 21 Jun 2023 20:13:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=cMxr7XNo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjFVCG4 (ORCPT + 99 others); Wed, 21 Jun 2023 22:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjFVCGy (ORCPT ); Wed, 21 Jun 2023 22:06:54 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55455211F; Wed, 21 Jun 2023 19:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=9Q+RVMxQTnESFWq3dEuCfX1ILCA2ks3wZlSRkHE8toQ=; b=cMxr7XNoPaiJJVIfeeYi7V+9mM Mcfkz00jliVgU9VtZ3zSjatxeu5qxG6fkv4ORn3P8I6yBqgAGo6sK6rQSvg2VWw18rcDtXEW+dh8m 1EpbpqKb9IEAV1H8h/ryX8IS3kRXKCD1WqxZ7TzfJtaF3arGqwNskSb6J3oN3xhIZDJvgfr8AXY3f Zp+TqdvqJgI5/b9yUptfSlsLXO2cauPK+jj0vGSkZVo1ZLkoecwCXf1eOBCJieQu0Rw7PI//1/ZKP I03lcVAZnHqJugrYJDc9o4T/fk+9A67jM5AjeQt0P+msn1UQ52TpEiVqltUmYpcG8IZrUtuepsE9w 6zmxmPdQ==; Received: from [2601:1c2:980:9ec0::2764] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qC9hf-00GVVa-2b; Thu, 22 Jun 2023 02:05:43 +0000 Message-ID: <8a1ba9cd-426f-dd59-bb2a-67a0f1af6de8@infradead.org> Date: Wed, 21 Jun 2023 19:05:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v3 1/3] x86/idle: Disable IBRS when cpu is offline Content-Language: en-US To: Waiman Long , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Josh Poimboeuf , Pawan Gupta , Jacob Pan , Len Brown Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org, Robin Jarry , Joe Mario References: <20230622003603.1188364-1-longman@redhat.com> <20230622003603.1188364-2-longman@redhat.com> From: Randy Dunlap In-Reply-To: <20230622003603.1188364-2-longman@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/21/23 17:36, Waiman Long wrote: > Commit bf5835bcdb96 ("intel_idle: Disable IBRS during long idle") > disables IBRS when the CPU enters long idle. However, when a CPU > becomes offline, the IBRS bit is still set when X86_FEATURE_KERNEL_IBRS > is enabled. That will impact the performance of a sibling CPU. Mitigate > this performance impact by clearing all the mitigation bits in SPEC_CTRL > MSR when offline. When the CPU is online again, it will be re-initialized > and so restoring the SPEC_CTRL value isn't needed. > > Add a comment to say that native_play_dead() is a __noreturn function, > but it can't be marked as such to avoid confusion about the missing > MSR restoration code. > > Signed-off-by: Waiman Long > --- > arch/x86/kernel/smpboot.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c > index 352f0ce1ece4..7bc33885518c 100644 > --- a/arch/x86/kernel/smpboot.c > +++ b/arch/x86/kernel/smpboot.c > @@ -84,6 +84,7 @@ > #include > #include > #include > +#include > > /* representing HT siblings of each logical CPU */ > DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map); > @@ -1836,8 +1837,17 @@ void __noreturn hlt_play_dead(void) > } > } > > +/* > + * naitve_play_dead() is essentially a __noreturn function, but it can't typo: native_play_dead() > + * be marked as such as the compiler may complain about it. > + */ > void native_play_dead(void) > { > + if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS)) { > + this_cpu_write(x86_spec_ctrl_current, 0); > + native_wrmsrl(MSR_IA32_SPEC_CTRL, 0); > + } > + > play_dead_common(); > tboot_shutdown(TB_SHUTDOWN_WFS); > -- ~Randy