HPlogo HP-UX MultiProcessing: White Paper > Chapter 1 MultiProcessing

MP Data Structures

» 

Technical documentation

Complete book in PDF

 » Table of Contents

The kernel maintains an MP data structure (typedef struct mpinfo) that is an array containing system-global per-processor information indexed by SPU number (the hard physical address (HPA) of each processor). The structure and its components are documented in the mp.h header file. The kernel variable mpproc_info points to the start of the structure. The kernel variable mpproc_info[nmpinfo] points to the end of the array.

Figure 1-3 Scope of information in MP data structures

[Scope of information in MP data structures]

The general content of each mpinfo entry is shown in the table that follows.

Table 1-1 MP information accessed through mpinfo_t

MP informationPurpose

spinlock information

Number of spinlocks held, spl level at first spinlock taken, pointer to list of spinlocks currently held, current critical spinlock, data on time spent spinning.

Interrupt vector data

Pointer to interrupt vector address (IVA), locations of base and top of interrupt stack, pointer to interrupt status word, deferred interrupts.

per-processor counters and statistics

struct mpcntrs

Array containing:

  • Numbers of actual reads and writes to file-system blocks, NFS reads and writes, bytes read via NFS, physical reads and writes issued.

  • Number of times run queue was occupied since bootup; numbers of execs, read/readv(), write/writev(), filename lookups, inode fetches, select() calls, System V semaphore and message operations, mux I/O transfers, raw characters read, characters output since bootup.

  • Numbers of active process, thread, inode, and file entries allocated by the SPU.

coprocessor information

struct coproc_info

Two 8-bit masks, positioned 0-7; bit 7 corresponds to GR 31. Both elements are 0xC0 if floating point coprocessor is present.

  • ccr_present -to indicate the presence of coprocessor(s).

  • ccr_enable - indicates coprocessor(s) has passed self-test.

Threads information

Current process priority, indication of whether thread is on the processor, pointer to active thread structure, space ID of thread's uarea, setting for thread / SPU preemption.

Model information

struct model_info

Hardware version (CPU type and speed) and ID, software version, ID, and capability, boot ID, architectural revision, potential and current keys.

architecture revision (arch_rev) identifies PA-RISC level of the CPU:

  • 0 - PA-RISC 1.0

  • 4 - PA-RISC 1.1

  • 8 - PA-RISC 2.0

Time of day information

struct tod_info

Values for normalization and synchronization of interval timer.

Powerfail information

struct pf_info

Powerfail state, interval timer ticks remaining, and exit state

Run queue information

struct mp_rq

Includes index into an array of run queue pointers (bestq), average run-queue length (neavg_on_rq) for load balancing, active locked and unlocked run queues by SPU and type of lock, interval timing and run-queue spinlock pointers.

CPU status

The current state of a processor handling a process is represented by one of the following values:

  • MPBLOCK waiting on kernel spinlock

  • MPIDLE idle

  • MPUSER executing in user mode

  • MPSYS executing in system mode

  • MPSWAIT waiting on a kernel semaphore

 

Per-Processor Counters and Statistics

The statistics tracked through the mpcntrs structure can be beneficial in comparing the activities of different processors. From this you may be able to determine which processor is handling the majority of NFS traffic or other specific filesystem type activity.

Perhaps the most interesting counters in this structure are the counts for active processes, threads, inodes, and files.

Table 1-2 Counters tracked in struct mpcntrs

Counter Purpose

activeprocs

Count of the number of processes created by the SPU (number of proc table entries). This count in incremented in allocproc() and decremented in freeproc().

activethreads

Count of number of threads created by the SPU (number of thread table entries). This count is incremented in allocthread() and decremented in freethread().

activeinodes

Count of how many inodes have been allocated by the SPU (number of inode table entries). The count is incremented whenever an inode is removed from the free list by routines such as ieget(), and vx_inoalloc().

activefiles

Count of the number of file table entries allocated by the SPU. The count is incremented in falloc() and decrement whenever a filetable entry is freed by a call to FPENTRYFREE().

 

These counters track the number of active (in-use) entries for each of the respective kernel tables. These counters must be summed across all running processors to obtain the total number of active entries for each table. The decision as to which processor's mpinfo structure to increment or decrement is based on identification of the current processor. If a process is created on SPU A but later terminates while running on SPU B, the activeprocs counter will be incremented on SPU A but decremented on SPU B.