linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] ARM: convert VFP exception handling to C code
@ 2023-05-22  8:03 Ard Biesheuvel
  2023-07-19 10:15 ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2023-05-22  8:03 UTC (permalink / raw)
  To: linux+pull
  Cc: linux-arm-kernel, Ard Biesheuvel, Linus Walleij, Arnd Bergmann,
	Sebastian Andrzej Siewior

Hello Russell,

This pull request covers the outstanding changes related to VFP exception
handling that I implemented on top of the VFP-in-softirq policy change and
subsequent fixes. The code changes are identical to the v2 series [0].

With these changes applied, only FPE related undef exceptions are dispatched in
the old way. Everything else is handled using undef hooks, with all logic
implemented in C.

I have tested this on a variety of platforms, including Cortex-A8 (using kernel
mode NEON) and the original Raspberry Pi (which relies on VFP bouncing), as
well as a host of platforms used in KernelCI [1]. All encountered issues have
been fixed. One notable configuration that I have not been able to test is FPE,
as it implies a OABI user space, which I don't have access to.

Please pull.


The following changes since commit f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6:

  Linux 6.4-rc2 (2023-05-14 12:51:40 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git tags/arm-vfp-refactor-for-rmk

for you to fetch changes up to 47ba5f39eab3c2a9a1ba878159a6050f2bbfc0e2:

  ARM: entry: Make asm coproc dispatch code NWFPE only (2023-05-17 15:08:22 +0200)


[0] https://lore.kernel.org/all/20230517212808.3895190-1-ardb@kernel.org/
[1] https://linux.kernelci.org/test/job/ardb/branch/for-kernelci/kernel/arm-vfp-refactor-for-rmk/

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

----------------------------------------------------------------
Refactor VFP support code and reimplement in C

The VFP related changes to permit kernel mode NEON in softirq context
resulted in some issues regarding en/disabling of sofirqs from asm code,
and this made it clear that it would be better to handle more of it from
C code.

Given that we already have infrastructure that associates undefined
instruction exceptions with handler code based on value/mask pairs, we
can easily move the dispatch of VFP and NEON instructions to C code once
we reimplement the actual VFP support routine (which reasons about how
to deal with the exception and whether any emulation is needed) in C
code first.

With those out of the way, we can drop the partial decoding logic in asm
that reasons about which ISA is being used by user space, as the
remaining cases are all 32-bit ARM only. This leaves a FPE specific
routine with some iWMMXT logic that is easily duplicated in C as well,
allowing us to move the FPE asm code into the FPE asm source file, and
out of the shared entry code.

----------------------------------------------------------------
Ard Biesheuvel (8):
      ARM: vfp: Record VFP bounces as perf emulation faults
      ARM: vfp: Remove workaround for Feroceon CPUs
      ARM: vfp: Reimplement VFP exception entry in C code
      ARM: kernel: Get rid of thread_info::used_cp[] array
      ARM: vfp: Use undef hook for handling VFP exceptions
      ARM: entry: Disregard Thumb undef exception in coproc dispatch
      ARM: iwmmxt: Use undef hook to enable coprocessor for task
      ARM: entry: Make asm coproc dispatch code NWFPE only

 arch/arm/include/asm/thread_info.h |  17 ++-
 arch/arm/kernel/asm-offsets.c      |   1 -
 arch/arm/kernel/entry-armv.S       | 254 ++-----------------------------------
 arch/arm/kernel/iwmmxt.S           |  18 ++-
 arch/arm/kernel/pj4-cp0.c          |   1 +
 arch/arm/kernel/process.c          |   1 -
 arch/arm/kernel/ptrace.c           |   2 -
 arch/arm/kernel/xscale-cp0.c       |   1 +
 arch/arm/mm/proc-feroceon.S        |   4 +
 arch/arm/nwfpe/entry.S             |  77 +++++++++++
 arch/arm/vfp/Makefile              |   2 +-
 arch/arm/vfp/entry.S               |  31 -----
 arch/arm/vfp/vfp.h                 |   1 +
 arch/arm/vfp/vfphw.S               | 208 ++----------------------------
 arch/arm/vfp/vfpmodule.c           | 208 +++++++++++++++++++++---------
 15 files changed, 286 insertions(+), 540 deletions(-)
 delete mode 100644 arch/arm/vfp/entry.S

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] ARM: convert VFP exception handling to C code
  2023-05-22  8:03 [GIT PULL] ARM: convert VFP exception handling to C code Ard Biesheuvel
