Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp142445rdb; Thu, 25 Jan 2024 10:32:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzAlYzKda9ZLBsUqgZTy1hpZ3hpz1pc3eREPuHstOR54SonnK2YzUD+4tDXdBw4MXc8UqK X-Received: by 2002:a17:902:778a:b0:1d7:57e1:5202 with SMTP id o10-20020a170902778a00b001d757e15202mr351132pll.20.1706207535486; Thu, 25 Jan 2024 10:32:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706207535; cv=pass; d=google.com; s=arc-20160816; b=uPyBonku13TCjUw6GwWjkPtGqaFLqP5lU9AKE22D9ifXC4laJ6dFwluWPB30vyWUbS h8hlEDBGx/+doZL0j3oRFo/WlvfWMUELC6uVnq6ny7+MjncSx1XrzPjpvz2gELwunUDf Bzx3LVeEt8GFbL4L0Kqpstmm4WmJdy7AaFuLRtv8+pq/+ECdX1iues1LLi6ZDeEdNEuH mWTfLTsRcS9hdOQLJvDfuzL+TpeMa4czdfp0Nw64kZl+Bo8ifbvcbg0LC1FrKBzwHQVA Tte4xqsgEqLyLhomzV7oze0x6N32vfW10ilBkw4XvTGc0pwpArT2qX4xGWUCwxv3sbEf tPcA== 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=srO66qthsmGSXUgWMTcyGFhQLd+PWyCi6PXet+gYTkc=; fh=U/Hd0cPmVpmsXI9UC370Q88/l4pozXEkKxB1Pi0MTn0=; b=MMX10IjG6iDnip4eUvC3oqvlbuCXceFsNcAqGXBZtGeX/GuDOdhH4R5LWxXFftjeIy 3lXmp2rmSR0WAPXzw4xRiZbX4eETYd1ttBUEr8Mkv7oi46lE40aVSf2wpvuTD/LMoqNF KQ2nSIs2WY8QN7uJGl1jYSuGiuwiAPC2ud+g3R8QegCJ11T90SwypnwJdFaYNQGLINEL 3i4ikn6Wq1R2c/wPAoyu9ZSDH/TBrXKN+O9+IASSQWW/muYB3NSkYkhYgVkbnLDoXNaf 0TfJ8W7Q7kFbeAqrpIGqxIcyfUB2gZCN+qfIkqlyfAGjARGUlNoNlzIvW9j6CJdaUSjI xCPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AIJmbITq; 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-39102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39102-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b14-20020a170902d88e00b001d741dd5838si8500827plz.424.2024.01.25.10.32.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 10:32:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AIJmbITq; 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-39102-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39102-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D3E43B25CD0 for ; Thu, 25 Jan 2024 18:25:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E32913BEA2; Thu, 25 Jan 2024 18:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AIJmbITq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pGDFY4Tw" 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 3F454137C58; Thu, 25 Jan 2024 18:21:32 +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=1706206896; cv=none; b=Fj+FfbvBQyXz2GoUZlK9v5YXH2qZ9ilNLzNrK77qifGzRqBz/Itb7IAtP5EI4r3yOrmxClJu7Nn0kl+adCIaFPMMjcuUJwRryn+B75tdQ6S9Dm2P7UyVuagUMuyvLc35GESN5ymYZlNpNqZg+nrLp2UajJoN8JGNtv2tYkswUcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706206896; c=relaxed/simple; bh=tbVOLeeEOgHLi1PrtjmUtl7bQetxPuEHxll43T7DTzw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=KmF7nsn5C0lJChOd0Dqa99xcBnzA8bHWXmM+0peVEuHiE2SB9cXPJn7abZzUZNSGrW/bcX3Eipr3PjpNa+cKpLdlQHGKyE3IHW/mAmplwOM95qnAGn9s6yWuNTNFkSbkCffHFroD1j/S7tt1Z38bT99NyYqRqZPCKeBxg3SLSb4= 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=AIJmbITq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pGDFY4Tw; 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: Thu, 25 Jan 2024 18:21:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706206889; 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=srO66qthsmGSXUgWMTcyGFhQLd+PWyCi6PXet+gYTkc=; b=AIJmbITqRq2nQR/74GtL6pEkGF+XP5p79jheKm+w5tab4yWXbj2cfIYkCndxAcrWiljd7q td2ZbwMe9woiUJRn5YUQ2akD5M1Hs++mrQBrur+aPKmMMqk6t+9yatsmuTv3S+bO2CPrgk N+MoJYJgJ6q7TYuEgZNcrXhKUOChO5h8AbPZ0F8J805FatDhR+YPz5qFOYqN/KSKkR3Y+o F+wRaIykaTOT4I1RvjyvRFM3ega9gNGWm2JZaok1ULnWk8puce3cL3Ug/fwGW4cMeswBch eYPAHL21l5n8nsrJa5iUZ9+ue0CxpTKcUjiyy2O7dYsckbukUX9su+AFZFll1Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706206889; 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=srO66qthsmGSXUgWMTcyGFhQLd+PWyCi6PXet+gYTkc=; b=pGDFY4TwdlxHSmEwnrqcwZMDHsGplG21x3RKM01sPHscDNPPzTsKyetfGvo+Wm6XHkdYZr rFWifXCrgXLxpNDQ== 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: <170620688878.398.1673947562730698297.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: 7a8aa729761a43528db58e73cf2cea938045991d Gitweb: https://git.kernel.org/tip/7a8aa729761a43528db58e73cf2cea938045991d Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:50:06 -08:00 Committer: Thomas Gleixner CommitterDate: Thu, 25 Jan 2024 19:10:31 +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 }