[GSoC] Make vkernels checkpointable - week 1

Pawel Dziepak pdziepak at quarnos.org
Sun Jun 23 18:13:53 PDT 2013


This week I was working on checkpointing processes with more than one
thread. First step was to save and restore each thread's TLS
information. This data is saved in ELF note of owner "DragonFly" and
type NT_DRAGONFLY_TLS (value: 0x1000). High value of note type is
required in order not to being it misinterpreted, since some values
are interpreted regardless of note owner.

At this point I also solved some already existing problems with the
checkpointing problems. First of all, number of threads is computed
using the size of notes section, but the computation didn't include
the size of notes headers. Also, using "DragonFly" as note owner
exposed an issue with note's data alignment. ELF specification clearly
states that all fields in note header are 8-byte aligned and that's
what the code that read notes assumed. Unfortunately, that isn't true
and all implementations (including DragonFly core dump code) use 4-bit
alignment regardless of the CPU word size.

Lastly, I introduced two new functions {fill,set}_savetls() which save
and restore TLS descriptors. set_savetls() also has to call
set_user_TLS() for the current thread since syscall exit routine does
not restore TLS, thus newly set TLS would'n take effect when thawing
is done. No additional work was needed in case of other threads since
thread switch routine already reinstalls TLS.

Currently, checkpointing threaded applications seems to be working
very well. I still need to save and restore thread's signal masks
(should be fairly easy) and do more tests (especially under vkernels).
According to my initial timeline I have a whole week for that but I
think (and hope) that I will manage to get this done earlier.


More information about the Kernel mailing list