CPU offlining
The CPU offlining feature allows a privileged application to stop procnto from using a CPU for scheduling threads.
This feature is useful for the following:
- Powering down a CPU (e.g., for lower workloads).
- Temporarily running software outside of the QNX OS (e.g., CPU diagnostics).
- Putting the system to sleep.
The privileged application runs a high priority thread (that can't be preempted) and tells procnto to stop using the CPU. This allows the thread to do its work outside of the QNX OS. Note that, when procnto isn't using the CPU, OS functionalities aren't available because any action that may cause the thread to context switch can make the system unstable.
To take a CPU offline, you must use procnto's -C option to lower the clock IST to a maximum of 253. You need to leave a gap between the priorities of the clock IST and the IPI IST, which is 255.
- Assign the SCHED_OFFLINING scheduling policy to a thread via the
SchedSet() call. The
application must have the PROCMGR_AID_RUNSTATE ability enabled to
set the policy. Note:An application needs a thread with the SCHED_OFFLINING policy set for every CPU being taken offline.
The thread then increases its priority over that of the clock IST. The thread must also set its runmask to the one representing the CPU that it will take offline.
- Offload the software timers queued on the CPU being taken offline to another CPU
via a TimerDelegate() call
with the _NTO_TIMER_DELEGATE action set. The application must
delegate its timers to another CPU that isn't offline.Note:Some software timers may be ticking away on a queue owned by the CPU that you want to take offline. Therefore, they must be handed off to another CPU during the CPU offlining.
- Instruct the scheduler to stop scheduling other threads on the CPU being taken offline via a SchedCtl() call with the SCHED_PROCESSOR_OFFLINE command set.
- Reclaim its timers via a TimerDelegate() call with the _NTO_TIMER_RECLAIM action set.
- Mark the CPU as online via a SchedCtl() call with the SCHED_PROCESSOR_ONLINE command set.