From nobody Sat Feb 10 22:03:22 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TXPqb1thZz5BRqT; Sat, 10 Feb 2024 22:03:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TXPqb03WFz4gPh; Sat, 10 Feb 2024 22:03:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707602603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dd3rieDMKCl6sm3tDL851RY6tAcDkIWAM0gq5qJgxJc=; b=GojTOQ21iF0O/Ho2yQPIwr7a9y+j4p+WMdWg+cKpE4Eu6EGHbBuvADN0KDFHDEO8Ql8LjJ sT3Nn1SnaTqJ0iUsrAOfmhm4UlmRfFgyqEV6S3AJpTRy6lFYMGkaOpnUJIFqH/2p+NcI7r RRP01ZNOLZxNT8kR8lTdmpkxG7k2rXtL7kntwXKC/7jU4F8SBlXK1pWjxpUeGAfhIUT5Xg 7OsE4+uikK07kq8bKp9dPJ4gqtNY3AknxVm4eDhBGciNxCHJo1vEICZZy4uKp3eBfPZjzo ro+E8wDnO6guvKx9+aQh2yjWSDh+axwzdhYE3DEvJJaXRCcKIxZDkNEJiffaNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707602603; a=rsa-sha256; cv=none; b=KV03HIqOFxgJB2sQJLe2MiREpxR6Ur5MDDGXTUYwUU1n5b/yXl4pHexR2DxJPr4d1kOlGm yk5hrTiGpSas/Md3ro+AYuNUHcIiMT3bGp62gvLUUCAvTeE5LhBGSPGJ54fSMYrEENHT6w iLnSwpq9r/YLmGQHptkGTXNplUe15/2z7sZlXjb15PPFbNZPjuvEfi6I0T7vu/fGV3NzfE 4gUb2hKI7X7b5fAgz6+JO0P0QWGJ4uTsTBu2O2PzHWHOnEPXlBvKajnY5SAcoDzM5pmY7T WDVWCV5ifk/aok7rvJed1C4mmOlwOnwgT6gZ/kdWI+71TOCdZRhqXhMaUDluRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707602603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dd3rieDMKCl6sm3tDL851RY6tAcDkIWAM0gq5qJgxJc=; b=bwaIMAtElfTOzeFT4pQptBv5zbBNGlOEWa+0v81t8glsAwQnNrQeEVMIQTLPuiiMtfxkJS 9U6Zb34tmNmAHsrOYmZDiqb7mmCUSQWHbIeDD8S42Nh0aoE5hxoVZ8o43ITcxWlXC4ittJ XSnGBd1pfynlCHnjKV2Mk91xCr+f9S3MzWsyIbF+yzYmYwXSyG1M7ylvzsMDOgBCA0tKWE Qsb5Lm1Ur1kuWEjmrjMxAdl67AEsfiCeRw0H4St/yWThNW9heHqhPvya7Htq4CnG2wXuB3 hb5hXSCKvPxBzFblH0OeM8KqLt/YDR9U88ChDHXZalHFmZTp4dyhxd/hEPZsUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TXPqZ6FdLzZHF; Sat, 10 Feb 2024 22:03:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41AM3MsL005965; Sat, 10 Feb 2024 22:03:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41AM3Mo3005962; Sat, 10 Feb 2024 22:03:22 GMT (envelope-from git) Date: Sat, 10 Feb 2024 22:03:22 GMT Message-Id: <202402102203.41AM3Mo3005962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: db65db64fbf3 - main - Revert "LinuxKPI: Add explicit software context to FPU sections" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db65db64fbf36c7c3625d55b686201d962a7bc4b Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=db65db64fbf36c7c3625d55b686201d962a7bc4b commit db65db64fbf36c7c3625d55b686201d962a7bc4b Author: Vladimir Kondratyev AuthorDate: 2024-02-10 22:01:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-02-10 22:01:50 +0000 Revert "LinuxKPI: Add explicit software context to FPU sections" kmalloc() support within FPU sections will be redone in other way. This reverts commit 5a3bd281672bd6bd8e18081c3928dfe76d330a5f. Sponsored by: Serenity Cyber Security, LLC Requested by: jhb --- sys/compat/linuxkpi/common/include/linux/compat.h | 6 ------ sys/compat/linuxkpi/common/include/linux/sched.h | 2 -- sys/compat/linuxkpi/common/src/linux_current.c | 18 ------------------ sys/compat/linuxkpi/common/src/linux_fpu.c | 14 ++++---------- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h index 7922e884beb1..d1a02f612f42 100644 --- a/sys/compat/linuxkpi/common/include/linux/compat.h +++ b/sys/compat/linuxkpi/common/include/linux/compat.h @@ -33,11 +33,6 @@ #include #include -#if defined(__aarch64__) || defined(__arm__) || defined(__amd64__) || \ - defined(__i386__) || defined(__powerpc64__) -#define LKPI_HAVE_FPU_CTX -#endif - struct domainset; struct thread; struct task_struct; @@ -45,7 +40,6 @@ struct task_struct; extern int linux_alloc_current(struct thread *, int flags); extern void linux_free_current(struct task_struct *); extern struct domainset *linux_get_vm_domain_set(int node); -extern int linux_set_fpu_ctx(struct task_struct *); static inline void linux_set_current(struct thread *td) diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index 77c4f6d3f80f..8cb6b12100d5 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -64,7 +64,6 @@ #define TASK_COMM_LEN (MAXCOMLEN + 1) struct seq_file; -struct fpu_kern_ctx; struct work_struct; struct task_struct { @@ -90,7 +89,6 @@ struct task_struct { struct task_struct *group_leader; unsigned rcu_section[TS_RCU_TYPE_MAX]; unsigned int fpu_ctx_level; - struct fpu_kern_ctx *fpu_ctx; }; #define current ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c index d269552c4ffa..c342eb279caa 100644 --- a/sys/compat/linuxkpi/common/src/linux_current.c +++ b/sys/compat/linuxkpi/common/src/linux_current.c @@ -43,10 +43,6 @@ #include #include -#ifdef LKPI_HAVE_FPU_CTX -#include -#endif - #ifdef DEV_APIC extern u_int first_msi_irq, num_msi_irqs; #endif @@ -157,16 +153,6 @@ linux_alloc_current(struct thread *td, int flags) return (0); } -int -linux_set_fpu_ctx(struct task_struct *task) -{ -#ifdef LKPI_HAVE_FPU_CTX - if (task->fpu_ctx == NULL && curthread->td_critnest == 0) - task->fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NOWAIT); -#endif - return (task->fpu_ctx != NULL ? 0 : ENOMEM); -} - struct mm_struct * linux_get_task_mm(struct task_struct *task) { @@ -190,10 +176,6 @@ void linux_free_current(struct task_struct *ts) { mmput(ts->mm); -#ifdef LKPI_HAVE_FPU_CTX - if (ts->fpu_ctx != NULL) - fpu_kern_free_ctx(ts->fpu_ctx); -#endif uma_zfree(linux_current_zone, ts); } diff --git a/sys/compat/linuxkpi/common/src/linux_fpu.c b/sys/compat/linuxkpi/common/src/linux_fpu.c index d510bc208b88..b26dce98774b 100644 --- a/sys/compat/linuxkpi/common/src/linux_fpu.c +++ b/sys/compat/linuxkpi/common/src/linux_fpu.c @@ -30,12 +30,11 @@ #include #include -#include #include #include -#ifdef LKPI_HAVE_FPU_CTX +#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) #include @@ -48,20 +47,15 @@ void lkpi_kernel_fpu_begin(void) { - int err; - - if ((current->fpu_ctx_level)++ == 0) { - err = linux_set_fpu_ctx(current); - fpu_kern_enter(curthread, current->fpu_ctx, - err == 0 ? FPU_KERN_KTHR : FPU_KERN_NOCTX); - } + if ((current->fpu_ctx_level)++ == 0) + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); } void lkpi_kernel_fpu_end(void) { if (--(current->fpu_ctx_level) == 0) - fpu_kern_leave(curthread, current->fpu_ctx); + fpu_kern_leave(curthread, NULL); } #else