@ 2023-07-19 10:15 ` Ard Biesheuvel
  2023-07-19 10:17   ` Russell King (Oracle)
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2023-07-19 10:15 UTC (permalink / raw)
  To: linux+pull
  Cc: linux-arm-kernel, Linus Walleij, Arnd Bergmann,
	Sebastian Andrzej Siewior

On Mon, 22 May 2023 at 10:03, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Hello Russell,
>
> This pull request covers the outstanding changes related to VFP exception
> handling that I implemented on top of the VFP-in-softirq policy change and
> subsequent fixes. The code changes are identical to the v2 series [0].
>
> With these changes applied, only FPE related undef exceptions are dispatched in
> the old way. Everything else is handled using undef hooks, with all logic
> implemented in C.
>
> I have tested this on a variety of platforms, including Cortex-A8 (using kernel
> mode NEON) and the original Raspberry Pi (which relies on VFP bouncing), as
> well as a host of platforms used in KernelCI [1]. All encountered issues have
> been fixed. One notable configuration that I have not been able to test is FPE,
> as it implies a OABI user space, which I don't have access to.
>
> Please pull.
>

Ping?

>
> The following changes since commit f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6:
>
>   Linux 6.4-rc2 (2023-05-14 12:51:40 -0700)
>
> are available in the Git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git tags/arm-vfp-refactor-for-rmk
>
> for you to fetch changes up to 47ba5f39eab3c2a9a1ba878159a6050f2bbfc0e2:
>
>   ARM: entry: Make asm coproc dispatch code NWFPE only (2023-05-17 15:08:22 +0200)
>
>
> [0] https://lore.kernel.org/all/20230517212808.3895190-1-ardb@kernel.org/
> [1] https://linux.kernelci.org/test/job/ardb/branch/for-kernelci/kernel/arm-vfp-refactor-for-rmk/
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> ----------------------------------------------------------------
> Refactor VFP support code and reimplement in C
>
> The VFP related changes to permit kernel mode NEON in softirq context
> resulted in some issues regarding en/disabling of sofirqs from asm code,
> and this made it clear that it would be better to handle more of it from
> C code.
>
> Given that we already have infrastructure that associates undefined
> instruction exceptions with handler code based on value/mask pairs, we
> can easily move the dispatch of VFP and NEON instructions to C code once
> we reimplement the actual VFP support routine (which reasons about how
> to deal with the exception and whether any emulation is needed) in C
> code first.
>
> With those out of the way, we can drop the partial decoding logic in asm
> that reasons about which ISA is being used by user space, as the
> remaining cases are all 32-bit ARM only. This leaves a FPE specific
> routine with some iWMMXT logic that is easily duplicated in C as well,
> allowing us to move the FPE asm code into the FPE asm source file, and
> out of the shared entry code.
>
> ----------------------------------------------------------------
> Ard Biesheuvel (8):
>       ARM: vfp: Record VFP bounces as perf emulation faults
>       ARM: vfp: Remove workaround for Feroceon CPUs
>       ARM: vfp: Reimplement VFP exception entry in C code
>       ARM: kernel: Get rid of thread_info::used_cp[] array
>       ARM: vfp: Use undef hook for handling VFP exceptions
>       ARM: entry: Disregard Thumb undef exception in coproc dispatch
>       ARM: iwmmxt: Use undef hook to enable coprocessor for task
>       ARM: entry: Make asm coproc dispatch code NWFPE only
>
>  arch/arm/include/asm/thread_info.h |  17 ++-
>  arch/arm/kernel/asm-offsets.c      |   1 -
>  arch/arm/kernel/entry-armv.S       | 254 ++-----------------------------------
>  arch/arm/kernel/iwmmxt.S           |  18 ++-
>  arch/arm/kernel/pj4-cp0.c          |   1 +
>  arch/arm/kernel/process.c          |   1 -
>  arch/arm/kernel/ptrace.c           |   2 -
>  arch/arm/kernel/xscale-cp0.c       |   1 +
>  arch/arm/mm/proc-feroceon.S        |   4 +
>  arch/arm/nwfpe/entry.S             |  77 +++++++++++
>  arch/arm/vfp/Makefile              |   2 +-
>  arch/arm/vfp/entry.S               |  31 -----
>  arch/arm/vfp/vfp.h                 |   1 +
>  arch/arm/vfp/vfphw.S               | 208 ++----------------------------
>  arch/arm/vfp/vfpmodule.c           | 208 +++++++++++++++++++++---------
>  15 files changed, 286 insertions(+), 540 deletions(-)
>  delete mode 100644 arch/arm/vfp/entry.S

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] ARM: convert VFP exception handling to C code
  2023-07-19 10:15 ` Ard Biesheuvel
@ 2023-07-19 10:17   ` Russell King (Oracle)
  2023-07-19 10:20     ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King (Oracle) @ 2023-07-19 10:17 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-arm-kernel, Linus Walleij, Arnd Bergmann,
	Sebastian Andrzej Siewior

