CPU offlining

The CPU offlining feature allows a privileged application to stop procnto from using a CPU for scheduling threads.

Note:
Currently, the offlining and onlining scheduling feature is experimental.

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.

The following steps describe the process of taking a CPU offline:
  1. 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.

  2. 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.
  3. 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.
Once these steps are complete, the thread can run software outside of the QNX OS.
When the application is ready to give back the CPU to procnto, it needs to do the following:
  1. Reclaim its timers via a TimerDelegate() call with the _NTO_TIMER_RECLAIM action set.
  2. Mark the CPU as online via a SchedCtl() call with the SCHED_PROCESSOR_ONLINE command set.
Once these steps are complete, you can use the thread as usual and even use it to offline another CPU.
Page updated: