]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: x86/xen: Initialize hrtimer in kvm_xen_init_vcpu()
authorNam Cao <namcao@linutronix.de>
Thu, 31 Oct 2024 15:14:17 +0000 (16:14 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 7 Nov 2024 01:47:05 +0000 (02:47 +0100)
commitf6e12766c52dc8e7032fe51d4ef33320b475775e
treef8dc9eb8af589f2f1c9559c94d357e2bdec07a13
parent482a483cfe5bafeb5408532321cd607bae127a2b
KVM: x86/xen: Initialize hrtimer in kvm_xen_init_vcpu()

The hrtimer is initialized in the KVM_XEN_VCPU_SET_ATTR ioctl. That caused
problem in the past, because the hrtimer can be initialized multiple times,
which was fixed by commit af735db31285 ("KVM: x86/xen: Initialize Xen timer
only once"). This commit avoids initializing the timer multiple times by
checking the field 'function' of struct hrtimer to determine if it has
already been initialized.

This is not required and in the way to make the function field private.

Move the hrtimer initialization into kvm_xen_init_vcpu() so that it will
only be initialized once.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/all/9c33c7224d97d08f4fa30d3cc8687981c1d3e953.1730386209.git.namcao@linutronix.de
arch/x86/kvm/xen.c