linux-stable/include
Thomas Gleixner 660fd04f93 lib/vdso: Prepare for time namespace support
To support time namespaces in the vdso with a minimal impact on regular non
time namespace affected tasks, the namespace handling needs to be hidden in
a slow path.

The most obvious place is vdso_seq_begin(). 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.

If VDSO time namespace support is disabled the whole magic is compiled out.

Initial testing shows that the disabled case is almost identical to the
host case which does not take the slow timens path. With the special timens
page installed the performance hit is constant time and in the range of
5-7%.

For the vdso functions which are not using the sequence count an
unconditional check for vdso_data->clock_mode is added which switches to
the real vdso when the clock_mode is VCLOCK_TIMENS.

[avagin: Make do_hres_timens() work with raw clocks too: choose vdso_data
 pointer by CS_RAW offset.]

Suggested-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20191112012724.250792-21-dima@arista.com
2020-01-14 12:20:57 +01:00
..
acpi
asm-generic powerpc updates for 5.5 #2 2019-12-06 13:36:31 -08:00
clocksource
crypto
drm
dt-bindings ARM: Device-tree updates 2019-12-05 12:09:47 -08:00
keys
kunit
kvm
linux lib/vdso: Prepare for time namespace support 2020-01-14 12:20:57 +01:00
math-emu
media
misc
net net/sched: add delete_empty() to filters and use it in cls_flower 2019-12-30 20:35:19 -08:00
pcmcia
ras
rdma IB/core: Introduce rdma_user_mmap_entry_insert_range() API 2019-12-12 16:55:36 -05:00
scsi
soc drm msm + fixes for 5.5-rc1 2019-12-06 10:28:09 -08:00
sound ASoC: Fixes for v5.5 2019-12-17 14:18:32 +01:00
target
trace This is a relatively quiet cycle for nfsd, mainly various bugfixes. 2019-12-07 16:56:00 -08:00
uapi ns: Introduce Time Namespace 2020-01-14 12:20:48 +01:00
vdso lib/vdso: Prepare for time namespace support 2020-01-14 12:20:57 +01:00
video
xen xen/interface: re-define FRONT/BACK_RING_ATTACH() 2019-12-20 13:44:42 +01:00