lkml.org 
[lkml]   [2018]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [patch 02/11] x86/time: Implement clocksource_arch_init()
    Date
    Thomas Gleixner <tglx@linutronix.de> writes:

    > Runtime validate the VCLOCK_MODE in clocksource::archdata and disable
    > VCLOCK if invalid, which disables the VDSO but keeps the system running.
    >
    > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    > ---
    > arch/x86/Kconfig | 1 +
    > arch/x86/kernel/time.c | 16 ++++++++++++++++
    > 2 files changed, 17 insertions(+)
    >
    > --- a/arch/x86/Kconfig
    > +++ b/arch/x86/Kconfig
    > @@ -48,6 +48,7 @@ config X86
    > select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
    > select ANON_INODES
    > select ARCH_CLOCKSOURCE_DATA
    > + select ARCH_CLOCKSOURCE_INIT
    > select ARCH_DISCARD_MEMBLOCK
    > select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
    > select ARCH_HAS_DEBUG_VIRTUAL
    > --- a/arch/x86/kernel/time.c
    > +++ b/arch/x86/kernel/time.c
    > @@ -10,6 +10,7 @@
    > *
    > */
    >
    > +#include <linux/clocksource.h>
    > #include <linux/clockchips.h>
    > #include <linux/interrupt.h>
    > #include <linux/irq.h>
    > @@ -105,3 +106,18 @@ void __init time_init(void)
    > {
    > late_time_init = x86_late_time_init;
    > }
    > +
    > +/*
    > + * Sanity check the vdso related archdata content.
    > + */
    > +void clocksource_arch_init(struct clocksource *cs)
    > +{
    > + if (cs->archdata.vclock_mode == VCLOCK_NONE)
    > + return;
    > +
    > + if (cs->archdata.vclock_mode >= VCLOCK_MAX) {

    It should be '>' as VCLOCK_MAX == VCLOCK_HVCLOCK == 3

    > + pr_warn("clocksource %s registered with invalid vclock_mode %d. Disabling vclock.\n",
    > + cs->name, cs->archdata.vclock_mode);
    > + cs->archdata.vclock_mode = VCLOCK_NONE;
    > + }
    > +}

    --
    Vitaly

    \
     
     \ /
      Last update: 2018-09-14 17:45    [W:2.353 / U:0.484 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site