mbox series

[0/3] arm64: cleanup DAIF handling for EL0 returns

Message ID 20240206123848.1696480-1-mark.rutland@arm.com (mailing list archive)
Headers show
Series arm64: cleanup DAIF handling for EL0 returns | expand

Message

Mark Rutland Feb. 6, 2024, 12:38 p.m. UTC
Hi,

These patches rework DAIF handling when returning to EL0, simplifiying
the logic in do_notify_resume() and allowing Debug + SError to be
unmasked for a little longer during exception return.

My primary motivation for these changes is to centralize entry/exit DAIF
management within entry-common.c, as this will allow entry/exit
sequences to be specialised, and make it much easier to add support for
FEAT_NMI. With specialized entry DAIF management, it will also be
possible to simplify local_daif_{save,restore}() and
local_irq_{save,restore}().

I'm sending this out on its own as (IMO) it's a nice cleanup on its own,
and I don't believe that I'll have the remainder of the DAIF rework
ready for this cycle.

The series is based on v6.8-rc3.

Mark.

Mark Rutland (3):
  arm64: Simplify do_notify_resume() DAIF masking
  arm64: Move do_notify_resume() to entry-common.c
  arm64: Unmask Debug + SError in do_notify_resume()

 arch/arm64/include/asm/exception.h |  2 +-
 arch/arm64/kernel/entry-common.c   | 36 ++++++++++++++++++++++++++-
 arch/arm64/kernel/signal.c         | 39 ++----------------------------
 3 files changed, 38 insertions(+), 39 deletions(-)

Comments

Itaru Kitayama Feb. 8, 2024, 2:28 a.m. UTC | #1
On Tue, Feb 06, 2024 at 12:38:45PM +0000, Mark Rutland wrote:
> Hi,
> 
> These patches rework DAIF handling when returning to EL0, simplifiying
> the logic in do_notify_resume() and allowing Debug + SError to be
> unmasked for a little longer during exception return.
> 
> My primary motivation for these changes is to centralize entry/exit DAIF
> management within entry-common.c, as this will allow entry/exit
> sequences to be specialised, and make it much easier to add support for
> FEAT_NMI. With specialized entry DAIF management, it will also be
> possible to simplify local_daif_{save,restore}() and
> local_irq_{save,restore}().
> 
> I'm sending this out on its own as (IMO) it's a nice cleanup on its own,
> and I don't believe that I'll have the remainder of the DAIF rework
> ready for this cycle.
> 
> The series is based on v6.8-rc3.
> 
> Mark.
> 
> Mark Rutland (3):
>   arm64: Simplify do_notify_resume() DAIF masking
>   arm64: Move do_notify_resume() to entry-common.c
>   arm64: Unmask Debug + SError in do_notify_resume()
> 
>  arch/arm64/include/asm/exception.h |  2 +-
>  arch/arm64/kernel/entry-common.c   | 36 ++++++++++++++++++++++++++-
>  arch/arm64/kernel/signal.c         | 39 ++----------------------------
>  3 files changed, 38 insertions(+), 39 deletions(-)

Boot tested on RevC FVP and kselftest arm64 subcategory runs without an error
on RevC FVP too.

Itaru.

> 
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Mark Rutland Feb. 8, 2024, 12:38 p.m. UTC | #2
On Thu, Feb 08, 2024 at 11:28:32AM +0900, Itaru Kitayama wrote:
> On Tue, Feb 06, 2024 at 12:38:45PM +0000, Mark Rutland wrote:
> > Hi,
> > 
> > These patches rework DAIF handling when returning to EL0, simplifiying
> > the logic in do_notify_resume() and allowing Debug + SError to be
> > unmasked for a little longer during exception return.
> > 
> > My primary motivation for these changes is to centralize entry/exit DAIF
> > management within entry-common.c, as this will allow entry/exit
> > sequences to be specialised, and make it much easier to add support for
> > FEAT_NMI. With specialized entry DAIF management, it will also be
> > possible to simplify local_daif_{save,restore}() and
> > local_irq_{save,restore}().
> > 
> > I'm sending this out on its own as (IMO) it's a nice cleanup on its own,
> > and I don't believe that I'll have the remainder of the DAIF rework
> > ready for this cycle.
> > 
> > The series is based on v6.8-rc3.
> > 
> > Mark.
> > 
> > Mark Rutland (3):
> >   arm64: Simplify do_notify_resume() DAIF masking
> >   arm64: Move do_notify_resume() to entry-common.c
> >   arm64: Unmask Debug + SError in do_notify_resume()
> > 
> >  arch/arm64/include/asm/exception.h |  2 +-
> >  arch/arm64/kernel/entry-common.c   | 36 ++++++++++++++++++++++++++-
> >  arch/arm64/kernel/signal.c         | 39 ++----------------------------
> >  3 files changed, 38 insertions(+), 39 deletions(-)
> 
> Boot tested on RevC FVP and kselftest arm64 subcategory runs without an error
> on RevC FVP too.

