kvm_gpc_refresh(9)
π kvm_gpc_refresh β kernel API manual, but make it make sense π
okay so bestie, welcome to the kvm_gpc_refresh(9) page β it lives in the kernel API manual and it's literally all about updating a cache you already initialized. no cap, that's the whole vibe.
β¨ NAME β¨
kvm_gpc_refresh β update a previously initialized cache.
like, the cache already exists, you already set it up, and now you just want it fresh again. periodt. π
π¦ SYNOPSIS π¦
int kvm_gpc_refresh (struct gfn_to_pfn_cache *gpc , unsigned long len );
there it is, character for character, wouldn't dream of touching it π«Ά
π ARGUMENTS π
gpcβ astruct gfn_to_pfn_cacheobject. yeah. that's the thing you're refreshing, bestie.lenβ a sanity check π§ the range being accessed must fit inside a single page. that's the rule, and the function will absolutely hold you to it.
β RETURN β
0β success, slay π-EINVALβ you asked for a mapping that would cross a page boundary. nope, not today π-EFAULTβ the guest physical address is untranslatable. it's giving "can't even find it" π
πΈ DESCRIPTION πΈ
so this function will attempt to refresh a gfn_to_pfn_cache. sounds simple, right? but β and this is the part everyone skips β a successful return from this function does not mean the page can be immediately accessed, because it may have raced with an invalidation. literally a whole race condition situation π
so what do callers do? they must still lock and check the cache status themselves. this function does not return with the lock still held to permit access β so don't go assuming you've got the lock and can just waltz in and read the page. you can't. lock, check, then access. in that order. iykyk π₯
π lowkey the most important sentence on this page: a successful return does not mean the page can be immediately accessed. say it with me. it may have raced with an invalidation.
π SEE ALSO π
kernel file ./include/linux/kvm_host.h β¨ and all these iconic siblings:
guest_state_enter_irqoff(9)guest_state_exit_irqoff(9)kvm_gpc_init(9)kvm_gpc_activate(9)kvm_gpc_activate_hva(9)kvm_gpc_check(9)kvm_gpc_deactivate(9)kvm_stats_linear_hist_update(9)kvm_stats_log_hist_update(9)
and that's the whole page, bestie π this one ships from ./include/linux, October 2026, and it's the kvm_gpc_refresh(9) page, so go forth, lock that cache, check that status, and stay hydrated ππ§π
π¦ 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