Re: query of CP locked guest pages

2008-12-12 Thread Bill Holder
I should have added that this is how it works in z/VM 5.2.0 and newer
releases.  z/VM 5.1.0 and older still use the old FRMTE based locking
scheme, and there's no host logical / host real differentiation, so there
's
only one check, FRMCPLOK.  

- Bill Holder, z/VM Development, IBM

On Fri, 12 Dec 2008 08:33:14 -0600, Bill Holder hold...@us.ibm.com wrot
e:

Ok, here are the basic steps: 

- Locate the PTE and PGSTE 
- If PGSCPLOK=1, the page is locked to real, and
  if PGSPINCT=1, and PGSOVFLW and PGSOVFL1 are all 0, 
  then you're done.

  Otherwise, check if the page is (also or instead) 
  locked to logical:

- If PGSALIAS=0 or PGSPINCT, PGSOVFL1 and PGSOVFLW are
  all 0, then the page is not locked to logical. 

  Otherwise, if PGSALIAS=1 and any of PGSPINCT, 
  PGSOVFL1 and PGSOVFLW are not 0, continue: 

- The valid PTE contains the frame address (PFRA)
- Convert the frame address to a FRMTE address
  (see AEFRM MACRO for the conversion algorithm)
- Use FRMTE field FRMSXPN to generate the System
  Execution Space (Host Logical) page address (tack
  8 0 bits on the right).
- Convert the SXS page address to the SXS Table Entry
  (SXSTE) address (see SXSAE MACRO for the conversion
  algorithm).
- If SXSCPLOK=1, the page is locked to logical.

I hope that helps.  If you're planning on running these structures 
from outside of CP, say, from another virtual machine, note that 
they're not completely serialized and actions by the target virtual
machine (such as reset, clear, and release functions) can cause 
pages locked by command to be unlocked and the links between these
structures disconnected. 

- Bill Holder, z/VM Development, IBM



Re: query of CP locked guest pages

2008-12-12 Thread David Kreuter
thanks - I'll let you know when I get this cookin'
David



From: The IBM z/VM Operating System on behalf of Bill Holder
Sent: Fri 12/12/2008 9:39 AM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Re: [IBMVM] query of CP locked guest pages



I should have added that this is how it works in z/VM 5.2.0 and newer
releases.  z/VM 5.1.0 and older still use the old FRMTE based locking
scheme, and there's no host logical / host real differentiation, so there=
's
only one check, FRMCPLOK. 

- Bill Holder, z/VM Development, IBM

On Fri, 12 Dec 2008 08:33:14 -0600, Bill Holder hold...@us.ibm.com wrot=
e:

Ok, here are the basic steps:

- Locate the PTE and PGSTE
- If PGSCPLOK=1, the page is locked to real, and
  if PGSPINCT=1, and PGSOVFLW and PGSOVFL1 are all 0,
  then you're done.

  Otherwise, check if the page is (also or instead)
  locked to logical:

- If PGSALIAS=0 or PGSPINCT, PGSOVFL1 and PGSOVFLW are
  all 0, then the page is not locked to logical.

  Otherwise, if PGSALIAS=1 and any of PGSPINCT,
  PGSOVFL1 and PGSOVFLW are not 0, continue:

- The valid PTE contains the frame address (PFRA)
- Convert the frame address to a FRMTE address
  (see AEFRM MACRO for the conversion algorithm)
- Use FRMTE field FRMSXPN to generate the System
  Execution Space (Host Logical) page address (tack
  8 0 bits on the right).
- Convert the SXS page address to the SXS Table Entry
  (SXSTE) address (see SXSAE MACRO for the conversion
  algorithm).
- If SXSCPLOK=1, the page is locked to logical.

I hope that helps.  If you're planning on running these structures
from outside of CP, say, from another virtual machine, note that
they're not completely serialized and actions by the target virtual
machine (such as reset, clear, and release functions) can cause
pages locked by command to be unlocked and the links between these
structures disconnected.

- Bill Holder, z/VM Development, IBM






Re: query of CP locked guest pages

2008-12-11 Thread Bill Holder
The locking / pinning mechanism moved from the FRMTE to the PTE/PGSTE as 
of
5.2.0 as part of the support for HPMA (a hardware page fault assist allow
ing
hardware pinning) and QDIO passthrough.  A page being locked by command i
s
now indicated by the PGSCPLOK bit in byte 6 of the PGSTE (see also PGSD98
LK
for Diag x'98' locking).  

