2021-10-18 14:48:51

by Nicolas Saenz Julienne

[permalink] [raw]
Subject: [PATCH] arm64: Select POSIX_CPU_TIMERS_TASK_WORK

With 6caa5812e2d1 ("KVM: arm64: Use generic KVM xfer to guest work
function") all arm64 exit paths are properly equipped to handle the
POSIX timers' task work.

Deferring timer callbacks to thread context, not only limits the amount
of time spent in hard interrupt context, but is a safer
implementation[1], and will allow PREEMPT_RT setups to use KVM[2].

So let's enable POSIX_CPU_TIMERS_TASK_WORK on arm64.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.spinics.net/lists/linux-rt-users/msg24860.html
Signed-off-by: Nicolas Saenz Julienne <[email protected]>

---

This was tested by running all relevant kernel timer self-tests and
making sure KVM still works as expected.

arch/arm64/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 789036cf74f5..ce0d0d254542 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -191,6 +191,7 @@ config ARM64
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
select HAVE_REGS_AND_STACK_ACCESS_API
+ select HAVE_POSIX_CPU_TIMERS_TASK_WORK
select HAVE_FUNCTION_ARG_ACCESS_API
select HAVE_FUTEX_CMPXCHG if FUTEX
select MMU_GATHER_RCU_TABLE_FREE
--
2.32.0


2021-10-27 21:24:52

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH] arm64: Select POSIX_CPU_TIMERS_TASK_WORK

On Wed, 27 Oct 2021 12:26:58 +0100,
Mark Rutland <[email protected]> wrote:
>
> [adding Marc Z to Cc, since this affects KVM]
>
> On Mon, Oct 18, 2021 at 04:47:13PM +0200, Nicolas Saenz Julienne wrote:
> > With 6caa5812e2d1 ("KVM: arm64: Use generic KVM xfer to guest work
> > function") all arm64 exit paths are properly equipped to handle the
> > POSIX timers' task work.
> >
> > Deferring timer callbacks to thread context, not only limits the amount
> > of time spent in hard interrupt context, but is a safer
> > implementation[1], and will allow PREEMPT_RT setups to use KVM[2].
> >
> > So let's enable POSIX_CPU_TIMERS_TASK_WORK on arm64.
> >
> > [1] https://lore.kernel.org/all/[email protected]/
> > [2] https://www.spinics.net/lists/linux-rt-users/msg24860.html
>
> Trivial nit: could we please make that second link:
>
> https://lore.kernel.org/linux-rt-users/87v92bdnlx.ffs@tglx/
>
> > Signed-off-by: Nicolas Saenz Julienne <[email protected]>
>
> Regardless, this makes sense to me, and given you've tested it:
>
> Acked-by: Mark Rutland <[email protected]>
>
> Thanks,
> Mark.
>
> >
> > ---
> >
> > This was tested by running all relevant kernel timer self-tests and
> > making sure KVM still works as expected.
> >
> > arch/arm64/Kconfig | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > index 789036cf74f5..ce0d0d254542 100644
> > --- a/arch/arm64/Kconfig
> > +++ b/arch/arm64/Kconfig
> > @@ -191,6 +191,7 @@ config ARM64
> > select HAVE_PERF_REGS
> > select HAVE_PERF_USER_STACK_DUMP
> > select HAVE_REGS_AND_STACK_ACCESS_API
> > + select HAVE_POSIX_CPU_TIMERS_TASK_WORK
> > select HAVE_FUNCTION_ARG_ACCESS_API
> > select HAVE_FUTEX_CMPXCHG if FUTEX
> > select MMU_GATHER_RCU_TABLE_FREE

Looks reasonable to me.

Acked-by: Marc Zyngier <[email protected]>

M.

--
Without deviation from the norm, progress is not possible.

2021-10-27 22:27:26

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH] arm64: Select POSIX_CPU_TIMERS_TASK_WORK

[adding Marc Z to Cc, since this affects KVM]

On Mon, Oct 18, 2021 at 04:47:13PM +0200, Nicolas Saenz Julienne wrote:
> With 6caa5812e2d1 ("KVM: arm64: Use generic KVM xfer to guest work
> function") all arm64 exit paths are properly equipped to handle the
> POSIX timers' task work.
>
> Deferring timer callbacks to thread context, not only limits the amount
> of time spent in hard interrupt context, but is a safer
> implementation[1], and will allow PREEMPT_RT setups to use KVM[2].
>
> So let's enable POSIX_CPU_TIMERS_TASK_WORK on arm64.
>
> [1] https://lore.kernel.org/all/[email protected]/
> [2] https://www.spinics.net/lists/linux-rt-users/msg24860.html

Trivial nit: could we please make that second link:

https://lore.kernel.org/linux-rt-users/87v92bdnlx.ffs@tglx/

> Signed-off-by: Nicolas Saenz Julienne <[email protected]>

Regardless, this makes sense to me, and given you've tested it:

Acked-by: Mark Rutland <[email protected]>

Thanks,
Mark.

>
> ---
>
> This was tested by running all relevant kernel timer self-tests and
> making sure KVM still works as expected.
>
> arch/arm64/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 789036cf74f5..ce0d0d254542 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -191,6 +191,7 @@ config ARM64
> select HAVE_PERF_REGS
> select HAVE_PERF_USER_STACK_DUMP
> select HAVE_REGS_AND_STACK_ACCESS_API
> + select HAVE_POSIX_CPU_TIMERS_TASK_WORK
> select HAVE_FUNCTION_ARG_ACCESS_API
> select HAVE_FUTEX_CMPXCHG if FUTEX
> select MMU_GATHER_RCU_TABLE_FREE
> --
> 2.32.0
>

2021-10-28 09:23:12

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH] arm64: Select POSIX_CPU_TIMERS_TASK_WORK

On Mon, 18 Oct 2021 16:47:13 +0200, Nicolas Saenz Julienne wrote:
> With 6caa5812e2d1 ("KVM: arm64: Use generic KVM xfer to guest work
> function") all arm64 exit paths are properly equipped to handle the
> POSIX timers' task work.
>
> Deferring timer callbacks to thread context, not only limits the amount
> of time spent in hard interrupt context, but is a safer
> implementation[1], and will allow PREEMPT_RT setups to use KVM[2].
>
> [...]

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

[1/1] arm64: Select POSIX_CPU_TIMERS_TASK_WORK
https://git.kernel.org/arm64/c/a68773bd32d9

Cheers,
--
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev