sysmp(2) sysmp(2) NAME sysmp - multiprocessing control C SYNOPSIS #include <sys/types.h> #include <sys/sysmp.h> #include <sys/sysinfo.h> /* for SAGET and MINFO structures */ int sysmp (int cmd, ...); ptrdiff_t sysmp (int cmd, ...);" DESCRIPTION sysmp provides control over and information about miscellaneous system services. This system call is usually used by system programs and is not intended for general use. The arguments arg1, arg2, arg3, arg4 are provided for command-dependent use. As specified by cmd, the following commands are available: MP_CLEARCFSSTAT MP_CLEARNFSSTAT MP_NUMA_GETCPUNODEMAP MP_NUMA_GETDISTMATRIX These are all interfaces that are used to implement various system library functions. They are all subject to change and should not be called directly by applications. MP_PGSIZE The page size of the system is returned (see getpagesize(2)). MP_SCHED Interface for the schedctl(2) system call. MP_NPROCS Returns the number of processors physically configured. MP_NAPROCS Returns the number of processors that are available to schedule unrestricted processes. MP_STAT The processor ids and status flag bits of the physically configured processors are copied into an array of pda_stat structures to which arg1 points. The array must be large enough to hold as many pda_stat structures as the number of processors returned by the MP_NPROCS sysmp command. The pda_stat structure and the various status bits are defined in <sys/pda.h>. MP_EMPOWER The processor number given by arg1, interpreted as an 'int', is empowered to run any unrestricted processes. This is the default for all processors. This command requires superuser authority. MP_RESTRICT The processor number given by arg1, interpreted as an 'int', is restricted from running any processes except those assigned to it by a MP_MUSTRUN or MP_MUSTRUN_PID command, a runon(1) command or because of hardware necessity. Note that processor 0 cannot be restricted. This command requires superuser authority. On Challenge Series machines, all timers belonging to the processor are moved to the processor that owns the clock as reported by MP_CLOCK. MP_ISOLATE The processor number given by arg1, interpreted as an 'int', is isolated from running any processes except those assigned to it by a MP_MUSTRUN command, a runon(1) command or because of hardware necessity. Instruction cache and Translation Lookaside Buffer synchronization across processors in the system is minimized or delayed on an isolated processor until system services are requested. Note that processor 0 cannot be isolated. This command requires superuser authority. On Challenge Series machines, all timers belonging to the processor are moved to the processor that owns the clock as reported by MP_CLOCK. MP_UNISOLATE The processor number given by arg1, interpreted as an 'int', is unisolated and empowered to run any unrestricted processes. This is the default system configuration for all processors. This command requires superuser authority. MP_PREEMPTIVE The processor number given by arg1, interpreted as an 'int', has its clock scheduler enabled. This is the default for all processors. Note that this command implies MP_PERMITRTC which can be seen below. Clock scheduling cannot be changed on an excluded processor. This command requires superuser authority. MP_NONPREEMPTIVE The processor number given by arg1, interpreted as an 'int', has its clock scheduler disabled. Normal process time slicing is no longer enforced on that processor. As a result of turning off the clock interrupt, the interrupt latency on this processor will be lower. Note that this command implies MP_WARDRTC which can be seen below. The Real-Time Clock can be re-permitted by a subsequent use of MP_PERMITRTC if so desired. This command requires superuser authority and is allowed only on an isolated processor. Clock scheduling cannot be changed on an excluded processor. This command is not allowed on the clock processor (see MP_CLOCK). MP_CLOCK The processor number given by arg1, interpreted as an 'int', is given charge of the operating system software clock (see timers(5)). Clock handling cannot be assigned to an excluded processor. This command requires superuser authority. MP_FASTCLOCK The processor number given by arg1, interpreted as an 'int', is given charge of the operating system software fast clock (see timers(5)). Clock handling cannot be assigned to an excluded processor. This command requires superuser authority. MP_WARDRTC The processor number given by arg1, interpreted as an 'int', queues interrupts from the Real-Time Clock (RTC) created by timeouts and interval timers created by threads running on the processor to other processors. RTC interrupts will not be queueable to the processor from other processors. This command is not allowed on the Clock processor nor processor 0. This command requires superuser authority. MP_PERMITRTC The processor number given by arg1, interpreted as an 'int', will be permitted to handle RTC interrupts created by timeouts and interval timers. This command requires superuser authority. MP_MISER_GETREQUEST MP_MISER_SENDREQUEST MP_MISER_RESPOND MP_MISER_GETRESOURCE MP_MISER_SETRESOURCE MP_MISER_CHECKACCESS These are all interfaces that are used to implement various miser(1) functions. These are all subject to change and should not be called directly by applications. MP_MUSTRUN Assigns the calling process to run only on the processor number by arg1, interpreted as an 'int', except as required for communications with hardware devices. After a sucessful assignment to a cpu, any subsequent fork or sproc call that creates a new process is also assigned to the same cpu as the parent (see fork(2) and sproc(2)). Processes cannot be assigned to an excluded processor. A process that has allocated a CC sync register (see ccsync(7m)) is restricted to running on a particular cpu. Attempts to reassign such a process to another cpu will fail until the CC sync register has been relinquished. This command should not be used within a pthreaded application (see pthread_setrunon_np(3P)). There are two tuneable system parameters in the dynamic parameter group miser that affect the operation of MP_MUSTRUN. The boolean parameter cpuset_nobind, if set to '0' or false, has no affect. When this parameter is set to '1' (true), no process running in a cpuset can assign itself or child to any CPU. The boolean parameter cpuset_tobind, if set to '0' or false, has no affect. When this parameter is set to '1' (true), the CPU being bound to must be restricted, isolated, or part of a cpuset(1). MP_MUSTRUN_PID Assigns the process specified by arg2 to run only on the processor number specified by arg1, both interpreted as 'int', except as required for communications with hardware devices. After a sucessful assignment to a cpu, any subsequent fork or sproc call performed by the specified process that creates a new process is also assigned to the same cpu as the parent (see fork(2) and sproc(2)). Processes cannot be assigned to an excluded processor. A process that has allocated a CC sync register (see ccsync(7m)) is restricted to running on a particular cpu. Attempts to reassign such a process to another cpu will fail until the CC sync register has been relinquished. This command will give unpredictable results if the specified process is a pthreaded process. There are two tuneable system parameters in the dynamic parameter group miser that affect the operation of MP_MUSTRUN_PID. The boolean parameter cpuset_nobind, if set to '0' or false, has no affect. When this parameter is set to '1' (true), no process running in a cpuset can assign itself or child to any CPU. The boolean parameter cpuset_tobind, if set to '0' or false, has no affect. When this parameter is set to '1' (true), the CPU being bound to must be restricted, isolated, or part of a cpuset(1). MP_GETMUSTRUN Returns the processor the current process has been set to run on using the MP_MUSTRUN command. If the current process has not been assigned to a specific processor, -1 is returned and errno is set to EINVAL. This command should not be used within a pthreaded application (see pthread_setrunon_np(3P)). MP_GETMUSTRUN_PID Returns the processor that the process specified by arg1 has been set to run on using the MP_MUSTRUN or MP_MUSTRUN_PID command. If the process has not been assigned to a specific processor, -1 is returned and errno is set to EINVAL. This command will give unpredictable results if the specified process is a pthreaded process. MP_RUNANYWHERE Frees the calling process to run on whatever processor the system deems suitable. MP_RUNANYWHERE_PID Frees the process specified by arg1 to run on whatever processor the system deems suitable. MP_KERNADDR Returns the address of various kernel data structures. The structure returned is selected by arg1. The list of available structures is detailed in <sys/sysmp.h>. This option is used by many system programs to avoid having to look in /unix for the location of the data structures. MP_SASZ Returns the size of various system accounting structures. As above, the structure returned is governed by arg1. MP_SAGET1 Returns the contents of various system accounting structures. The information is only for the processor specified by arg4. As above, the structure returned is governed by arg1. arg2 points to a buffer in the address space of the calling process and arg3 specifies the maximum number of bytes to transfer. MP_SAGET Returns the contents of various system accounting structures. The information is summed across all processors before it is returned. As above, the structure returned is governed by arg1. arg2 points to a buffer in the address space of the calling process and arg3 specifies the maximum number of bytes to transfer. MP_EXCLUDE The processor number given by arg1, interpreted as an 'int', is excluded from system use. Currently, this includes isolation in the same manner as the MP_ISOLATE command. In addition, the MP_EMPOWER, MP_RESTRICT, MP_ISOLATE, MP_UNISOLATE, MP_CLOCK, MP_FASTCLOCK, MP_PREEMPTIVE, MP_NONPREEMPTIVE, MP_MUSTRUN and MP_MUSTRUNPID commands cannot be applied to an excluded processor. This command requires superuser authority. On Challenge Series machines, all timers belonging to the processor are moved to the processor that owns the clock as reported by Note that processor 0 cannot be excluded. MP_UNEXCLUDE The processor number given by arg1, interpreted as an 'int', is unexcluded and empowered to run any unrestricted processes. This is the default system configuration for all processors. This command requires superuser authority. Possible errors from sysmp are: [EACCES] An attempt to bind a thread to a CPU using MP_MUSTRUN or MP_MUSTRUN_PID was made with the system tuneable parameter cpuset_tobind set to '1', and the CPU was not restricted, isolated, or part of a cpuset. [EPERM] The effective user ID is not superuser. Many of the commands require superuser privilege. [EPERM] The user ID of the sending process is not superuser, and its real or effective user ID does not match the real, saved, or effective user ID of the receiving process. [ESRCH] No process corresponding to that specified by a MP_MUSTRUN_PID, MP_GETMUSTRUN_PID, or MP_RUNANYWHERE_PID could be found. [EINVAL] The processor named by a MP_EMPOWER, MP_RESTRICT, MP_ISOLATE, MP_UNISOLATE, MP_CLOCK, MP_FASTCLOCK, MP_PREEMPTIVE, MP_NONPREEMPTIVE, MP_MUSTRUN, MP_MUSTRUNPID, MP_PERMITRTC or MP_WARDRTC command does not exist. [EINVAL] The cmd argument is invalid. [EINVAL] The arg1 argument to a MP_KERNADDR command is invalid. [EINVAL] An attempt was made via MP_MUSTRUN or MP_MUSTRUN_PID to move a process owning a CC sync register from the cpu controlling the CC sync register. [EINVAL] The target of the MP_GETMUSTRUN command has not been set to run on a specific processor. [EINVAL] The target process of the MP_MUSTRUN_PID command is a pthreaded process. [EINVALSTATE] The processor named by a MP_EMPOWER, MP_RESTRICT, MP_ISOLATE, MP_UNISOLATE, MP_CLOCK, MP_FASTCLOCK, MP_PREEMPTIVE, MP_NONPREEMPTIVE, MP_MUSTRUN or MP_MUSTRUNPID command is in excluded state. [EINVALSTATE] The processor named by a MP_EMPOWER command is in isolated state. [EINVALSTATE] The processor names by a MP_CLOCK command is in RTC warded state. [EINVALSTATE] The processor named by a MP_WARDRTC command is running the operating system software clock. [EBUSY] An attempt was made to restrict the only unrestricted processor or to restrict the master processor. [EBUSY] The processor named by an MP_EXCLUDE command is currently running processes assigned by the MP_MUSTRUN or MP_MUSTRUNPID commands. [EBUSY] The processor named by an MP_UNISOLATE command is currently running in non-preemptive mode. [EFAULT] An invalid buffer address has been supplied by the calling process. SEE ALSO mpadmin(1), runon(1), getpagesize(2), schedctl(2), pthread_setrunon_np(3P), timers(5) DIAGNOSTICS Upon successful completion, the cmd dependent data is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. Page 7