mbox series

[0/2] sched/membarrier, selftests: Introduce MEMBARRIER_CMD_GET_REGISTRATIONS

Message ID 20221207164338.1535591-1-mclapinski@google.com (mailing list archive)
Headers show
Series sched/membarrier, selftests: Introduce MEMBARRIER_CMD_GET_REGISTRATIONS | expand

Message

Michal Clapinski Dec. 7, 2022, 4:43 p.m. UTC
This change provides a method to query previously issued registrations.
It's needed for CRIU (checkpoint/restore in userspace). Before this
change we had to issue private membarrier commands during checkpoint -
if they succeeded, they must have been registered. Unfortunately global
membarrier succeeds even on unregistered processes, so there was no way to
tell if MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED had been issued or not.

CRIU is run after the process has been frozen with ptrace, so we don't
have to worry too much about the result of running this command in parallel
with registration commands.

Michal Clapinski (2):
  sched/membarrier: Introduce MEMBARRIER_CMD_GET_REGISTRATIONS
  selftests/membarrier: Test MEMBARRIER_CMD_GET_REGISTRATIONS

 include/uapi/linux/membarrier.h               |  4 ++
 kernel/sched/membarrier.c                     | 39 ++++++++++++++++++-
 .../membarrier/membarrier_test_impl.h         | 33 ++++++++++++++++
 .../membarrier/membarrier_test_multi_thread.c |  2 +-
 .../membarrier_test_single_thread.c           |  6 ++-
 5 files changed, 81 insertions(+), 3 deletions(-)

Comments

Mathieu Desnoyers Dec. 22, 2022, 3:28 p.m. UTC | #1
On 2022-12-07 11:43, Michal Clapinski wrote:
> This change provides a method to query previously issued registrations.
> It's needed for CRIU (checkpoint/restore in userspace). Before this
> change we had to issue private membarrier commands during checkpoint -
> if they succeeded, they must have been registered. Unfortunately global
> membarrier succeeds even on unregistered processes, so there was no way to
> tell if MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED had been issued or not.
> 
> CRIU is run after the process has been frozen with ptrace, so we don't
> have to worry too much about the result of running this command in parallel
> with registration commands.

Peter, Paul, I'm OK with the proposed changes. Should we route this 
through sched/core from the tip tree ?

For both patches:

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Thanks,

Mathieu

> 
> Michal Clapinski (2):
>    sched/membarrier: Introduce MEMBARRIER_CMD_GET_REGISTRATIONS
>    selftests/membarrier: Test MEMBARRIER_CMD_GET_REGISTRATIONS
> 
>   include/uapi/linux/membarrier.h               |  4 ++
>   kernel/sched/membarrier.c                     | 39 ++++++++++++++++++-
>   .../membarrier/membarrier_test_impl.h         | 33 ++++++++++++++++
>   .../membarrier/membarrier_test_multi_thread.c |  2 +-
>   .../membarrier_test_single_thread.c           |  6 ++-
>   5 files changed, 81 insertions(+), 3 deletions(-)
>
Paul E. McKenney Dec. 23, 2022, 1:05 a.m. UTC | #2
On Thu, Dec 22, 2022 at 10:28:28AM -0500, Mathieu Desnoyers wrote:
> On 2022-12-07 11:43, Michal Clapinski wrote:
> > This change provides a method to query previously issued registrations.
> > It's needed for CRIU (checkpoint/restore in userspace). Before this
> > change we had to issue private membarrier commands during checkpoint -
> > if they succeeded, they must have been registered. Unfortunately global
> > membarrier succeeds even on unregistered processes, so there was no way to
> > tell if MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED had been issued or not.
> > 
> > CRIU is run after the process has been frozen with ptrace, so we don't
> > have to worry too much about the result of running this command in parallel
> > with registration commands.
> 
> Peter, Paul, I'm OK with the proposed changes. Should we route this through
> sched/core from the tip tree ?
> 
> For both patches:
> 
> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Also for both patches:

Acked-by: Paul E. McKenney <paulmck@kernel.org>

> Thanks,
> 
> Mathieu
> 
> > 
> > Michal Clapinski (2):
> >    sched/membarrier: Introduce MEMBARRIER_CMD_GET_REGISTRATIONS
> >    selftests/membarrier: Test MEMBARRIER_CMD_GET_REGISTRATIONS
> > 
> >   include/uapi/linux/membarrier.h               |  4 ++
> >   kernel/sched/membarrier.c                     | 39 ++++++++++++++++++-
> >   .../membarrier/membarrier_test_impl.h         | 33 ++++++++++++++++
> >   .../membarrier/membarrier_test_multi_thread.c |  2 +-
> >   .../membarrier_test_single_thread.c           |  6 ++-
> >   5 files changed, 81 insertions(+), 3 deletions(-)
> > 
> 
> -- 
> Mathieu Desnoyers
> EfficiOS Inc.
> https://www.efficios.com
>