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,  powertree <powertree@163.com>,
	 Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH Dovetail] arm64: fpsimd: dovetail: Allow preemption of in-band fpsimd kernel sections
Date: Sun, 02 Mar 2025 16:07:06 +0100	[thread overview]
Message-ID: <87cyezh3ol.fsf@xenomai.org> (raw)
In-Reply-To: <20250219141759.2455053-1-florian.bezdeka@siemens.com> (Florian Bezdeka's message of "Wed, 19 Feb 2025 15:17:59 +0100")

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

> Preemption of in-band in-kernel fpsimd sections was not allowed /
> properly implemented in Dovetail up to now.
>
> That piled up again as some crypto code was optimized for arm64 in
> Linux 6.14. A possible call stack that makes clear that the FPU was
> corrupted follows. The inband stage was using crypto/FPU code inside
> the kernel and got interrupted by OOB.
>
> 	[  331.703695]  task_fpsimd_load+0xd0/0x214 (P)
> 	[  331.703713]  fpsimd_restore_current_state+0x9c/0xb8
> 	[  331.703732]  fpsimd_restore_current_oob+0x1c/0x2c
> 	[  331.703751]  dovetail_context_switch+0x90/0x180
> 	[  331.703769]  pipeline_switch_to+0x10/0x1c
> 	[  331.703792]  ___xnsched_run+0x1bc/0x29c
> 	[  331.703811]  run_oob_call+0x98/0x17c
> 	[  331.703830]  handle_irq_pipelined_finish+0x1e0/0x1ec
> 	[  331.703848]  handle_irq_pipelined+0x58/0x6c
> 	[  331.703865]  call_on_irq_stack+0x24/0x4c
> 	[  331.703884]  do_interrupt_handler+0x150/0x178
> 	[  331.703902]  el1_interrupt+0x44/0x11c
> 	[  331.703921]  el1h_64_irq_handler+0x18/0x24
> 	[  331.703941]  el1h_64_irq+0x6c/0x70                <- oob
> 	[  331.703957]  crc32c_le_arm64_4way+0x4c/0xc0 (P)   <- inband
> 	[  331.703978]  ext4_block_bitmap_csum_set+0x38/0x60
> 	[  331.704002]  ext4_mb_mark_context+0x1b0/0x398
> 	[  331.704025]  ext4_mb_mark_diskspace_used+0xd8/0x1f8
>
> To fix that we have to hook into the task switch as we do on x86 and
> invoke the FPU (re)store logic.
>
> Cc: powertree <powertree@163.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> Cc: Philippe Gerum <rpm@xenomai.org>
>
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
>  arch/arm64/include/asm/dovetail.h    | 10 +++++++--
>  arch/arm64/include/asm/fpsimd.h      |  7 +++++-
>  arch/arm64/include/asm/thread_info.h |  1 +
>  arch/arm64/kernel/fpsimd.c           | 33 ++++++++++++++++++++++++++++
>  4 files changed, 48 insertions(+), 3 deletions(-)

LGTM, stable under significant stress load on imx8mp.

    Acked-by: Philippe Gerum <rpm@xenomai.org>

-- 
Philippe.

      parent reply	other threads:[~2025-03-02 15:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19 14:17 [PATCH Dovetail] arm64: fpsimd: dovetail: Allow preemption of in-band fpsimd kernel sections Florian Bezdeka
2025-02-20 11:36 ` Jan Kiszka
2025-03-13  8:55   ` Florian Bezdeka
2025-03-13 10:12     ` Jan Kiszka
2025-03-02 15:07 ` Philippe Gerum [this message]

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=87cyezh3ol.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=powertree@163.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.