kvm_get_running_vcpu(9)
π¦ kvm_get_running_vcpu(9) π¦
okay bestie, welcome to the Kernel API Manual entry for kvm_get_running_vcpu β this is the little function that gets the vcpu running on the current CPU. no cap. π
β¨ NAME β¨
kvm_get_running_vcpu β get the vcpu running on the current CPU. π
β¨ SYNOPSIS β¨
struct kvm_vcpu * kvm_get_running_vcpu (void );
β¨ ARGUMENTS β¨
voidβ no arguments. literally none. π«Ά
β¨ DESCRIPTION β¨
okay so here's the vibe: we can disable preemption locally around accessing the per-CPU variable, and then use the resolved vcpu pointer after enabling preemption again. why is that valid? because even if the current thread is migrated to another CPU, reading the per-CPU value later will give us the same value β we update the per-CPU variable in the preempt notifier handlers. slay. β¨
this is the whole point, bestie: the pointer stays valid for what we're doing even if the current thread moves CPUs. iykyk. π§
β¨ SEE ALSO β¨
- Kernel file:
./virt/kvm/kvm_main.c kvm_get_dirty_log(9)kvm_get_dirty_log_protect(9)kvm_vm_ioctl_get_dirty_log(9)kvm_clear_dirty_log_protect(9)kvm_get_running_vcpus(9)
mwah π this page lives under./virt/kvmβ that's the source/version, bestie β datedOctober 2026, and yes it's thekvm_get_running_vcpu(9)page. bye cutie π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms