Re: [PATCH v5 2/4] KVM: LAPIC: Inject timer interrupt via posted interrupt

From: Paolo Bonzini
Date: Fri Jul 05 2019 - 08:37:49 EST


On 21/06/19 11:40, Wanpeng Li wrote:
> +bool __read_mostly pi_inject_timer = 0;
> +module_param(pi_inject_timer, bool, S_IRUGO | S_IWUSR);
> +
> #define KVM_NR_SHARED_MSRS 16
>
> struct kvm_shared_msrs_global {
> @@ -7032,6 +7036,7 @@ int kvm_arch_init(void *opaque)
> host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
>
> kvm_lapic_init();
> + pi_inject_timer = housekeeping_enabled(HK_FLAG_TIMER);

This overwrites whatever the user specified, so perhaps:

u8 __read_mostly pi_inject_timer = -1;
module_param(pi_inject_timer, bool, S_IRUGO | S_IWUSR);

...
if (pi_inject_timer == -1)
pi_inject_timer = housekeeping_enabled(HK_FLAG_TIMER);

Also, do you want to disable the preemption timer if pi_inject_timer and
enable_apicv are both true?

Paolo