alistair23-linux/include/vdso
Andrei Vagin 3503d56cc7 arm64/vdso: Add time namespace page
Allocate the time namespace page among VVAR pages.  Provide
__arch_get_timens_vdso_data() helper for VDSO code to get the
code-relative position of VVARs on that special page.

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.

The time-namespace page isn't allocated on !CONFIG_TIME_NAMESPACE, but
vma is the same size, which simplifies criu/vdso migration between
different kernel configs.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Dmitry Safonov <dima@arista.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20200624083321.144975-4-avagin@gmail.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2020-07-24 13:15:20 +01:00
..
bits.h linux/bits.h: Extract common header for vDSO 2020-03-21 15:23:53 +01:00
clocksource.h vdso: Fix clocksource.h macro detection 2020-03-23 18:51:08 +01:00
const.h linux/const.h: Extract common header for vDSO 2020-03-21 15:23:53 +01:00
datapage.h arm64/vdso: Add time namespace page 2020-07-24 13:15:20 +01:00
helpers.h lib/vdso: Add unlikely() hint into vdso_read_begin() 2020-01-14 12:20:47 +01:00
jiffies.h linux/jiffies.h: Extract common header for vDSO 2020-03-21 15:23:58 +01:00
ktime.h linux/ktime.h: Extract common header for vDSO 2020-03-21 15:23:59 +01:00
limits.h linux/limits.h: Extract common header for vDSO 2020-03-21 15:23:54 +01:00
math64.h linux/math64.h: Extract common header for vDSO 2020-03-21 15:23:56 +01:00
processor.h common: Introduce processor.h 2020-03-21 15:23:59 +01:00
time.h linux/time.h: Extract common header for vDSO 2020-03-21 15:23:57 +01:00
time32.h linux/time32.h: Extract common header for vDSO 2020-03-21 15:23:57 +01:00
time64.h linux/time64.h: Extract common header for vDSO 2020-03-21 15:23:58 +01:00
vsyscall.h timekeeping: Provide a generic update_vsyscall() implementation 2019-06-22 21:21:06 +02:00