Skip to content

arm64: add the time namespace support

Andrei Vagin linux-arm-kernel lkml 6 versions – Applied

Status from this message: Applied to arm64 (for-next/timens), provisionally.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest6 patches 13 repliesApplied
  2. v46 patches 7 repliesSuperseded
  3. v3 posting 2/26 patches 4 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v3 posting 1/26 patches3 repliesSuperseded
v26 patches18 repliesSuperseded
v15 patches10 repliesSuperseded

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/6arm64/vdso: use the fault callback to map vvar pagesarch/arm64/kernel/vdso.c+15 -102 replies
2/6arm64/vdso: Zap vvar pages when switching to a time namespacearch/arm64/kernel/vdso.c+31 -02 replies
3/6arm64/vdso: Add time namespace pagearch/arm64/include/asm/vdso.h arch/arm64/include/asm/vdso/compat_gettimeofday.h arch/arm64/include/asm/vdso/gettimeofday.h +4 more+47 -50 replies
4/6arm64/vdso: Handle faults on timens pagearch/arm64/kernel/vdso.c+53 -40 replies
5/6arm64/vdso: Restrict splitting VVAR VMAarch/arm64/kernel/vdso.c+13 -00 replies
6/6arm64: enable time namespace supportarch/arm64/Kconfig+1 -00 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchVincenzo FrascinoDmitry SafonovChristian Brauner
SeriesR-b R-b
1/6R-b R-b
2/6R-b R-b R-b
3/6R-b R-b
4/6R-b R-b
5/6R-b R-b
6/6R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/6] arm64: add the time namespace support

Allocate the time namespace page among VVAR pages and add the logic to handle faults on VVAR properly.

If a task belongs to a time namespace then the VVAR page which contains the system wide VDSO data is replaced with a namespace specific page which has the same layout as the VVAR page. That page has vdso_data->seq set to 1 to enforce the slow path and vdso_data->clock_mode set to VCLOCK_TIMENS to enforce the time namespace handling path.

The extra check in the case that vdso_data->seq is odd, e.g. a concurrent update of the VDSO data is in progress, is not really affecting regular tasks which are not part of a time namespace as the task is spin waiting for the update to finish and vdso_data->seq to become even again.

If a time namespace task hits that code path, it invokes the corresponding time getter function which retrieves the real VVAR page, reads host time and then adds the offset for the requested clock which is stored in the special VVAR page.

v2: Code cleanups suggested by Vincenzo.
v3: add a comment in __arch_get_timens_vdso_data.
v4: - fix an issue reported by the lkp robot.
- vvar has the same size with/without CONFIG_TIME_NAMESPACE, but the timens page isn't allocated on !CONFIG_TIME_NAMESPACE. This simplifies criu/vdso migration between different kernel configs.
v5: - Code cleanups suggested by Mark Rutland.
- In vdso_join_timens, mmap_write_lock is downgraded to mmap_read_lock. The VMA list isn't changed there, zap_page_range doesn't require mmap_write_lock.

v5 on github (if someone prefers git pull to git am):
https://github.com/avagin/linux-task-diag/tree/arm64/timens-v5

Andrei Vagin (6):
arm64/vdso: use the fault callback to map vvar pages arm64/vdso: Zap vvar pages when switching to a time namespace arm64/vdso: Add time namespace page
arm64/vdso: Handle faults on timens page arm64/vdso: Restrict splitting VVAR VMA
arm64: enable time namespace support

--
2.24.1