On Wed, Jul 19, 2023 at 12:15:10PM +0200, Ard Biesheuvel wrote:
> On Mon, 22 May 2023 at 10:03, Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > Hello Russell,
> >
> > This pull request covers the outstanding changes related to VFP exception
> > handling that I implemented on top of the VFP-in-softirq policy change and
> > subsequent fixes. The code changes are identical to the v2 series [0].
> >
> > With these changes applied, only FPE related undef exceptions are dispatched in
> > the old way. Everything else is handled using undef hooks, with all logic
> > implemented in C.
> >
> > I have tested this on a variety of platforms, including Cortex-A8 (using kernel
> > mode NEON) and the original Raspberry Pi (which relies on VFP bouncing), as
> > well as a host of platforms used in KernelCI [1]. All encountered issues have
> > been fixed. One notable configuration that I have not been able to test is FPE,
> > as it implies a OABI user space, which I don't have access to.
> >
> > Please pull.
> >
> 
> Ping?

I pulled it before heading away on holiday:

http://git.armlinux.org.uk/cgit/linux-arm.git/log/?h=devel-stable

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] ARM: convert VFP exception handling to C code
  2023-07-19 10:17   ` Russell King (Oracle)
@ 2023-07-19 10:20     ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2023-07-19 10:20 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: linux-arm-kernel, Linus Walleij, Arnd Bergmann,
	Sebastian Andrzej Siewior

On Wed, 19 Jul 2023 at 12:18, Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
>
> On Wed, Jul 19, 2023 at 12:15:10PM +0200, Ard Biesheuvel wrote:
> > On Mon, 22 May 2023 at 10:03, Ard Biesheuvel <ardb@kernel.org> wrote:
> > >
> > > Hello Russell,
> > >
> > > This pull request covers the outstanding changes related to VFP exception
> > > handling that I implemented on top of the VFP-in-softirq policy change and
> > > subsequent fixes. The code changes are identical to the v2 series [0].
> > >
> > > With these changes applied, only FPE related undef exceptions are dispatched in
> > > the old way. Everything else is handled using undef hooks, with all logic
> > > implemented in C.
> > >
> > > I have tested this on a variety of platforms, including Cortex-A8 (using kernel
> > > mode NEON) and the original Raspberry Pi (which relies on VFP bouncing), as
> > > well as a host of platforms used in KernelCI [1]. All encountered issues have
> > > been fixed. One notable configuration that I have not been able to test is FPE,
> > > as it implies a OABI user space, which I don't have access to.
> > >
> > > Please pull.
> > >
> >
> > Ping?
>
> I pulled it before heading away on holiday:
>
> http://git.armlinux.org.uk/cgit/linux-arm.git/log/?h=devel-stable
>

Ah excellent - thanks.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-19 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22  8:03 [GIT PULL] ARM: convert VFP exception handling to C code Ard Biesheuvel
2023-07-19 10:15 ` Ard Biesheuvel
2023-07-19 10:17   ` Russell King (Oracle)
2023-07-19 10:20     ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).