How to Determine the Amount of Memory Used By the System Firmware From the IBM i Command Line

Abstract

This document describes and contains a program that can be used to determine the amount of memory that is currently allocated (reserved) to the System Firmware (Hypervisor), straight from the IBM i command line. The program name is DSPFMWMEM.

Written by: Matias Centeno Lozada
IBM® AS/400®, iSeries™, System i™, and Power Systems™ SW Support Specialist
MTS - IBM Argentina Support Center

Contents


On a Hardware Management Console (HMC) managed system or VIOS-managed system you can use the following command-line interface (CLI) commands to determine the amount of memory that is currently allocated (reserved) to the System Firmware (Hypervisor). (Note that all the values used in this document are expressed in megabytes.)

HMC
hscpe:/home/hscpe:> lshwres -r mem -m 8233-E8B*10086EP --level sys -F sys_firmware_mem --header
sys_firmware_mem
6880

VIOS
padmin:/home/padmin:> lshwres -r mem -m 7998-61X*061632A --level sys -F sys_firmware_mem --header
sys_firmware_mem
1280

On a VPM-managed system there is no command to determine the amount of memory that is currently allocated (reserved) to the System Firmware (Hypervisor). Something that could work is to do some math using SST and subtracting the result from the total amount of memory installed returned by DSPHDWRSC TYPE(*PRC).

VPM
Follow these steps:

1. Run the DSPHDWRSC TYPE(*PRC) command . You will get the Display Processor Resources panel (Figure 1).


Display Processor Resources
System: XXXXXXXX
Type options, press Enter.
7=Display resource detail

Opt Resource Type-model Status Text
_ CEC01 9409-E8A Operational Main Card Enclosure
_ PN01 296C Operational System Control Panel
_ MP01 53E1 Operational System Processor Card
_ MP02 53E1 Operational System Processor Card
_ MP03 53E1 Operational System Processor Card
_ MP04 53E1 Operational System Processor Card
_ PV01 52AE Operational Processor Capacity Card
_ SP01 28A3 Operational Service Processor Card
_ BCC01 Operational Bus Adapter
_ BCC02 28A3 Operational Bus Adapter
_ BCC03 28A3 Operational Bus Adapter
_ BCC04 28A3 Operational Bus Adapter
_ BCC05 28A3 Operational Bus Adapter
_ BCC06 28A3 Operational Bus Adapter
_ BCC07 28A3 Operational Bus Adapter
More...
F3=Exit F5=Refresh F6=Print F12=Cancel
Figure 1. Display Processor Resources panel


2. Page down until you see the Main Storage Card Resources panel (Figure 2).


Display Processor Resources
System: XXXXXXXX
Type options, press Enter.
7=Display resource detail

Opt Resource Type-model Status Text
_ BCC08 28A3 Operational Bus Adapter
_ BCC09 28A3 Operational Bus Adapter
_ MS01 31AA Operational 1024MB Main Storage Car
_ MS02 31AA Operational 1024MB Main Storage Car
_ MS03 31AA Operational 1024MB Main Storage Car
_ MS04 31AA Operational 1024MB Main Storage Car
_ MS05 31AA Operational 1024MB Main Storage Car
_ MS06 31AA Operational 1024MB Main Storage Car
_ MS07 31AA Operational 1024MB Main Storage Car
_ MS08 31AA Operational 1024MB Main Storage Car
_ BC01 28A3 Operational HSL I/O Bridge
_ BC02 28A3 Operational HSL I/O Bridge



Bottom
F3=Exit F5=Refresh F6=Print F12=Cancel
Figure 2. Main Storage Card Resources panel


Calculate the total amount of memory installed by adding the memory capacity of each card. Write down the result.

3. Start the System Service Tools (STRSST), select option 5 (Work with system partitions), and press Enter. You will see the Work with System Partitions panel (Figure 3).


Work with System Partitions
System: XXXXXXXX
Attention: Incorrect use of this utility can cause damage
to data in this system. See service documentation.

