Mainframe Path Start learning free
Core11 min readLesson 2 of 3

Hosting Linux: LPARs, z/VM, KVM and s390x

Linux on Z can run directly in an LPAR or as a virtual guest under z/VM or KVM. Software must be built for the s390x architecture, which is 64-bit and big-endian, so most open-source code works but some binaries and assumptions do not.

Three ways to host Linux

Every mainframe is already virtualised at the hardware level: PR/SM firmware divides the machine into LPARs. Linux can sit directly in one of those, or a second hypervisor can run inside an LPAR and host many Linux guests.

Hosting options for Linux on IBM Z
Linux in an LPAR
One Linux image per LPARNo extra hypervisor layerSuits a few large systems such as a big databaseNumber of LPARs per machine is limited
z/VM guests
IBM's long-established mainframe hypervisorHundreds of guests per LPAR are commonStrong memory overcommit and sharingNeeds z/VM skills on the team
KVM guests
The Linux kernel hypervisor, built for s390xShipped in supported enterprise distributionsManaged with familiar tools such as libvirt and virshAttractive to teams with x86 KVM experience

z/VM in brief

z/VM gives each guest a virtual machine defined in a user directory: its memory, virtual processors, disks and network connections. The z/VM Control Program (CP) runs the guests. Linux guests are typically networked through a VSWITCH, a virtual switch in z/VM connected to physical OSA network adapters. Disks are usually minidisks carved from mainframe DASD, or SCSI disks attached through FCP channels.

Inside the guest, Linux sees ordinary block devices. The s390-tools package supplies Linux commands for the platform's devices, for example lsdasd to list DASD volumes, lsqeth for network devices and vmcp, which passes a CP command to z/VM from a guest that is allowed to issue it.

Listing DASD from a Linux guest (illustrative)
$ lsdasd
Bus-ID    Status    Name    Device  Type  BlkSz  Size      Blocks
==============================================================================
0.0.0201  active    dasda   94:0    ECKD  4096   7043MB    1803060
0.0.0202  active    dasdb   94:4    ECKD  4096   7043MB    1803060

Why s390x matters to software

s390x is the name Linux, compilers and container tools use for the 64-bit IBM Z architecture. Three practical consequences follow:

  1. Binaries must be built for s390x. An x86 binary will not run. Interpreted and bytecode languages (Java, Python, Node.js) and source-built code (C, C++, Go, Rust) usually work; closed-source x86-only software does not.
  2. It is big-endian. Code that reinterprets raw bytes as integers, or reads binary files written on x86, can silently produce wrong numbers. Well-written portable code handles byte order explicitly.
  3. Some optimisations are architecture-specific. Libraries with hand-tuned x86 assembler or SIMD intrinsics need an s390x code path or a generic fallback.
SoftwareUsually fine on s390x?What to check
Java applicationsYesAny bundled native libraries (JNI) need s390x builds
Python, Node.jsYesPackages with compiled extensions need s390x wheels or a build toolchain
Go, Rust, C, C++ from sourceUsuallyEndianness assumptions and x86-specific code
Vendor binary productsOnly if the vendor supports itThe vendor's platform support list
GPU-dependent workloadsNot a fitTypically better placed on other platforms

Operating the guests

Common mistakes

Copying an x86 binary to the guest

It will fail with an exec format error. Install the s390x package from the distribution or build from source on or for s390x.

Ignoring byte order when reading binary data

s390x is big-endian. Decode binary fields with explicit byte-order handling and test with real files from the producing system.

Diagnosing CPU only from inside the guest

Guests share physical IFLs. A guest can be starved by its neighbours even when its own top output looks normal; check hypervisor-level data.

What you will see at work

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
← Linux on the mainframe: IFLs and LinuxONEContainers, OpenShift and co-location with z/OS →