Yes, the PGMBK stays resident as long as the page stays locked (in some
cases, even after the virtual megabyte has been released).  

- Bill Holder, z/VM Development, IBM 

On Thu, 11 Dec 2008 01:05:47 +0100, Rob van der Heij [EMAIL PROTECTED] 
wrote:

On Thu, Dec 11, 2008 at 12:22 AM, David Kreuter
[EMAIL PROTECTED] wrote:

 The frametable entries do not have an obvious bit indicating that the 
page
 is a target of a CP lock. I'll keep digging.
 I'm going to as time permits hunt down through the virtual machine pgm
bk's.
 David

So you can tell how long ago it was that I cared. I believe 5.1 still
had X'40' as FRMCPLOK
My apologies for providing out-of-date guidance. If I have the picture
right, then the PGMBK would still be resident as long as one of the
pages is resident, even though it now does not live under the bar
anymore.

-Rob

=



Re: query of CP locked guest pages

2008-12-11 Thread Bill Holder
Dave, are you looking to unlock just a subset of what was locked, or all 
of
them?  If you just want to unlock everything, a single UNLOCK command
covering all the guest's storage (or two, if pages were explicitly locked
 to
both real and logical) will do it.  

- Bill Holder, z/VM Development, IBM


Re: query of CP locked guest pages

2008-12-11 Thread Bill Holder
The other trick I should mention is that PGSCPLOK is only set if the pa
ge
was explicitly locked to host real.  If locked by command to host logical
,
SXSCPLOK is set in the corresponding SXSTE (another structure entirely,
which is used to manage System Execution Space (Host Logical) page usage 
and
mappings).  If there is an associated SXSTE (as indicated by PGSALIAS bei
ng
set), it can be found via the FRMSXPN field in the corresponding FRMTE.  
So
if you know that pages have been locked by CP LOCK, but don't know whethe
r
they were locked to real or logical or both, you would have to check
multiple places to determine whether an individual page was locked by com
mand.  

- Bill Holder, z/VM Development, IBM


Re: query of CP locked guest pages

2008-12-11 Thread David Kreuter
nah I am in need of a method to determine which pages of a virtual machine have 
been locked by the lock command.
David



From: The IBM z/VM Operating System on behalf of Bill Holder
Sent: Thu 12/11/2008 12:12 PM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Re: [IBMVM] query of CP locked guest pages



Dave, are you looking to unlock just a subset of what was locked, or all =
of
them?  If you just want to unlock everything, a single UNLOCK command
covering all the guest's storage (or two, if pages were explicitly locked=
 to
both real and logical) will do it. 

- Bill Holder, z/VM Development, IBM





Re: query of CP locked guest pages

2008-12-11 Thread Alan Altmark
On Thursday, 12/11/2008 at 01:32 EST, David Kreuter 
dkreu...@vm-resources.com wrote:
 nah I am in need of a method to determine which pages of a virtual 
machine 
 have been locked by the lock command.

Would you use the information for anything other than to unlock said 
pages?

Alan Altmark
z/VM Development
IBM Endicott


Re: query of CP locked guest pages

2008-12-10 Thread Bill Holder
There is indeed no CP QUERY LOCKED command, I assume because nobody's ask
ed
for it before (ok, I haven't actually looked to see if anyone has, it's
possible someone did, but it never made the cut).  If the information
wasn't saved from the point where the LOCK requests were issued, I can't
think of anything better than trial and error for doing the UNLOCKs.  IND

USER will give the number of locked pages (the EXP option will differenti
ate
locked to real vs. locked to logical), but I'm  not aware of anything tha
t
will provide the addresses of the locked pages.  

- Bill Holder, z/VM Development, IBM


On Wed, 10 Dec 2008 09:47:32 -0600, Dave Jones [EMAIL PROTECTED] 
wrote:

I'm stumped hereI have a guest virtual machine (running Linux, but I

think that's
immaterial) that has locked some of its pages into host storage via the 
CP LOCK
commandnow I want to find out *which* guest pages were locked. I can

find a count of
the number of locked pages, but I want to know which ones as well.

How come there is no CP QUERY LOCKED command to tell me this?

Thanks and have a good one.

--
DJ

V/Soft
   z/VM and mainframe Linux expertise, training,
   consulting, and software development
www.vsoft-software.com

=



Re: query of CP locked guest pages

