[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zhwk6q2l.fsf@vitty.brq.redhat.com>
Date: Fri, 14 Sep 2018 17:45:06 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>, x86@...nel.org,
Peter Zijlstra <peterz@...radead.org>,
Matt Rickard <matt@...trans.com.au>,
Stephen Boyd <sboyd@...nel.org>,
John Stultz <john.stultz@...aro.org>,
Florian Weimer <fweimer@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
devel@...uxdriverproject.org,
virtualization@...ts.linux-foundation.org,
Paolo Bonzini <pbonzini@...hat.com>,
Arnd Bergmann <arnd@...db.de>, Juergen Gross <jgross@...e.com>
Subject: Re: [patch 02/11] x86/time: Implement clocksource_arch_init()
Thomas Gleixner <tglx@...utronix.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@...utronix.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
Powered by blists - more mailing lists