From patchwork Wed Jan 31 07:21:18 2024 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: 194550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1722832dyb; Tue, 30 Jan 2024 23:24:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQvnghspPUF9u9PdlZwrybkelQMZH9LsUuFJWbs50KAs74AsdJW+Y7n+kJe6LKH4D+ryDr X-Received: by 2002:a0c:f142:0:b0:680:d1f2:5cd0 with SMTP id y2-20020a0cf142000000b00680d1f25cd0mr3781222qvl.15.1706685888569; Tue, 30 Jan 2024 23:24:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706685888; cv=pass; d=google.com; s=arc-20160816; b=di7D9EOPPgzUARlb9jRWoCd6Jm5eCMLBfKpImjBi1hpKjt/8ThiZZaRK8Wm9P4oWiC 2QBZWjVVA3X/2N5RP1D/agQrFE9eLJyq+99woREh5I3UmsSnAZKcOV+rQn9ZJGgr1KJX bF+n2qEJ/VNEGauLeyEcizzT+GTxpVo0ExL6dKqNvDifMnYYtVMuaYEr0fck6ez6QTp7 2Tzt/l44iwiXwfP+V2JKyYJABKO7JqEw3qF4ow8RIWaAOCK6Tt9Idb7DpfTZwDkezTVV 37BLMIQmCEwVq1ItUdpc+mlE79m7M7zmbltHbwOgF6f/pEupROQpOT0Omae7SI2OA9JW eTRg== 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=8FnLl2VW6ausIT9tJbTpQZYvUrpNFT33gSeEto3/nr0=; fh=jawOE0v2oOpsVCX/5nfDzh1FiZ/nKlHD7BUxMwTjZzk=; b=tx0geBcyFMrCvcp/oE221Kz7LCW5hPlnDI24d3OlgXjhtcrm30ECfIkfH0z2UwD0kA 0hVxvsueWFH2/PWwylz7xa99xp/Lkom1ei2LKxp0hSqF+Zz/AMUtFuF3aIxFCaU7Pd1L o/BAJuP0O4Wl9luRUro5teNp2ZyfaQ7F2+FRHh5iZ8LaNEImeFCRnSUCdugZNBSfH5zS 67re+B5YZZP3X2RW3V4nGHlE1j+CFuAanlPEORiVZ2xx4exemvSZe+1P/BKIDJtFjfot bMndjPWdlxcszKMt0L/zaqRGhwCFoElvvoXrq/MoFUS3prlH9W/9d1FpCg6EMJvIQOwk JS4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SUv6cc7r; 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-45905-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45905-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCUMYhGDE4T+zM+zFNz9CvSbluCnnJ4S0kt05b8TispoNXeG7LiZ0JPzcGtwzkciIrxXSvSn1mEW07mJeLFnePKy9sbE0w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kd23-20020a056214401700b0068c7079c7easi148791qvb.516.2024.01.30.23.24.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:24:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45905-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SUv6cc7r; 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-45905-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45905-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5DFD81C258AB for ; Wed, 31 Jan 2024 07:24:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBFBD76C85; Wed, 31 Jan 2024 07:21:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SUv6cc7r"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FxnaCJQ9" 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 AB0CE6A01E; Wed, 31 Jan 2024 07:21:20 +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=1706685682; cv=none; b=fjtzdCXKclir+rxgPmP1No1IjdPybJPNp6mMMiCKFZa3tRtY9Dt8y/FDHE1nfdbhZx/u+cAYtHWFqVpNOpsFf0ogceU+n+CoL+joUqnwMEedwMR2QFKVIAj+RJSd6L9EXlSl9zZM1oh7kmTERuL0Tk39konitwZMqUfIUVXpJME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685682; c=relaxed/simple; bh=Bf2ntj5gomkiyY0MKA+i9LAy2ku+tcf9RD+fOMZGwSU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=d4zwVWeJkv7SylS8+puzvsnSQyDKXiroRH07r2k4pY1y+QUHEQ6DkGz/Mch18Awxoh6ukuhehKHvjeG2ptIrDLN+2a895p1kRzz/y7QyKp4+5dZ+Nj3SUEOT1Daj6KL+Joj0RXr+PeSiJhHrkK/oe0zGH+4s50grTxn8xDwJoBM= 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=SUv6cc7r; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FxnaCJQ9; 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:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706685679; 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=8FnLl2VW6ausIT9tJbTpQZYvUrpNFT33gSeEto3/nr0=; b=SUv6cc7rxJ4gOeMKw5mhtlnKoNXSU0RlucSfIAg/1UFW7gLZ/CSGjv8OmH5A/zyAg9AlvU kuoV8rVsoPOUrs5S9hPOYC0LGb5wm65jGGy+OPosg80RXUJ66yspUABjPYe2khe6SLbxUc e6zMY1zzpYzjS332Gvvy6pBNAj3h/yYndZ6sA8vxm69PfOD8QTW0weC+GJ2Z+QEcRzUKoK 53Hu9km4deFrTLTL9E/Ve56+EGW9+x+i2JalTtAi+aVrRhYwF74aRC5pvk+JhaPyhdAOsL BCAD8wkTufvOREk2VzJsa3D63eY0nbojm1fk97hb4VCUSU5WhyU0792eXHg56w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706685679; 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=8FnLl2VW6ausIT9tJbTpQZYvUrpNFT33gSeEto3/nr0=; b=FxnaCJQ9r0ChqE6Ds5MfF91av2UuCdcD5jQweCXYL+/DUXbdJBupGCSLtGm+Hf8zw4/DzV 0TbvigNCJyWLQEAQ== 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: Make exc_page_fault() work for FRED Cc: "H. Peter Anvin (Intel)" , Xin Li , Thomas Gleixner , Shan Kang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231205105030.8698-22-xin3.li@intel.com> References: <20231205105030.8698-22-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: <170668567825.398.12991014894719583005.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784440858398159884 X-GMAIL-MSGID: 1789589862468906840 The following commit has been merged into the x86/fred branch of tip: Commit-ID: 9f6870bafc183644d20cba702168e37b48e291a7 Gitweb: https://git.kernel.org/tip/9f6870bafc183644d20cba702168e37b48e291a7 Author: H. Peter Anvin (Intel) AuthorDate: Tue, 05 Dec 2023 02:50:10 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jan 2024 18:20:35 +01:00 x86/fred: Make exc_page_fault() work for FRED On a FRED system, the faulting address (CR2) is passed on the stack, to avoid the problem of transient state. Thus the page fault address is read from the FRED stack frame instead of CR2 when FRED is enabled. 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-22-xin3.li@intel.com --- arch/x86/mm/fault.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 679b09c..fa2d699 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -34,6 +34,7 @@ #include /* kvm_handle_async_pf */ #include /* fixup_vdso_exception() */ #include +#include #define CREATE_TRACE_POINTS #include @@ -1518,8 +1519,10 @@ handle_page_fault(struct pt_regs *regs, unsigned long error_code, DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault) { - unsigned long address = read_cr2(); irqentry_state_t state; + unsigned long address; + + address = cpu_feature_enabled(X86_FEATURE_FRED) ? fred_event_data(regs) : read_cr2(); prefetchw(¤t->mm->mmap_lock);