Number of partitions . . . . . . . : 4
Partition release . . . . . . . . . : V7R1M0

Partition identifier . . . . . . . : 1
Partition name . . . . . . . . . . : ZD8AP1 *

Select one of the following:


2. Work with partition status
3. Work with partition configuration
4. Clear configuration data
5. Create a new partition

Selection
_

F3=Exit F12=Cancel
Figure 3. Work with System Partitions panel


4. Select option 3 (Work with partition configuration) and press Enter. You will see the Work with Partition Configuration panel (Figure 4).


Work with Partition Configuration
System: XXXXXXX
Available processor units . . . . : 2.70
Available memory (MB) . . . . . . : 672
Memory region size (MB) . . . . . : 32

Type option, press Enter.
1=Display 2=Change 9=Delete

Virtual
Partition ---------Processor---------- Memory Ethernet ID
Opt ID Name Total Units Uncap Weight (MB) WLM 1 2 3 4
_ 1 ZD8AP1 1 1.00 1 Med 2048 2 1 2 2 2
_ 2 XPF71 1 0.10 1 Med 2048 2 3 2 2 2
_ 3 XPF61 1 0.10 1 Med 1536 2 3 2 2 2
_ 4 IBMIDEMO 1 0.10 1 Med 1024 2 3 2 2 2






F3=Exit F5=Refresh F11=Work with partition status F12=Cancel
Figure 4. Work with Partition Configuration panel


Calculate the total amount of memory available for partitions by adding the available memory and the memory allocated to each partition. Write down the result.

5. Press F16, F3, and Enter to exit SST.

6. Do the math: Subtract the value obtained in step 4 from the value obtained in step 2:

(1024*8) - (672+2048+2048+1536+1024) = 864

Fortunately, there is an easier, faster, accurate way to determine the amount of memory that is currently allocated (reserved) to the System Firmware (Hypervisor) through the invocation of the ILE builtin _MATMATR1 (MATMATR MI instruction).


Example program that uses the MATMATR instruction to retrieve the amount of memory currently allocated to the System Firmware

The following program demonstrates how to use the selection value X'01E0' of the MATMATR instruction to determine the amount of memory allocated (reserved) to the System Firmware (Hipervisor):

