x86/hpet: Disable legacy replacement mode after IRQ test if not needed
PATCH 1/1 x86/hpet: Disable legacy replacement mode after IRQ test if not needed
As far as I understand the HPET legacy mode is not required on systems with ARAT after the timer IRQ test. For previous discussion see [1]. Keeping it enabled prevents reaching S0ix residency.
--- xen/arch/x86/io_apic.c | 4 ++++ 1 file changed, 4 insertions(+)
xen/arch/x86/io_apic.c +4 -0
@@ -1966,6 +1966,10 @@ static void __init check_timer(void)if (timer_irq_works () ) { +if (boot_cpu_has (X86_FEATURE_ARAT ) ) { +printk (XENLOG_INFO "IRQ test with HPET Legacy Replacement Mode worked. Disabling it again.\n" ); +hpet_disable_legacy_replacement_mode (); + }local_irq_restore (flags);return ; }
Signature · 1 line
2.40.1
Quoted 2 lines · Simon Gaiser
As far as I understand the HPET legacy mode is not required on systems with ARAT after the timer IRQ test.
What's the relation with ARAT here?
It would seem to me that keeping legacy replacement enabled should only be done when opt_hpet_legacy_replacement > 0, and the currently modified block is already in a opt_hpet_legacy_replacement < 0 gated chunk.
Thanks, Roger.
Roger Pau Monné:
Quoted 10 lines · Simon Gaiser
Quoted 2 lines
As far as I understand the HPET legacy mode is not required on systems with ARAT after the timer IRQ test.
What's the relation with ARAT here?
It would seem to me that keeping legacy replacement enabled should only be done when
opt_hpet_legacy_replacement> 0, and the currently modified block is already in aopt_hpet_legacy_replacement< 0 gated chunk.
I was concerned that on systems without ARAT cpuidle might rely on HPET legacy mode being available. See _disable_pit_irq and lapic_timer_init. But now that I stared at this again, I think that condition isn't actually needed. If we reach that code we know that we have no working PIT, but HPET is working. So _disable_pit_irq which is run after check_timer (__start_xen first calls check_timer via smp_prepare_cpus and only later disable_pit_irq via do_initcalls) will setup HPET broadcast, which should succeed since HPET worked previously.
So I guess we can just drop the condition (please double check, that code is quite tangled and I'm not familiar with it).
Simon
Quoted 21 lines · Simon Gaiser
Roger Pau Monné:
Quoted 10 lines · Simon Gaiser
Quoted 2 lines
As far as I understand the HPET legacy mode is not required on systems with ARAT after the timer IRQ test.
What's the relation with ARAT here?
It would seem to me that keeping legacy replacement enabled should only be done when
opt_hpet_legacy_replacement> 0, and the currently modified block is already in aopt_hpet_legacy_replacement< 0 gated chunk.I was concerned that on systems without ARAT cpuidle might rely on HPET legacy mode being available. See
_disable_pit_irqandlapic_timer_init. But now that I stared at this again, I think that condition isn't actually needed. If we reach that code we know that we have no working PIT, but HPET is working. So_disable_pit_irqwhich is run aftercheck_timer(__start_xenfirst callscheck_timerviasmp_prepare_cpusand only laterdisable_pit_irqviado_initcalls) will setup HPET broadcast, which should succeed since HPET worked previously.
Quoted 2 lines
So I guess we can just drop the condition (please double check, that code is quite tangled and I'm not familiar with it).
What you want to respect instead though is opt_hpet_legacy_replacement.
Jan
Jan Beulich:
Quoted 22 lines · Simon Gaiser
Quoted 21 lines
Roger Pau Monné:
Quoted 10 lines · Simon Gaiser
Quoted 2 lines
As far as I understand the HPET legacy mode is not required on systems with ARAT after the timer IRQ test.
What's the relation with ARAT here?
It would seem to me that keeping legacy replacement enabled should only be done when
opt_hpet_legacy_replacement> 0, and the currently modified block is already in aopt_hpet_legacy_replacement< 0 gated chunk.I was concerned that on systems without ARAT cpuidle might rely on HPET legacy mode being available. See
_disable_pit_irqandlapic_timer_init. But now that I stared at this again, I think that condition isn't actually needed. If we reach that code we know that we have no working PIT, but HPET is working. So_disable_pit_irqwhich is run aftercheck_timer(__start_xenfirst callscheck_timerviasmp_prepare_cpusand only laterdisable_pit_irqviado_initcalls) will setup HPET broadcast, which should succeed since HPET worked previously.
Quoted 4 lines
Quoted 2 lines
So I guess we can just drop the condition (please double check, that code is quite tangled and I'm not familiar with it).
What you want to respect instead though is
opt_hpet_legacy_replacement.
Can you please explain what behavior you expect? As Roger pointed out this code only runs with opt_hpet_legacy_replacement < 0 so the user didn't make an explicit choice. In that case enabling the legacy mode for the timer IRQ test and then disabling it to allow lower power modes seems reasonable to me.
Simon
Quoted 23 lines · Simon Gaiser
Jan Beulich:
Quoted 22 lines · Simon Gaiser
Quoted 21 lines
Roger Pau Monné:
Quoted 10 lines · Simon Gaiser
Quoted 2 lines
As far as I understand the HPET legacy mode is not required on systems with ARAT after the timer IRQ test.
What's the relation with ARAT here?
It would seem to me that keeping legacy replacement enabled should only be done when
opt_hpet_legacy_replacement> 0, and the currently modified block is already in aopt_hpet_legacy_replacement< 0 gated chunk.I was concerned that on systems without ARAT cpuidle might rely on HPET legacy mode being available. See
_disable_pit_irqandlapic_timer_init. But now that I stared at this again, I think that condition isn't actually needed. If we reach that code we know that we have no working PIT, but HPET is working. So_disable_pit_irqwhich is run aftercheck_timer(__start_xenfirst callscheck_timerviasmp_prepare_cpusand only laterdisable_pit_irqviado_initcalls) will setup HPET broadcast, which should succeed since HPET worked previously.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
So I guess we can just drop the condition (please double check, that code is quite tangled and I'm not familiar with it).
What you want to respect instead though is
opt_hpet_legacy_replacement.Can you please explain what behavior you expect? As Roger pointed out this code only runs with
opt_hpet_legacy_replacement< 0 so the user didn't make an explicit choice.
Oh, I'm sorry. Please disregard my comment then.
Jan