Re: [patch 6/6] Guest page hinting: s390 support.

From: Jeremy Fitzhardinge
Date: Wed Mar 12 2008 - 13:50:15 EST


Martin Schwidefsky wrote:
On Wed, 2008-03-12 at 09:44 -0700, Jeremy Fitzhardinge wrote:
Martin Schwidefsky wrote:
That is the first block of state transitions: {Ur,Sr,Vr,Pr}
You can go from any of the four states to any of the remaining three.
You only mention page_set_{unused,stable,volatile}. Is page_set_stable_if_present() the fourth. And shouldn't that be "stable_if_clean":

page_set_volatile has a "writable" argument. For writable==0 you get a
Vx page, for writable==1 you get a Px page.

Hm. But a Vx page is writable isn't it? It's just that its contents can go away at any time. Or does the kernel treat Vx pages as strictly RO cached copies of other things?

It also seems to me that given you talking about "potentially volatile" as a distinct state, it would would be best to have a distinct state-setting function associated with it, so there's a 1:1 correspondence between the code and the description.


With stable_if_clean you are refering to stable_if_present?

No. I misunderstood and thought that stable_if_present sets the Px state. I'd overlooked the writable flag on page_set_volatile().

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.

So you mean it will change Vr/Pr to Sr but everything else will fail? Are there there any other non-discarded states for Vx/Px?

The operation will fail
if the page state is Vz/Pz.

Do mean just Vz here? You say that Pz is never used.

Your understanding is good, but how can I make this less confusing? A Px
page that is dirty may not be discarded which makes it basically stable.
The guest state still is potential volatile though as it does not have a
state of Sx.

Mainly, use identical terminology in code and description so they can be easily compared. I found the diagram was quite helpful in understanding what's going on; feel free to include it in your documentation.

Updated .dot attached; I've updated it to include the page_set_volatile writable argument and the stable_if_present transitions; commented it, removed the self-edges which were cluttering things up.

Also, does a page go from Vz->Vr on guest memory write? If so, does a clean page which goes from Pr->Vz->Vr lose its Px state in the process?

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" ];
Ur -> Uz [ label="host discard" ];
Vr -> Vz [ label="host discard" ];
Pr -> Sp [ label="host discard\n(dirty)" ];
Pr -> Vz [ label="host discard\n(clean)" ];
}

Attachment: gph.pdf
Description: Adobe PDF document