From patchwork Sat Oct 7 17:10:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 149616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1028426vqo; Sat, 7 Oct 2023 10:11:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnqgWw/mGHkuO0I6GhD41b6Fz55jZfyHXpJ1vc+s5f3hJD6VsukLz3p8gzvH9hixh+fxLa X-Received: by 2002:a17:90b:33c6:b0:26d:49a0:2071 with SMTP id lk6-20020a17090b33c600b0026d49a02071mr13492264pjb.13.1696698677998; Sat, 07 Oct 2023 10:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696698677; cv=none; d=google.com; s=arc-20160816; b=V/SnqPcWb/zk3A6Dv8fnjxvTBxpzYGtC19wwxYrdlko1EHzwR5l7eqCSlOF4ZZPsFP Np8go18YbrGuvbdEoYXnKp5TFMy7lJJwO69Z5AbZ9viOoKjLWRUdKObNPw5bs4Fgh61Q eDk9gRIcO8rKQIFLRHCGadMZlzwDSfak0pQzdWjhhPPdjHgz8FP5JvdhKf0UVLbAQgB3 ysE0S5rScK3b+xGzoW259zbHxTP1XJ6ndEUrmjryDauP1TOwNt5L6YS1aQk4vhqvn5MM aHSUpZ+tyeYOJOGwniwrFy6pYfEuIfTffbNBUBMInTqYsCjH1QGzi/pmZejw97hWFrZn 8qdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=gECZZh5iJ02TdAKQPSzRNmE/zibkCxme3Qc20tTwTPs=; fh=9hbCrlT43iXm4uesi0nu9AJusJzEgkVU2SuAPew9Phs=; b=T+0ESpz1Pp2ROoDOsNgTp2Yus1VcRzMCvV+hi2WtXIV+g15MO/FkIHxQfN8X8no3EM UVUdWAs5JPLrg3C6ZSlFNeKiBdF7RB+2XWufLPXWxRshYK0WRLmURIPPthnNoyq5pr8V j5O5f+NHJRp3sV9+V9j165XiSZUHBatHQ/hYgfk4nkIiqzvyJgrymkl7kQp9rSERlKpp L6fb4OHJvKNgat1wM+FZU/g2bKnEMnRdfNyy/iail5KNw8WcgV7tZ3Ntcl8FjSPiAu9l 3po2lDr+cpyD/lUh5lBPYHvIa/vdqC4stwx33QAeNkhfjyQTpkCp2UWUbsc948FiPxk3 s7Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3JyEcrtL; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id lx14-20020a17090b4b0e00b0027383ac5ebcsi2658537pjb.130.2023.10.07.10.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 10:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3JyEcrtL; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1A05C8035365; Sat, 7 Oct 2023 10:11:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344123AbjJGRLE (ORCPT + 17 others); Sat, 7 Oct 2023 13:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344046AbjJGRLB (ORCPT ); Sat, 7 Oct 2023 13:11:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 242E99E; Sat, 7 Oct 2023 10:11:00 -0700 (PDT) Date: Sat, 07 Oct 2023 17:10:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696698658; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gECZZh5iJ02TdAKQPSzRNmE/zibkCxme3Qc20tTwTPs=; b=3JyEcrtLPT7xPj2ehM0/gYaq8DDMbwUTGsFtAoLPHnplatdJPypYNGE/PZSsIQM5n2yzmA A4zr8vkDXym+qMbNNPcUM9C7sqxOMy4t87gUQvEe/iMC2bY/mBLJ2F/MgKtr3gtJT+Ts/U qyb5wVMKghsbvXKc/0+sKvakF/UvHYouRpAoBk5+5DrOXq8zB/lHK8I9EEqwZYZSrGsJVW 41HssW1+9qLLatpwgI+JZ6d4CDEuLMqfFqrWHUJS5yICls9XtcJbtjC1etRWnPGKpJhq7U phZA4q8GVniXnpWS+O9PB663AzhUm+h4vGVmm1wZgMmOKlZsNwlXmPAXZGxupw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696698658; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gECZZh5iJ02TdAKQPSzRNmE/zibkCxme3Qc20tTwTPs=; b=cdgrfJrN2bwdLeAJvwQfdGY97CXJwqbWT4dDnZl3hWsFHANCrolMMMDGN3rY/N98zoTcH4 Z5inQJSbtdCVtDAw== From: "tip-bot2 for Waiman Long" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] intel_idle: Use __update_spec_ctrl() in intel_idle_ibrs() Cc: Waiman Long , Ingo Molnar , "Rafael J. Wysocki" , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230727184600.26768-4-longman@redhat.com> References: <20230727184600.26768-4-longman@redhat.com> MIME-Version: 1.0 Message-ID: <169669865810.3135.4637182434325944599.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 07 Oct 2023 10:11:13 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772602172152738420 X-GMAIL-MSGID: 1779117512874316717 The following commit has been merged into the sched/core branch of tip: Commit-ID: 7506203089dceb1d9e1f35d37ad2e46d44798a6d Gitweb: https://git.kernel.org/tip/7506203089dceb1d9e1f35d37ad2e46d44798a6d Author: Waiman Long AuthorDate: Thu, 27 Jul 2023 14:45:59 -04:00 Committer: Ingo Molnar CommitterDate: Sat, 07 Oct 2023 11:33:28 +02:00 intel_idle: Use __update_spec_ctrl() in intel_idle_ibrs() 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 Signed-off-by: Ingo Molnar Acked-by: Rafael J. Wysocki Cc: Linus Torvalds Link: https://lore.kernel.org/r/20230727184600.26768-4-longman@redhat.com --- 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 ea5a6a1..86ac9a4 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; }