BEGIN: PGM
DCL VAR(&MATMATR) TYPE(*CHAR) LEN(121)
DCL VAR(&BYTESIN) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR)
DCL VAR(&BYTESOUT) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR 5)
DCL VAR(&SYSFMWMEM) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR 81)
DCL VAR(&DSPFMWMEM) TYPE(*CHAR) LEN(10)
/* */
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) VALUE('CPF9898')
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) VALUE('QCPFMSG')
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) +
VALUE('*LIBL')
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
DCL VAR(&MSGTYPE) TYPE(*CHAR) LEN(10) +
VALUE('*COMP')
/* */
DCL VAR(&SCLEN) TYPE(*DEC) LEN(3 0) VALUE(10)
DCL VAR(&SCSTART) TYPE(*DEC) LEN(3 0) VALUE(1)
DCL VAR(&SCPATTERN) TYPE(*CHAR) LEN(1) VALUE('0')
DCL VAR(&SCPATTERNL) TYPE(*DEC) LEN(3 0) VALUE(1)
DCL VAR(&SCTRANSC) TYPE(*CHAR) LEN(1) VALUE('0')
DCL VAR(&SCTRIMC) TYPE(*CHAR) LEN(1) VALUE('1')
DCL VAR(&SCWILCARD) TYPE(*CHAR) LEN(1) VALUE(' ')
DCL VAR(&SCPOS) TYPE(*DEC) LEN(3 0)
DCL VAR(&SCFROM) TYPE(*DEC) LEN(3 0)
DCL VAR(&SCQTY) TYPE(*DEC) LEN(3 0)
/* */
MONMSG MSGID(CPC0000 CPD0000 CPF0000 MCH0000) +
EXEC(GOTO CMDLBL(ERROR))
/* */
CHGVAR VAR(%BIN(&BYTESIN)) VALUE(121)
CALLPRC PRC('_MATMATR1') PARM((&MATMATR *BYREF) +
(X'01E0' *BYREF))
CHGVAR VAR(&DSPFMWMEM) VALUE(%BIN(&SYSFMWMEM 1 4))
/* */
EDIT: CALL PGM(QCLSCAN) PARM(&DSPFMWMEM &SCLEN &SCSTART +
&SCPATTERN &SCPATTERNL &SCTRANSC &SCTRIMC +
&SCWILCARD &SCPOS)
IF COND(&SCPOS > 0 & &SCPOS < &SCLEN & &SCPOS = +
&SCSTART) THEN(DO)
CHGVAR VAR(%SST(&DSPFMWMEM &SCPOS 1)) VALUE(' ')
CHGVAR VAR(&SCFROM) VALUE(&SCPOS)
CHGVAR VAR(&SCSTART) VALUE(&SCSTART + 1)
GOTO CMDLBL(EDIT)
ENDDO
CHGVAR VAR(&SCQTY) VALUE(&SCLEN - &SCSTART + 1)
CHGVAR VAR(&DSPFMWMEM) VALUE(%SST(&DSPFMWMEM +
&SCSTART &SCQTY))
/* */
CHGVAR VAR(&MSGDTA) VALUE('System Firmware Memory +
(in megabytes): ' |> &DSPFMWMEM)
GOTO CMDLBL(END)
/* */
ERROR: RCVMSG MSGTYPE(*EXCP) RMV(*YES) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFLIB)
CHGVAR VAR(&MSGTYPE) VALUE('*ESCAPE')
/* */
END: SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(&MSGTYPE)
ENDPGM


Putting it to work

Follow these instructions from an IBM® i command line:

1. Use the Start Source Entry Utility (STRSEU) command to add a source member called DSPFMWMEM to the QGPL/QCLSRC source physical file:

STRSEU SRCFILE(QGPL/QCLSRC) SRCMBR(DSPFMWMEM) TYPE(CLLE) OPTION(2)
TEXT('Display Firmware Memory')

2. Paste the CLLE code example for program DSPFMWMEM and save the member.

3. Use the Create Bound CL Program (CRTBNDCL) command to compile the CLLE program DSPFMWMEM into the QGPL library:

CRTBNDCL PGM(QGPL/DSPFMWMEM) SRCFILE(QGPL/QCLSRC) OUTPUT(*NONE) USRPRF(*OWNER)
LOG(*NO) ALWRTVSRC(*NO) REPLACE(*YES)



How it works

The program DSPFMWMEM uses the ILE builtin _MATMATR1 (MATMATR MI instruction) to determine the amount of memory that is currently allocated (reserved) to the System Firmware (Hypervisor). When you issue the CALL PGM(QGPL/DSPFMWMEM) command to run the program, it sends a completion message with the result.

These were the results obtained after we ran the program on the three systems used when writing this document:
  • HMC: System Firmware Memory (in megabytes): 6880.
  • VIOS: System Firmware Memory (in megabytes): 1280.
  • VPM: System Firmware Memory (in megabytes): 864.

If you compare the values with the ones obtained using the CLI commands (HMC and VIOS) and using DSPHDWRSC and SST, you will see that they match.

For further information about MATMATR MI instruction and the machine interface in general, see the IBM i 7.1 Information Center at the following web pages:

Special Notices

This material has not been submitted to any formal IBM test and is published AS IS. It has not been the subject of rigorous review. IBM assumes no responsibility for its accuracy or completeness. The use of this information or the implementation of any of these techniques is a client responsibility and depends upon the client's ability to evaluate and integrate them into the client's operational environment.

Contact an IBM Sales Specialist


Profile

Publish Date
06 October 2011


Rating: Not yet rated


Author(s)

IBM Form Number
TIPS0841