Skip to content

Commit

Permalink
Module registry initial implementation
Browse files Browse the repository at this point in the history
To address potential LPA shortages when multiple ZIS instances are
running on the same LPAR, a new feature--the module registry--has been
introduced.

The module registry is a set of data structures in common storage in
which eligible modules are traced. An eligible module is a module marked
with a special macro; the mark and the module names are then used to
uniquely identify the module. Once ZIS and its plug-in modules are
marked, they can be added to the registry and shared: if another ZIS
instance needs to load an identical module to the LPA, it will reuse
a previously registered (and loaded to the LPA) module instead. Sharing
identical modules should dramatically decrease the LPA footprint.

This feature must not be used when an application wants to remove its
modules from the LPA (e.g., ZIS does that in dev mode) because it will
affect any other applications using the same modules.

Fixes: #405

Signed-off-by: Irek Fakhrutdinov <[email protected]>
  • Loading branch information
ifakhrutdinov committed Sep 26, 2024
1 parent 954377e commit cce3dbf
Show file tree
Hide file tree
Showing 9 changed files with 727 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## `3.1.0`
- Bugfix: removed "ByteOutputStream" debug message, which was part of the `zwe` command output (#491)
- Enhancement: module registry (#405)

## `3.0.0`
- Feature: added javascript `zos.getStatvfs(path)` function to obtain file system information (#482).
Expand Down
53 changes: 53 additions & 0 deletions build_modreg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh
set -e

export _LD_SYSLIB="//'SYS1.CSSLIB'://'CEE.SCEELKEX'://'CEE.SCEELKED'://'CEE.SCEERUN'://'CEE.SCEERUN2'://'CSF.SCSFMOD0'"

xlc -S -M -qmetal -q64 -DSUBPOOL=132 -DMETTLE=1 -DMSGPREFIX=\"ZWE\" \
-qreserved_reg=r12 \
-DHAVE_METALIO=1 \
-Wc,langlvl\(extc99\),arch\(8\),agg,exp,list\(\),so\(\),off,xref,roconst,longname,lp64 \
-I h -I /usr/include/zos \
./c/modreg.c \
./c/alloc.c \
./c/isgenq.c \
./c/lpa.c \
./c/qsam.c \
./c/metalio.c \
./c/utils.c \
./c/timeutls.c \
./c/zvt.c \
./c/zos.c \
./tests/modregtest.c

for file in \
modreg \
alloc \
isgenq \
lpa \
qsam \
metalio \
utils \
timeutls \
zvt \
zos \
modregtest
do
as -mgoff -mobject -mflag=nocont --TERM --RENT -aegimrsx=${file}.asm ${file}.s
done

ld -V -b ac=1 -b rent -b case=mixed -b map -b xref -b reus -e main \
-o "//'${USER}.LOADLIB(MODREG)'" \
modreg.o \
alloc.o \
isgenq.o \
lpa.o \
qsam.o \
metalio.o \
utils.o \
timeutls.o \
zvt.o \
zos.o \
modregtest.o > MODREG.lnk


29 changes: 21 additions & 8 deletions c/crossmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "stcbase.h"
#include "utils.h"
#include "zvt.h"
#include "modreg.h"

#define CMS_STATIC_ASSERT($expr) typedef char p[($expr) ? 1 : -1]

Expand Down Expand Up @@ -3388,15 +3389,27 @@ static int allocateGlobalResources(CrossMemoryServer *server) {
globalArea->serverFlags |= server->flags;
globalArea->serverASID = getMyPASID();

/* Load the module to LPA if needed, otherwise re-use the existing module. */
/* Register modules or load the module to LPA if needed, otherwise re-use
* the existing module. */
if (moduleAddressLPA == NULL) {

int lpaAddRSN = 0;
int lpaAddRC = lpaAdd(&server->lpaCodeInfo, &server->ddname, &server->dsname,
&lpaAddRSN);
if (lpaAddRC != 0) {
zowelog(NULL, LOG_COMP_ID_CMS, ZOWE_LOG_SEVERE, CMS_LOG_LPA_LOAD_FAILURE_MSG, lpaAddRC, lpaAddRSN);
return RC_CMS_LPA_ADD_FAILED;
if (server->flags & CROSS_MEMORY_SERVER_FLAG_CLEAN_LPA) {
int lpaAddRSN = 0;
int lpaAddRC = lpaAdd(&server->lpaCodeInfo, &server->ddname,
&server->dsname, &lpaAddRSN);
if (lpaAddRC != 0) {
zowelog(NULL, LOG_COMP_ID_CMS, ZOWE_LOG_SEVERE,
CMS_LOG_LPA_LOAD_FAILURE_MSG, lpaAddRC, lpaAddRSN);
return RC_CMS_LPA_ADD_FAILED;
}
} else {
uint64_t modregRSN;
int modregRC = modregRegister(server->ddname, server->dsname,
&server->lpaCodeInfo, &modregRSN);
if (modregRC != 0) {
zowelog(NULL, LOG_COMP_ID_CMS, ZOWE_LOG_SEVERE,
CMS_LOG_MODREG_ADD_FAILURE_MSG, modregRC, modregRSN);
return RC_CMS_LPA_ADD_FAILED;
}
}
globalArea->lpaModuleInfo = server->lpaCodeInfo;

Expand Down
Loading

0 comments on commit cce3dbf

Please sign in to comment.