All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: xenomai@lists.linux.dev,  Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH Dovetail 6.16 v3 2/3] arm64: fpsimd: dovetail: Align with x86 implementation
Date: Mon, 08 Sep 2025 14:38:04 +0200	[thread overview]
Message-ID: <87qzwh86hf.fsf@xenomai.org> (raw)
In-Reply-To: <20250820-wip-flo-fixes-for-dovetail-6-15-v3-2-ae4a674d8e10@siemens.com> (Florian Bezdeka's message of "Fri, 05 Sep 2025 16:26:26 +0200")

Florian Bezdeka <florian.bezdeka@siemens.com> writes:

> The FPU preemption marker is only accessed from the current task, so
> we can avoid atomic operations. Moving the marker from the low level
> flags to the local (synchronous) flags to make that clear.
>
> Gives us some performance and aligns the arm64 implementation with x86.
> ---
>  arch/arm64/include/asm/thread_info.h | 10 +++++-----
>  arch/arm64/kernel/fpsimd.c           |  7 +++++--
>  2 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
> index 3fb3725fb004..a4405b11189b 100644
> --- a/arch/arm64/include/asm/thread_info.h
> +++ b/arch/arm64/include/asm/thread_info.h
> @@ -75,7 +75,6 @@ void arch_setup_new_exec(void);
>  #define TIF_SYSCALL_TRACEPOINT	10	/* syscall tracepoint for ftrace */
>  #define TIF_SECCOMP		11	/* syscall secure computing */
>  #define TIF_SYSCALL_EMU		12	/* syscall emulation active */
> -#define TIF_KERNEL_FP_PREEMPTED	15	/* Dovetail: kernel mode FPSIMD section preempted by OOB */
>  #define TIF_MAYDAY		16	/* Emergency trap pending */
>  #define TIF_RETUSER		17	/* INBAND_TASK_RETUSER is pending */
>  #define TIF_MEMDIE		18	/* is terminating due to OOM killer */
> @@ -141,9 +140,10 @@ void arch_setup_new_exec(void);
>  /*
>   * Local (synchronous) thread flags.
>   */
> -#define _TLF_OOB		0x0001
> -#define _TLF_DOVETAIL		0x0002
> -#define _TLF_OFFSTAGE		0x0004
> -#define _TLF_OOBTRAP		0x0008
> +#define _TLF_OOB			0x0001
> +#define _TLF_DOVETAIL			0x0002
> +#define _TLF_OFFSTAGE			0x0004
> +#define _TLF_OOBTRAP			0x0008
> +#define _TLF_KERNEL_FPU_PREEMPTED	0x0010	/* Dovetail: kernel mode FPSIMD section preempted by OOB */
>  
>  #endif /* __ASM_THREAD_INFO_H */
> diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
> index aac0dbf6d84e..1f5fcac32b2d 100644
> --- a/arch/arm64/kernel/fpsimd.c
> +++ b/arch/arm64/kernel/fpsimd.c
> @@ -2183,7 +2183,7 @@ void fpsimd_suspend_inband(void)
>  	 */
>  	if (test_thread_flag(TIF_KERNEL_FPSTATE)) {
>  		fpsimd_save_state(kfpu);
> -		set_thread_flag(TIF_KERNEL_FP_PREEMPTED);
> +		set_thread_local_flags(_TLF_KERNEL_FPU_PREEMPTED);
>  	}
>  }
>  
> @@ -2191,8 +2191,11 @@ void fpsimd_resume_inband(void)
>  {
>  	struct user_fpsimd_state *kfpu = this_cpu_ptr(&in_kernel_fpstate);
>  
> -	if (test_and_clear_thread_flag(TIF_KERNEL_FP_PREEMPTED))
> +	if (test_thread_local_flags(_TLF_KERNEL_FPU_PREEMPTED)) {
>  		fpsimd_load_state(kfpu);
> +		clear_thread_local_flags(_TLF_KERNEL_FPU_PREEMPTED);
> +	}
> +
>  }
>  
>  #endif

Ack.

-- 
Philippe.

  reply	other threads:[~2025-09-08 12:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 14:26 [PATCH Dovetail 6.16 v3 0/3] Dovetail 6.16: Fix some regressions introduced during last forward port Florian Bezdeka
2025-09-05 14:26 ` [PATCH Dovetail 6.16 v3 1/3] x86/fpu: dovetail: Fix FPU corruption Florian Bezdeka
2025-09-08 12:37   ` Philippe Gerum
2025-09-08 12:53     ` Florian Bezdeka
2025-09-05 14:26 ` [PATCH Dovetail 6.16 v3 2/3] arm64: fpsimd: dovetail: Align with x86 implementation Florian Bezdeka
2025-09-08 12:38   ` Philippe Gerum [this message]
2025-09-05 14:26 ` [PATCH Dovetail 6.16 v3 3/3] irq_pipeline: Fix pipelining code for level triggered IRQs Florian Bezdeka
2025-09-08 12:40   ` Philippe Gerum
2025-09-08  9:20 ` [PATCH Dovetail 6.16 v3 0/3] Dovetail 6.16: Fix some regressions introduced during last forward port Florian Bezdeka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87qzwh86hf.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.