|
Hex Dec Type/Val Lng Label (dup) Comments
---- ---- --------- ---- -------------- --------
0000 0 Structure SYNBK FORMAL SPIN LOCK CONTROL BLOCK
SYNLOCKD is the doubleword lock area. There are
various fields contained in this doubleword. Block
concurrent operations should be used to fetch and
store this doubleword when more than one of those
fields will be examined. For example, to determine if
the lock is currently held by this processor by
checking both SYNSTATE and SYNHCPAD, this doubleword
should be fetched with a block concurrent operation
and then the two tests needed to verify both those
conditions can be done on the fetched copy of the
field. This is necessary to ensure that those two
fields are tested at the same instant. If the state
and holding CPU address are tested at different
instants, it would be possible to see the state is
held-exclusive but then the CPU address may have
changed by the time that field is tested. SYNHCPAD can
change to either x'FFFF' or a CPU address (but not of
this processor) during that window.
0000 0 Dbl-Word 8 SYNLOCKD First doubleword of the lock
0000 0 Signed 4 SYNLOCKF First fullword of the lock
The order of the four 1-byte fields in SYNLOCKF is
important. Code in HCPSYN and the HCPSYNC and HCPUSYNC
macros relies on this ordering. The code in those parts
is written for efficiency and would need to change if the
positions of these fields are changed.
0000 0 Bitstring 1 SYNSTATE Current state of this lock Note
that SYNAVAIL and SYNAVLEX should
not be changed to different
values as composite tests that
rely on these current values are
done for the sake of efficiency.
For efficiency in the lock
macros, these states are used as
unique bits. They are also used
as codes because of the way that
SYNAVAIL is defined. Due to this
dual nature, care should be taken
if more bits (or codes) are
defined in SYNSTATE.
00000000 SYNAVAIL 00 SYNAVAIL Lock is not held and
it is available for acquisition
by both shared and exclusive
requests
00000001 SYNAVLEX 01 SYNAVLEX Lock is not held and
is only available for exclusive
requests
00000002 SYNAVLSH 02 SYNAVLSH Lock is not held and
is only available for shared
requests
00000004 SYNHLDEX 04 SYNHLDEX Lock is held
exclusive and the CPU addr of the
holder is in the SYNHCPAD field
00000008 SYNHLDSH 08 SYNHLDSH Lock is held shared
and the count of processors
holding shares is in the SYNSHCNT
field
0000000F SYNSTATB 00002
SYNAVAIL+SYNAVLEX+SYNAVLSH+SYNHLD
EX+SYNHLDSH,2 This equate
contains all the bits in SYNSTATE
that are used to indicate the
current state of the lock. It is
used to clear the state to make
it AVAILABLE
0001 1 Bitstring 1 SYNSHCNT Share hold count...count of CPUs
currently holding a share of this
lock
0002 2 Bitstring 1 SYNXWCNT Exclusive wait count ... count of
CPUs currently waiting for this
lock in exclusive mode. This
field is always zero if the lock
can only be obtained exclusive
(CANSHARE=NO on its
HCPSYNC/HCPUSYNC invocations)
0003 3 Bitstring 1 SYNSWCNT Shared wait count ... count of
CPUs currently waiting for a
share of this lock. This field is
always zero if the lock can only
be obtained exclusive
(CANSHARE=NO on its
HCPSYNC/HCPUSYNC invocations)
0004 4 Signed 2 SYNSEQ Sequence number for serializing
acquisition of this lock. This is
incremented by one each time the
lock is released from exclusive
mode. This field is always zero
if the lock can only be obtained
exclusive (CANSHARE=NO on its
HCPSYNC/HCPUSYNC invocations)
WARNING: Most locks are initialized to all zeroes when
defined. This means that initially, SYNHCPAD
is zeroes, not x'FFFF'. HCPSYNC, HCPOBTN, and
HCPSYN have been coded to be able to handle
this. Therefore, once the lock has been
released once (and any subsequent time that it
is not HELD-EXCLUSIVE) SYNHCPAD will be x'FFFF'.
However, any code that expects to compare
SYNHCPAD and PFXCPUAD to determine if a
particular CPU holds a lock must be careful,
as seeing zeroes in SYNHCPAD could be mistaken
as the lock being held by CPU 0. The code must
either ensure that the lock is initialized
specially to have SYNHCPAD set to x'FFFF', or
must first test SYNSTATE to verify that the
lock is indeed HELD-EXCLUSIVE, before checking
SYNHCPAD to see if a particular CPU holds the
lock.
0006 6 Signed 2 SYNHCPAD CPU addr of lock holder when it
is held in exclusive mode. Set to
x'FFFF' when not held exclusive
0008 8 Signed 4 SYNHOLDR Address of holder of this lock if
it is held in exclusive mode. See
SYNPLSDS for address of the
holder when it is held shared
000C 12 Signed 2 SYNPLSDS For shared locks, displacement
into the PLSBK of the fullword
field that contains the address
of the code that holds a share of
this lock for this processor.
This field must be filled in when
the lock area is obtained or at
CP initialization
000E 14 Bitstring 1 SYNFLAG1 Flag containing info about lock
1... .... SYNCANSH x'80' SYNCANSH This lock can be
held shared
000F 15 Bitstring 1 * Reserved for future IBM use
0010 16 Signed 4 SYNXSCNT Exclusive spin count ... number
of times to the formal spin lock
manager when attempting to get
this lock in exclusive mode
0014 20 Signed 4 SYNSSCNT Share spin count ... number of
times to the formal spin lock
manager when attempting to get a
share of the lock
0018 24 Dbl-Word 8 SYNXTIME Total elapsed wall-clock spin
time on this lock when attempting
to get it in exclusive mode,
starting at zero and counting up
0020 32 Dbl-Word 8 SYNSTIME Total elapsed wall-clock spin
time on this lock when attempting
to get a share, starting at zero
and counting up
0028 40 Dbl-Word 8 * Reserved for future IBM use
00000030 SYNBKEXT *
00000006 SYNSIZE (*-SYNBK+7)/8 SYNBK size in
doublewords which should be
changed with care as it is
imbedded in other control blocks
and code.
Extension of SYNBK used for spin locks capable of shared
as well as exclusive access. These entries represent the
states of the CPUs that either hold or are waiting for
this lock. SYNBX contains four entries, one for each
potential state that a CPU can be in with respect to the
lock. That is, it is either waiting for shared or
exclusive access or holding it in one of those two modes.
Each entry is mapped by the SYNBXENT DSECT.
Hex Dec Type/Val Lng Label (dup) Comments
---- ---- --------- ---- -------------- --------
0000 0 Structure SYNBX FORMAL SPIN LOCK CONTROL BLOCK
0000 0 Bitstring 24 SYNBXW4S Waiting for a share entry
0018 24 Bitstring 24 SYNBXHLS Held shared entry
0030 48 Bitstring 24 SYNBXW4X Waiting for exclusive entry
0048 72 Bitstring 24 SYNBXHLX Held exclusive entry
00000060 SYNBXBSZ *-SYNBX Size of SYNBK extension
in bytes
0000000C SYNBXDWS (*-SYNBX+7)/8 Size of SYNBK
extension in DWs
Mapping of each of the four elements in the SYNBX.
Hex Dec Type/Val Lng Label (dup) Comments
---- ---- --------- ---- -------------- --------
0000 0 Structure SYNBXENT FORMAL SPIN LOCK CONTROL BLOCK
0000 0 Dbl-Word 8 SYNBXMSK CPU bit mask representing CPUs in
the associated state (not used
for SYNBXHLX)
0008 8 Signed 4 SYNBXATT Count of attempts to identify a
diagnose x'9C' target
000C 12 Signed 4 SYNBXFTG Count of times target was found
0010 16 Signed 4 SYNBXPTC Count of potential targets
considered (for which a SIGP SRS
was performed)
0014 20 Signed 4 * Reserved for future IBM use
00000018 SYNBXELN *-SYNBXENT Size of an entry in
bytes
| |