pte_needs_unshadow(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pte_needs_unshadow β€” a Kernel API Manual moment (section 9, bestie)

okay so picture this: you're deep in the kernel, section 9 of the manual, and you need to know whether a pte operation is gonna trigger unshadowing. that's the whole vibe of pte_needs_unshadow(9). lowkey iconic. let's get into it 🫢


✨ SYNOPSIS ✨

bool pte_needs_unshadow (union pte oldpte , union pte newpte , union
pgste pgste );

like, that's the whole signature, no cap β€” copy it exactly, don't @ me πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • oldpte β€” the previous value for the guest pte. the before pic πŸ“Έ
  • newpte β€” the new pte being set. the glow-up in progress ✨
  • pgste β€” the pgste for the pte entry. the receipts, basically 🧾

🌸 DESCRIPTION 🌸

okay so first things first: if the pgste.vsie_notif bit is not set, just return false and go home. the page is not involved in vsie, so it should literally not trigger an unshadow operation. not its business, not its problem, we move πŸ’€

now, if the pgste.vsie_gmem bit is set? that means this pte represents shadowed guest memory, and the access rights on g3's memory should be synchronized with g1's and g2's. so unshadowing gets triggered if the new and old pte differ in protection, or if the new pte is invalid. mismatched protection = drama = unshadow event. invalid pte = also drama. periodt πŸ’…

and if the pgste.vsie_gmem bit is not set? then this pte maps the g2 dat tables for g3. but here's the catch, bestie β€” if the entry becomes writable or absent, it becomes impossible to guarantee that the shadow mapping will match g2's mapping. and in that case?? trigger an unshadow event. that's the rule, iykyk 🌈


⭐ RETURN ⭐

returns true if an unshadow event should be triggered β€” otherwise false. simple as that, no notes πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹


fr fr the whole gmap squad is linked above, go read them, they're giving main character energy too πŸ’–

and that's a wrap, bestie πŸŽ€ this page lives at ./arch/s390/kvm/gmap, and the date on it is October 2026 β€” so like, mark your calendar, because we're literally so ahead of schedule βœ¨πŸ’œ

πŸ“¦ where this page comes from