2008-12-10 Thread Rob van der Heij
On Wed, Dec 10, 2008 at 4:47 PM, Dave Jones [EMAIL PROTECTED] wrote:
 I'm stumped hereI have a guest virtual machine (running Linux, but I
 think that's immaterial) that has locked some of its pages into host storage
 via the CP LOCK commandnow I want to find out *which* guest pages were
 locked. I can find a count of the number of locked pages, but I want to know
 which ones as well.

No Dave, locked pages is material (i.e. hardware). Unlocked pages
are immaterial (virtual) :-)

In a former live, in the days that I cared about such things, I had a
tiny pipeline stage that could read the core table (using my dcp
stage). From there it was trivial to select the entries marked as
locked user pages. I used it to determine the reference patterns for
Linux pages to decide what portions would be candidates to share.

But if your which was only the prelude for the why question: if
the guest has a dedicated OSA adapter, then the locked pages are
probably the inbound buffers for that. In previous releases the locked
pages per guest (under the bar) was part of the motivation to promote
virtual network devices.

Rob


Re: query of CP locked guest pages

2008-12-10 Thread David Kreuter
The frametable entries do not have an obvious bit indicating that the page is a 
target of a CP lock. I'll keep digging.
I'm going to as time permits hunt down through the virtual machine pgmbk's.
David



From: The IBM z/VM Operating System on behalf of Rob van der Heij
Sent: Wed 12/10/2008 6:15 PM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Re: [IBMVM] query of CP locked guest pages



On Wed, Dec 10, 2008 at 4:47 PM, Dave Jones [EMAIL PROTECTED] wrote:
 I'm stumped hereI have a guest virtual machine (running Linux, but I
 think that's immaterial) that has locked some of its pages into host storage
 via the CP LOCK commandnow I want to find out *which* guest pages were
 locked. I can find a count of the number of locked pages, but I want to know
 which ones as well.

No Dave, locked pages is material (i.e. hardware). Unlocked pages
are immaterial (virtual) :-)

In a former live, in the days that I cared about such things, I had a
tiny pipeline stage that could read the core table (using my dcp
stage). From there it was trivial to select the entries marked as
locked user pages. I used it to determine the reference patterns for
Linux pages to decide what portions would be candidates to share.

But if your which was only the prelude for the why question: if
the guest has a dedicated OSA adapter, then the locked pages are
probably the inbound buffers for that. In previous releases the locked
pages per guest (under the bar) was part of the motivation to promote
virtual network devices.

Rob





Re: query of CP locked guest pages

2008-12-10 Thread Rob van der Heij
On Thu, Dec 11, 2008 at 12:22 AM, David Kreuter
[EMAIL PROTECTED] wrote:

 The frametable entries do not have an obvious bit indicating that the page
 is a target of a CP lock. I'll keep digging.
 I'm going to as time permits hunt down through the virtual machine pgmbk's.
 David

So you can tell how long ago it was that I cared. I believe 5.1 still
had X'40' as FRMCPLOK
My apologies for providing out-of-date guidance. If I have the picture
right, then the PGMBK would still be resident as long as one of the
pages is resident, even though it now does not live under the bar
anymore.

-Rob


Re: query of CP locked guest pages

2008-12-10 Thread David Kreuter
yearning for the good ole days of yore.  The bit has been moved to the PGSTE!  
That'll take a bit more hunting down - pun intended I suppose -
 
15160= 
15161=* PGSBYTE 6 Additional status bits   
15162= 
15164=*Bits defined in PGSBYTE6
15166=PGSBYTE6 DSX Byte 6 of page status entry 
15167=*PGSCMDLK was FRMCPLOK 
15168=PGSCPLOK EQU   X'80' A pageable page is locked in th 
15169=*frame (pinned) by the CP LOCK   
15170=*command, one increment of the   
15171=*total pin count represents the  
15172=*CP LOCK command lock.   
 
David



From: The IBM z/VM Operating System on behalf of Rob van der Heij
Sent: Wed 12/10/2008 7:05 PM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Re: [IBMVM] query of CP locked guest pages



On Thu, Dec 11, 2008 at 12:22 AM, David Kreuter
[EMAIL PROTECTED] wrote:

 The frametable entries do not have an obvious bit indicating that the page
 is a target of a CP lock. I'll keep digging.
 I'm going to as time permits hunt down through the virtual machine pgmbk's.
 David

So you can tell how long ago it was that I cared. I believe 5.1 still
had X'40' as FRMCPLOK
My apologies for providing out-of-date guidance. If I have the picture
right, then the PGMBK would still be resident as long as one of the
pages is resident, even though it now does not live under the bar
anymore.

-Rob