• D
    x86/vdso: Add time napespace page · 550a77a7
    Dmitry Safonov 提交于
    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.
    
    Allocate the time namespace page among VVAR pages and place vdso_data on
    it.  Provide __arch_get_timens_vdso_data() helper for VDSO code to get the
    code-relative position of VVARs on that special page.
    Co-developed-by: NAndrei Vagin <avagin@openvz.org>
    Signed-off-by: NAndrei Vagin <avagin@openvz.org>
    Signed-off-by: NDmitry Safonov <dima@arista.com>
    Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20191112012724.250792-23-dima@arista.com
    
    550a77a7
Kconfig 96.7 KB