From: Jan Kiszka Subject: [PATCH] x86/hpet: dovetail: Harden clocksource for use in oob Message-ID: Date: Fri, 18 Jun 2021 08:29:53 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xenomai , Philippe Gerum From: Jan Kiszka While it's slow, has scalability issues, it remains the second-best clocksource for Linux on x86. If Linux decides that the TSC is not reliable we will end up here and should avoid bringing the system into an unstable state. Suggested-by: Philippe Gerum Signed-off-by: Jan Kiszka --- While this does not give us hpet for Xenomai yet (vDSO fallback path still missing), it resolves the system stalls when Linux switches here. arch/x86/kernel/hpet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 67a9f248270c..ce8e15aa8a97 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -811,7 +811,7 @@ static u64 read_hpet(struct clocksource *cs) if (arch_spin_is_locked(&old.lock)) goto contended; - local_irq_save(flags); + flags = hard_local_irq_save(); if (arch_spin_trylock(&hpet.lock)) { new.value = hpet_readl(HPET_COUNTER); /* @@ -819,10 +819,10 @@ static u64 read_hpet(struct clocksource *cs) */ WRITE_ONCE(hpet.value, new.value); arch_spin_unlock(&hpet.lock); - local_irq_restore(flags); + hard_local_irq_restore(flags); return (u64)new.value; } - local_irq_restore(flags); + hard_local_irq_restore(flags); contended: /* -- 2.26.2