From patchwork Wed Oct 4 15:47:12 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: 148382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:254a:b0:403:3b70:6f57 with SMTP id hf10csp225861vqb; Wed, 4 Oct 2023 08:47:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEREfDioYrLW9LYKQq0uHRIqH6UO+9hNMir2JPMhc9LvaM5GrLWOPb74KJns89GBEh+/mfy X-Received: by 2002:a05:6a20:12ca:b0:159:c07d:66f0 with SMTP id v10-20020a056a2012ca00b00159c07d66f0mr66831pzg.6.1696434453923; Wed, 04 Oct 2023 08:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696434453; cv=none; d=google.com; s=arc-20160816; b=odG/OF8PFXI2ypwibWZX7538kPbjsDWQUtFjSKnaG17OzdLrY5WI+EP4tw43JpBSxB qcnEHrPvlFauWZ5RotXajqaTcodlxQPjXoYG3aLqtYCvhLGVCUeHx4PCNvhobFAPcSAt iQU6OOkf/L2o8xUzPm8AvJ4xDxmsaooBFoTt/GSDlrpki2tABqmBwfRlsFGOQOBO6jdn fx0jSV02kpjABOFjxHGeyKePwOn1MZHiSjSeO4M74/kwIa3iI3NnjI6BgIMUf9yugwHH Vkjj7aRLrsxEbIcpi5to+N6smrSrqzx8cQE17K8i6uczdFPq7BsvWUiCdjSNoquPBtQb LmMw== 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=9p0kvYM/s+7hGqHL3CU0GH8fKoncUpQiZRjlNYQ5v3w=; fh=9hbCrlT43iXm4uesi0nu9AJusJzEgkVU2SuAPew9Phs=; b=qbDi9w+OYoyjcEmV0vJI0Kd/BWlUl5DqeXa0Dmj4ckZL20c1pG6boA6JwZ145hbhXK 3ZWMHoHP8KTaYOiLRIwpfDC7GfZvSn5lRTMxFFSJOv3Fk/acO1UoGQ6Vbu2U7gqme4Ej wRCD+f39J0HL/6CxVlcyqa9f2ApI/5GOV/4pOdHlAHArQtmhjNuyzJMFqa/8Ds62HIV1 BngMj1Kt6u71iX7bBpEPLrA4jjH/G6nvFSYof2UHfhFaTbgRxUKXvmDQssDzFJKGdwd4 CXT5GEAap6Y0HZE/8duPfQkI2AU4bm47rTayl1aEwxo8+gqB14IDqt413/p0DUMyw3pZ Rr3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hJErgrjd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 cr14-20020a056a000f0e00b0068e256c6366si3793544pfb.352.2023.10.04.08.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 08:47:33 -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=hJErgrjd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 B8BB981B1790; Wed, 4 Oct 2023 08:47:27 -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 S233720AbjJDPrT (ORCPT + 18 others); Wed, 4 Oct 2023 11:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233640AbjJDPrR (ORCPT ); Wed, 4 Oct 2023 11:47:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC09A6; Wed, 4 Oct 2023 08:47:14 -0700 (PDT) Date: Wed, 04 Oct 2023 15:47:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696434433; 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=9p0kvYM/s+7hGqHL3CU0GH8fKoncUpQiZRjlNYQ5v3w=; b=hJErgrjdlW02ex/ltsUeRy5xOK9TVzm4/yYHgKSZOYKOh+oOCV5t+0InhGRBeuqmuMbyii dyjC2+nzIXxK+tgjwrO+/tzhtKjz3eiKLywPtDHgq0ApWcTJc5WLX0vvUgUXOM6lJpxEIj hyJTjUHya9x1y/v+xXlJR6xkrXhP8HqbcjLAu6NZRMZvpfjG8RH2JFpK6SRWHrJbe/fldP YSdf4yUzmTOL2ZeYAwWDDtUbP808cJ4m22oFytDpDlG86YORc5PQCSUAx9vTSmVnBZvKIB JPkRJNQIQcDMm4uQZBwLfVJJ9GKP2EMd94Osined6DtXDO3R1L60iOPsyAgX4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696434433; 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=9p0kvYM/s+7hGqHL3CU0GH8fKoncUpQiZRjlNYQ5v3w=; b=vFoKHdtdMvfuuBteac19v+C+77tqYOlzAzefeF3A/ntsi5u/7EPHmJiboD1wHH8Y9OHhkL aWQspAaM3XpwJMCQ== 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: <169643443236.3135.5722494336369164207.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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]); Wed, 04 Oct 2023 08:47:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772602172152738420 X-GMAIL-MSGID: 1778840453639919003 The following commit has been merged into the sched/core branch of tip: Commit-ID: 1fe96fb4d0f2df207c906a7b1bba70154900ebd1 Gitweb: https://git.kernel.org/tip/1fe96fb4d0f2df207c906a7b1bba70154900ebd1 Author: Waiman Long AuthorDate: Thu, 27 Jul 2023 14:45:59 -04:00 Committer: Ingo Molnar CommitterDate: Wed, 04 Oct 2023 13:48:48 +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; }