kvm_reset_vcpu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

Hey bestie! Welcome to the kvm_reset_vcpu(9) manual page from the Kernel API Manual. We're about to get into the reset vibes, and ngl, it's iconic. πŸ’…βœ¨


🌸 NAME 🌸

kvm_reset_vcpu β€” sets core registers and sys_regs to reset value. Ate. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

void kvm_reset_vcpu (struct kvm_vcpu *vcpu );

πŸ’– ARGUMENTS πŸ’–

  • vcpu β€” the VCPU pointer, bestie. That's the whole argument list, fr fr. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this function literally sets the registers on the virtual CPU struct to their architecturally defined reset values β€” slay. But there's an exception, bestie: registers whose reset is deferred until kvm_arm_vcpu_finalize don't get touched here. That's the whole vibe. Highkey obsessed. ✨


πŸŽ€ NOTE πŸŽ€

Bestie, this function can be called from two paths β€” don't forget! πŸ’…

Okay so this function can get called from two paths, bestie: the KVM_ARM_VCPU_INIT ioctl, or as part of handling a request issued by another VCPU in the PSCI handling code. In the first case, the VCPU will not be loaded. In the second case, the VCPU will be loaded. Because this function operates purely on the memory-backed values of system registers, we want to do a full put if we were loaded (handling a request) and load the values back at the end of the function. Otherwise we leave the state alone. And in both cases, we disable preemption around the vcpu reset, because otherwise we'd race with preempt notifiers which also call put/load. Vibe check: passed. No cap, it's giving race condition prevention. πŸ™ˆ periodt.


πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./arch/arm64/kvm/reset.c β€” that's where you'll find the source, bestie. Iykyk. Lowkey obsessed with this file. πŸ’…

Alright bestie, that's the whole kvm_reset_vcpu(9) page for you! This is from the ./arch/arm64/kvm source, version October 2026. Stay iconic, and remember: reset those registers, but don't forget the preemption disable. Fr fr. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from