On 4/23/2024 12:49 AM, David Woodhouse wrote:
If I restored the KVM_REQ_GLOBAL_CLOCK_UPDATE request from kvm_arch_vcpu_load(), the selftest works for me, and I ran the test for 1000+ iterations, w/ or w/o TSC scaling, the TEST_ASSERT(delta_corrected <= ±1) never got hit. This is awesome!
However, without KVM_REQ_GLOBAL_CLOCK_UPDATE, it still fails on creating a VM. Maybe the init sequence sill needs some rework.
That one confuses me. The crash is actually in debugfs, as it's registering the per-vm or per-vcpu stats. I can't imagine *how* that's occurring. Or see why the availability of TSC scaling would cause it to show up for you and not me. Can I have your .config please?
First thought would be that there's some change in the KVM structures and you have some stale object files using the old struct, but then I realise I forgot to actually *remove* the now-unused kvmclock_update_work from x86's struct kvm_arch anyway.
I'll try to reproduce, as I think I want to *know* what's going on here, even if I am going to drop that patch as mentioned in https://lore.kernel.org/kvm/a6723ac9e0169839cb33e8022a47c2de213866ac.camel@i...
Are you able to load that vmlinux in gdb and (gdb) list *start_creating+0x80 (gdb) list *kvm_create_vm_debugfs+0x28b
Thanks again.
My apologies, it turns out the KVM_REQ_GLOBAL_CLOCK_UPDATE is not needed. Today I can't reproduce the issue after removing it. Yesterday I thought it may miss something related to pfncache.
To be clear, with the above mentioned change to kvm_scale_tsc(master_tsc_scaling_ratio), the selftest runs reliably regardless TSC scaling is enabled or not.