Anthony Liguori wrote:
Jeremy Fitzhardinge wrote:No. I misunderstood and thought that stable_if_present sets the Px state. I'd overlooked the writable flag on page_set_volatile().With stable_if_clean you are refering to stable_if_present?So you mean it will change Vr/Pr to Sr but everything else will fail?If yes the answer is that this operation is used to get a page from Vx/Px back to Sx but only if the page has not been discarded.Well presumably Vp/Pr => Sp? Is is true that from the guest's perspective, all of the 'p' states are identical to the 'r' states?
Vp should never happen, since you'd never preserve a V page. And surely it would be Pr -> Sr, since the hypervisor wouldn't push the page to backing store when you change the client state.
Do the host states even really need visibility to the guest at all? It may be useful for the guest to be able to distinguish between Ur and Uz but it doesn't seem necessary.
Well, you implicitly see the hypervisor state. If you touch a [UV]z page then you get a fault telling you that the page has been taken away from you (I think). And it would definitely help with debugging (seems likely there's lots of scope for race conditions if you prematurely tell the hypervisor you don't need the page any more...).
Yes, there's no way I'd be able to get my head around this otherwise. BTW, here's an updated one with the host-driven events as dashed lines, and a couple of extra transitions I think should be in there (but waiting for Martin's confirmation).BTW Jeremy, the .dot was very useful!
J
digraph gph { /* Guest state changes on resident pages */ Ur -> Sr [ label="set stable" ]; Ur -> Vr [ label="set volatile\n(w=0)" ]; Ur -> Pr [ label="set volatile\n(w=1)" ]; Sr -> Ur [ label="set unused" ]; Sr -> Vr [ label="set volatile\n(w=0)" ]; Sr -> Pr [ label="set volatile\n(w=1)" ]; Vr -> Sr [ label="set stable(_if_present)" ]; Vr -> Ur [ label="set unused" ]; Vr -> Pr [ label="set volatile\n(w=1)" ]; Pr -> Sr [ label="set stable(_if_present)" ]; Pr -> Vr [ label="set volatile\n(w=0)" ]; Pr -> Ur [ label="set unused" ]; /* Guest state changes on zero pages */ Uz -> Sz [ label="set stable" ]; Uz -> Vz [ label="set volatile" ]; Sz -> Vz [ label="set volatile" ]; Sz -> Uz [ label="set unused" ]; Vz -> Sz [ label="set stable" ]; Vz -> Uz [ label="set unused" ]; /* Guest state changes on host-swapped pages */ Sp -> Uz [ label="set unused" ]; Sp -> Vz [ label="set volatile" ]; /* Guest touches pages */ Sz -> Sr [ label="guest write" ]; Sp -> Sr [ label="guest access" ]; Vz -> Vr [ label="guest write" ]; /* Host actions */ Sr -> Sp [ label="host swap", style=dashed ]; Ur -> Uz [ label="host discard", style=dashed ]; Vr -> Vz [ label="host discard", style=dashed ]; Pr -> Sp [ label="host discard\n(dirty)", style=dashed ]; Pr -> Vz [ label="host discard\n(clean)", style=dashed ]; }
Attachment:
gph.pdf
Description: Adobe PDF document