kvm_get_dirty_log_protect(9)
π kvm_get_dirty_log_protect β bestie edition π
Welcome to the Kernel API Manual, bestie! This page is literally all about kvm_get_dirty_log_protect(9), and no cap, it's kind of iconic once you get the vibe. Let's get into it π«Ά
β¨ NAME β¨
kvm_get_dirty_log_protect β grab a snapshot of dirty pages and reenable dirty page tracking for the corresponding pages. Slay, honestly π
π¦ SYNOPSIS π¦
int kvm_get_dirty_log_protect (struct kvm *kvm , struct kvm_dirty_log
*log );
That's the whole signature, periodt. Keep it exactly like that β¨
πΈ ARGUMENTS πΈ
kvmβ pointer to kvm instance. Like, the actual KVM vibe holder πlogβ slot id and address to which we copy the log. That's where the snapshot goes, iykyk π
π DESCRIPTION π
Okay so first thing, we need to keep it in mind that VCPU threads can write to the bitmap concurrently. Like, at the same time, no warning, just vibes π So to avoid losing track of dirty pages, we keep the following order β and the order is literally everything:
- Take a snapshot of the bit and clear it if needed.
- Write protect the corresponding page.
- Copy the snapshot to the userspace.
- Upon return caller flushes TLB's if needed.
Between step 2 and step 4, the guest may write to the page using the remaining TLB entry. And bestie, this is not a problem β because the page is reported dirty using the snapshot taken before, and step 4 ensures that writes done after exiting to userspace will be logged for the next call. The way that all just works?? Obsessed πβ¨
Lowkey important: the ordering is what keeps dirty tracking from losing pages. Do not shuffle these steps around, fr fr.
π₯ SEE ALSO π₯
- Kernel file
./virt/kvm/kvm_main.ckvm_get_dirty_log(9) kvm_vm_ioctl_get_dirty_log(9)kvm_clear_dirty_log_protect(9)kvm_get_running_vcpu(9)kvm_get_running_vcpus(9)
Go read those too, bestie, they're all part of the same little KVM friend group ππ
And that's the whole page π This masterpiece comes from ./virt/kvm, dated October 2026, and it's the kvm_get_dirty_log_protect(9) manual β ate and left no crumbs πβ¨π¦
π¦ 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