Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp264240rwb; Thu, 27 Jul 2023 12:20:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlEkUMKbAXTjKCyCLq14KH6U7iuLSCmfm7lY4fiWfxtemRMMGW66YFwj6xp+WKE/0Qs/RhNE X-Received: by 2002:a17:907:6292:b0:99b:4b6d:f2bf with SMTP id nd18-20020a170907629200b0099b4b6df2bfmr3624434ejc.10.1690485651259; Thu, 27 Jul 2023 12:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690485651; cv=none; d=google.com; s=arc-20160816; b=M1RvTtnZZFeqz3SJbs32FDuTrUtXxhbfEA2LxLbseWdXWW/IOTSAHW6itSnT5Hgve5 RQ4Sl/K+14OyRyLgktb6iajn05cjZJZ93zTK12zrulF4G+QyhOiCsY4WWIcPjPcSxEM4 Hmsj02c4uy2pwrzgwBvNukyWQZ0f6FKx7EjHWMD94y+TMQLXHLsAcOoDucPgTCcv2CRK rRJGM55lNRtMfbJoAD0CXgYPe74gqnlFm8e723pMd+LjcrcH0uZ1KjuGglXalZskuepe O9ALVcs8FHLgfPZ/TBANfg/UmdpsLawvSi1oy0GZTqs5ygogaZRVkW3DdwICDGUGTIBD ynJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hgcVQqDmL6DGm3gA3jePiRRXjc2Eh2fCViWl8QhUEvg=; fh=O5hGN+g8auw9Ax2YMVhoIJ+3XXizvyZrFj7plzReJck=; b=p24tv4O0279DnCfl6GShDfACiFj3Iq8JHbr2HRmRPvwFR7dnCv0RA32cqR/dNMxodG 6HJaFW8aD4rY5YqZXwQXYTkK0ie7gpxTM5NYU73LJBV8vPPonCDHSheSazRVpzMroQwE VkfdfE1GOVon+Q2+GuyoslYDGgEdXqTXUvhs8e9D+haSUEey9kMawqzLFJiBfIFii6rj z5znaVwhiF3T5X7BbK4ty/ZyDe5VLRUfUTtJGPVih0whnmMrH9hXjhbLqQsr8B9DI2fs s4xcgGO/UdLDjX84YY6bm6KnZFx+//PBpZgY/c6LJLvMtL7LXO1oR+jUmip3aGTdx6gd mxGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y4JSd47X; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga6-20020a170906b84600b00988c5329e26si1514606ejb.574.2023.07.27.12.20.25; Thu, 27 Jul 2023 12:20:51 -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=@redhat.com header.s=mimecast20190719 header.b=Y4JSd47X; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbjG0SsG (ORCPT + 99 others); Thu, 27 Jul 2023 14:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231339AbjG0Sr4 (ORCPT ); Thu, 27 Jul 2023 14:47:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49DCE30ED for ; Thu, 27 Jul 2023 11:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690483582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hgcVQqDmL6DGm3gA3jePiRRXjc2Eh2fCViWl8QhUEvg=; b=Y4JSd47Xegv6a1ISXruZJHB2sj7hoX9QuNgmxYMIM79hsCpnSlvmq09xjBZj5FCP8NSnZF zDrRpeDw8ZnEXg+wQNe7NsyvhU5L6dEWJC3HO/RHjcnLcqNhIIy+0gfXuiucEA8m58OdqC n8m2B+/3KsO2BIYEp/QpTNbE8ccwAKg= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-6W-bzWr5NiSbdIJR7bTk_Q-1; Thu, 27 Jul 2023 14:46:21 -0400 X-MC-Unique: 6W-bzWr5NiSbdIJR7bTk_Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C83183828890; Thu, 27 Jul 2023 18:46:18 +0000 (UTC) Received: from llong.com (unknown [10.22.17.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB4A8C57964; Thu, 27 Jul 2023 18:46:17 +0000 (UTC) From: Waiman Long To: Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Josh Poimboeuf , Pawan Gupta , Jacob Pan , Len Brown , Jonathan Corbet , "Rafael J . Wysocki" Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org, Robin Jarry , Joe Mario , Randy Dunlap , Waiman Long Subject: [PATCH v6 3/4] intel_idle: Use __update_spec_ctrl() in intel_idle_ibrs() Date: Thu, 27 Jul 2023 14:45:59 -0400 Message-Id: <20230727184600.26768-4-longman@redhat.com> In-Reply-To: <20230727184600.26768-1-longman@redhat.com> References: <20230727184600.26768-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 When intel_idle_ibrs() is called, it modifies the SPEC_CTRL MSR to 0 in order disable IBRS. However, the new MSR value isn't reflected in x86_spec_ctrl_current which is at odd with the other code that keep track of its state in that percpu variable. Use the new __update_spec_ctrl() to have the x86_spec_ctrl_current percpu value properly updated. Since spec-ctrl.h includes both msr.h and nospec-branch.h, we can remove those from the include file list. Signed-off-by: Waiman Long Acked-by: Rafael J. Wysocki --- drivers/idle/intel_idle.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 256c2d42e350..d286f31a5b96 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -53,9 +53,8 @@ #include #include #include -#include #include -#include +#include #include #define INTEL_IDLE_VERSION "0.5.1" @@ -182,12 +181,12 @@ static __cpuidle int intel_idle_ibrs(struct cpuidle_device *dev, int ret; if (smt_active) - native_wrmsrl(MSR_IA32_SPEC_CTRL, 0); + __update_spec_ctrl(0); ret = __intel_idle(dev, drv, index); if (smt_active) - native_wrmsrl(MSR_IA32_SPEC_CTRL, spec_ctrl); + __update_spec_ctrl(spec_ctrl); return ret; } -- 2.31.1