Thanks for testing! Would you be happy for that to imply a tested-by tag, e.g.

  Tested-by: Itaru Kitayama <itaru.kitayama@linux.dev>

... ?

Mark.
Itaru Kitayama Feb. 8, 2024, 8:53 p.m. UTC | #3
On Thu, Feb 08, 2024 at 12:38:12PM +0000, Mark Rutland wrote:
> On Thu, Feb 08, 2024 at 11:28:32AM +0900, Itaru Kitayama wrote:
> > On Tue, Feb 06, 2024 at 12:38:45PM +0000, Mark Rutland wrote:
> > > Hi,
> > > 
> > > These patches rework DAIF handling when returning to EL0, simplifiying
> > > the logic in do_notify_resume() and allowing Debug + SError to be
> > > unmasked for a little longer during exception return.
> > > 
> > > My primary motivation for these changes is to centralize entry/exit DAIF
> > > management within entry-common.c, as this will allow entry/exit
> > > sequences to be specialised, and make it much easier to add support for
> > > FEAT_NMI. With specialized entry DAIF management, it will also be
> > > possible to simplify local_daif_{save,restore}() and
> > > local_irq_{save,restore}().
> > > 
> > > I'm sending this out on its own as (IMO) it's a nice cleanup on its own,
> > > and I don't believe that I'll have the remainder of the DAIF rework
> > > ready for this cycle.
> > > 
> > > The series is based on v6.8-rc3.
> > > 
> > > Mark.
> > > 
> > > Mark Rutland (3):
> > >   arm64: Simplify do_notify_resume() DAIF masking
> > >   arm64: Move do_notify_resume() to entry-common.c
> > >   arm64: Unmask Debug + SError in do_notify_resume()
> > > 
> > >  arch/arm64/include/asm/exception.h |  2 +-
> > >  arch/arm64/kernel/entry-common.c   | 36 ++++++++++++++++++++++++++-
> > >  arch/arm64/kernel/signal.c         | 39 ++----------------------------
> > >  3 files changed, 38 insertions(+), 39 deletions(-)
> > 
> > Boot tested on RevC FVP and kselftest arm64 subcategory runs without an error
> > on RevC FVP too.
> 
> Thanks for testing! Would you be happy for that to imply a tested-by tag, e.g.
> 
>   Tested-by: Itaru Kitayama <itaru.kitayama@linux.dev>
> 
> ... ?

If it's worth it, yes please.

Thanks,
Itaru.
> 
> Mark.
Catalin Marinas Feb. 20, 2024, 6:19 p.m. UTC | #4
On Tue, 06 Feb 2024 12:38:45 +0000, Mark Rutland wrote:
> These patches rework DAIF handling when returning to EL0, simplifiying
> the logic in do_notify_resume() and allowing Debug + SError to be
> unmasked for a little longer during exception return.
> 
> My primary motivation for these changes is to centralize entry/exit DAIF
> management within entry-common.c, as this will allow entry/exit
> sequences to be specialised, and make it much easier to add support for
> FEAT_NMI. With specialized entry DAIF management, it will also be
> possible to simplify local_daif_{save,restore}() and
> local_irq_{save,restore}().
> 
> [...]

Applied to arm64 (for-next/daif-cleanup), thanks!

[1/3] arm64: Simplify do_notify_resume() DAIF masking
      https://git.kernel.org/arm64/c/270de609ae2a
[2/3] arm64: Move do_notify_resume() to entry-common.c
      https://git.kernel.org/arm64/c/997d79eb938e
[3/3] arm64: Unmask Debug + SError in do_notify_resume()
      https://git.kernel.org/arm64/c/97d935faacde