[LTP] [PATCH 0/3] checkpoint: Refactor and unify shell/C reinit support

Li Wang liwang@redhat.com
Fri Jun 27 11:25:39 CEST 2025


On Fri, Jun 27, 2025 at 3:49 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > I think that the root of the problem is that the shell function
> > > _tst_init_checkpoints() does not create the IPC region with the magic.
> > >
> > > What about this patch:
> > >
> > > diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> > > index c32bd8b19..a310d3922 100644
> > > --- a/testcases/lib/tst_test.sh
> > > +++ b/testcases/lib/tst_test.sh
> > > @@ -627,6 +627,7 @@ _tst_init_checkpoints()
> > >                 tst_brk TBROK "tst_getconf PAGESIZE failed"
> > >         fi
> > >         ROD_SILENT dd if=/dev/zero of="$LTP_IPC_PATH" bs="$pagesize"
> > > count=1
> > > +       ROD_SILENT printf LTPM | dd of="$LTP_IPC_PATH" bs=1 seek=0
> > > conv=notrunc
> > >
> >
> > No, I'm afraid this won't work as expected.
> >
> > The PEC failure wasn't caused by the shell checkpoint missing the "LTPM"
> > magic. Instead, the root cause was that the reinitialization logic
> > (tst_reinit())
> > expected a different IPC format.
>
> I do not think so, both the PEC C helpers and the tst_checkpoint.c call
> tst_reinit() so as long as the function succeeds the memory layout will
> be the same. The checkpoints will start at some offset in the page of
> the IPC memory, but that was always the case.
>
> And it turns out that the patch I've send yesterday does not work
> because of endianity. The magic in the IPC region is MPTL on little
> endian.
>

The endianity issue sounds reasonable, I thought about it a bit and tested
it on my x86_64/s390x, it turns out you're right, tst_checkpoint.c uses
tst_reinit() to make the IPC layout work for shell tests as well.

My new tst_checkpoint_reinit method is actually a bit more complicated,
requiring the introduction of two separate IPCs for C and shell.
This is somewhat unnecessary.

So, will you send a new patch (or I do that in my next version)?


-- 
Regards,
Li Wang


More information about the ltp mailing list