Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1493353rdb; Tue, 30 Jan 2024 23:25:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdfiCpkjbkEAeUHW2HYTtfrqBV3r3Q6EduUYe+jH3msTw+IzHIZivYC4VFd5UHeM/OQP0x X-Received: by 2002:a17:906:f9c9:b0:a23:32bd:d166 with SMTP id lj9-20020a170906f9c900b00a2332bdd166mr470625ejb.48.1706685913321; Tue, 30 Jan 2024 23:25:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706685913; cv=pass; d=google.com; s=arc-20160816; b=QunlljqDEdnLmOXKhsvCt2OP80W9bXnkgbkx5MHqxQMNGGM+/IeBaCMu1Kbt+FalD9 jCKeSH+tvyu29OyzB0zXC7i4P68085s/BbRKyZmUvfPuxfjXRkasOUlhhGUrnfTp33ax RCxIbqJPr72+bBxCg1QO4xs+TTv74ByArupFnDeB2l2plPlykhps1aRPGIQWEJphUhgK R0ZldlJ1mp1+C7W9aexOYRMx7rI6wDGWKBT1RDUm8UymazTo1/vGONchoJPkmdA1lanS vac1LYOS5UNQOs+8SwVcsKDgEPAsQH8g03ipy9Da9rkVASxlKsYCCP/fJwDNkO54qetr wG2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=oyfbE1G1aG1noX/XnDR3g+FrbN3MKuudiv5ASwe74rQ=; fh=lf2GdQYqO63qYEohyLMhhiDrjPMJ9kZMDvBa4AUqPOo=; b=on7i1i7GG2FeWyRl/gBKCJh2OzlGpehJmcMvQh+GJyC8YIr+Fqqy5Q1OHKOvCA4LUH uFdMRl2KsV4D08CIIHLaEvKCFhMESCKg6bsICF/6JOgUtmUqtRF+IfSZjMmFvq1V2MLE ZIn4SFuQDDXULM9ViwfpBIGlzER6LkgwNAhCn+q7ziMEhwrbnSgX1DayOYmn40pQJ06J RET0CcZd8pj4RNZfT2zZbYs+c2XXrnjjXB0n4dFN7vl3U4MpM0zPS34mONUSRIJ93l2D LobkWzJ5OaeT6HH6zMzqKyqJCHwzpzPLukuNBbqfNwfOS8lUYRpduMkmQudx7BShzaU6 kCww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Zxg9FYBf; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCWKiFLh0XLu/xeevEF/UYLWB/6g8dZ8/85OaOcn75nyt5s0mvYUps82nF/SECGYKq+3MNGTRRjUIkr0TR0rmYpzbt8wl8fzIdGv5rJVlw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i22-20020a50d756000000b0055f19a3348fsi2138751edj.658.2024.01.30.23.25.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:25:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Zxg9FYBf; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45909-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45909-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E828C1F2870F for ; Wed, 31 Jan 2024 07:25:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EF8C7AE74; Wed, 31 Jan 2024 07:21:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Zxg9FYBf"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="r8v7Xtlo" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39D3D74E2B; Wed, 31 Jan 2024 07:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685686; cv=none; b=nXFS3PsKQTT0Ml7SdY66CtVtPGMjowEUNSwepbTcsZgUJ4NGw/q/bdxvu30P3Nv/GrX/dtE3XsSYJ/XmQincMiFGoqSVc0E48WTSULE4s9KSRHoZpWPehp21iizwyVmLW4AnO9MxPeW9IIvuOA2EjFVAFY87VgJnyMkOh+cVn+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685686; c=relaxed/simple; bh=SQSvVsiG1DgRggxdwtLKi4x6V4RPZIaBhYDO/Abj2Q4=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=XLdvdkxp466ZGhs+tw6wyQo8EK1Ku3qUeTZAGb9Rya6c0LJ5q9k875G948N/Sie2iCJQZQ9/pyVkPkz/zi7tfuTjCNi0dPkxeZiiaKOHnuzUSy6BPUnOzPoRBSlEzhlhVWjsOUNCWQLLq54M04FVKukDj8lSNil8Jlq8GMrPb+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Zxg9FYBf; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=r8v7Xtlo; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 31 Jan 2024 07:21:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706685682; 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=oyfbE1G1aG1noX/XnDR3g+FrbN3MKuudiv5ASwe74rQ=; b=Zxg9FYBfRsEfGC49iG9NvMygMctnZmRacJKVRYgFkD0JaDK5PsdD2U85Uqbg5vzYJOe4/J OdquAZEkJmNVbrm6hcy+/3ZFiSQlZcz/VvhUjKYIvsEoHxNCKRyQ00zrJFkDJfMiWjRMVB CSoWxyaQAbqYMX9fRhHQ7P++WdHk6/orVeZoPyyqJsnuf6WyE4Wg138YeNjtpZftljWL4B JZV3+B5vthFBshHnPMgwqWjKPZZaBaoUpTZ9HZF0vGWxwLykACrNt7lJtRbJo/efC94y+e yiVpoF4H7QuEvgNMEn3OkLYAosuSmQ6hCuYcrFdaf+PcqMRfJSjwCJKt0ZQwdg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706685682; 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=oyfbE1G1aG1noX/XnDR3g+FrbN3MKuudiv5ASwe74rQ=; b=r8v7Xtlowp5Bo6sdOFiKfN7odNMaYhwuwXAcNfO0WbZtq5IG0WOGwFf3maOODNxu49Hn2p Y4bIvoTftB+9sQBw== From: "tip-bot2 for H. Peter Anvin (Intel)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fred] x86/fred: Update MSR_IA32_FRED_RSP0 during task switch Cc: "H. Peter Anvin (Intel)" , Xin Li , Thomas Gleixner , Shan Kang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231205105030.8698-18-xin3.li@intel.com> References: <20231205105030.8698-18-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170668568173.398.2179661093584754061.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/fred branch of tip: Commit-ID: f393835cbab6184f3ee6ed90499a88e9930a8512 Gitweb: https://git.kernel.org/tip/f393835cbab6184f3ee6ed90499a88e9930a8512 Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:50:06 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jan 2024 18:20:35 +01:00 x86/fred: Update MSR_IA32_FRED_RSP0 during task switch MSR_IA32_FRED_RSP0 is used during ring 3 event delivery, and needs to be updated to point to the top of next task stack during task switch. Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li Signed-off-by: Thomas Gleixner Tested-by: Shan Kang Link: https://lore.kernel.org/r/20231205105030.8698-18-xin3.li@intel.com --- arch/x86/include/asm/switch_to.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h index f42dbf1..c3bd0c0 100644 --- a/arch/x86/include/asm/switch_to.h +++ b/arch/x86/include/asm/switch_to.h @@ -70,9 +70,13 @@ static inline void update_task_stack(struct task_struct *task) #ifdef CONFIG_X86_32 this_cpu_write(cpu_tss_rw.x86_tss.sp1, task->thread.sp0); #else - /* Xen PV enters the kernel on the thread stack. */ - if (cpu_feature_enabled(X86_FEATURE_XENPV)) + if (cpu_feature_enabled(X86_FEATURE_FRED)) { + /* WRMSRNS is a baseline feature for FRED. */ + wrmsrns(MSR_IA32_FRED_RSP0, (unsigned long)task_stack_page(task) + THREAD_SIZE); + } else if (cpu_feature_enabled(X86_FEATURE_XENPV)) { + /* Xen PV enters the kernel on the thread stack. */ load_sp0(task_top_of_stack(task)); + } #endif }