From b50c8667e5853b519b043926e3f109e4338f9a57 Mon Sep 17 00:00:00 2001 From: Irek Fakhrutdinov Date: Tue, 30 Jun 2020 20:03:25 +0200 Subject: [PATCH] Check if XMEM runs as a reusable address space The use of a cross-memory server without REUSASID=YES may result in an ASID shortage. This commit adds a check and prints a warning message informing the user about that. Signed-off-by: Irek Fakhrutdinov --- c/crossmemory.c | 31 +++++++++++++++++++++++++++---- h/crossmemory.h | 6 ++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/c/crossmemory.c b/c/crossmemory.c index 014dd3db5..fb3fd239c 100644 --- a/c/crossmemory.c +++ b/c/crossmemory.c @@ -4004,11 +4004,16 @@ static int verifySTEPLIB(CrossMemoryServer *srv) { return RC_CMS_OK; } -#define MAIN_WAIT_MILLIS 10000 -#define START_COMMAND_HANDLING_DELAY_IN_SEC 5 -#define STCBASE_SHUTDOWN_DELAY_IN_SEC 5 +static bool isReusableASID(void) { -int cmsStartMainLoop(CrossMemoryServer *srv) { + const char ascbreus = 0x40; + + ASCB *ascb = getASCB(); + + return ascb->ascbflg3 & ascbreus; +} + +static int testEnvironment(void) { int authStatus = testAuth(); if (authStatus != 0) { @@ -4023,6 +4028,24 @@ int cmsStartMainLoop(CrossMemoryServer *srv) { return RC_CMS_BAD_SERVER_KEY; } + if (!isReusableASID()) { + zowelog(NULL, LOG_COMP_ID_CMS, ZOWE_LOG_WARNING, CMS_LOG_REUSASID_NO_MSG); + } + + return RC_CMS_OK; +} + +#define MAIN_WAIT_MILLIS 10000 +#define START_COMMAND_HANDLING_DELAY_IN_SEC 5 +#define STCBASE_SHUTDOWN_DELAY_IN_SEC 5 + +int cmsStartMainLoop(CrossMemoryServer *srv) { + + int envStatus = testEnvironment(); + if (envStatus != 0) { + return envStatus; + } + int rcvrPushRC = recoveryPush( "cmsStartMainLoop", RCVR_FLAG_RETRY | RCVR_FLAG_DELETE_ON_RETRY | RCVR_FLAG_PRODUCE_DUMP, diff --git a/h/crossmemory.h b/h/crossmemory.h index 45fad34c9..c9797bc40 100644 --- a/h/crossmemory.h +++ b/h/crossmemory.h @@ -857,6 +857,12 @@ CrossMemoryServerName cmsMakeServerName(const char *nameNullTerm); #define CMS_LOG_DEV_MODE_ON_MSG_TEXT "Development mode is enabled" #define CMS_LOG_DEV_MODE_ON_MSG CMS_LOG_DEV_MODE_ON_MSG_ID" "CMS_LOG_DEV_MODE_ON_MSG_TEXT +#ifndef CMS_LOG_REUSASID_NO_MSG_ID +#define CMS_LOG_REUSASID_NO_MSG_ID CMS_MSG_PRFX"0248W" +#endif +#define CMS_LOG_REUSASID_NO_MSG_TEXT "Address space is not reusable, start with REUSASID=YES to prevent an ASID shortage" +#define CMS_LOG_REUSASID_NO_MSG CMS_LOG_REUSASID_NO_MSG_ID" "CMS_LOG_REUSASID_NO_MSG_TEXT + #endif /* H_CROSSMEMORY_H_ */