Crazy Scheduler

This document describes the crazy scheduler tool.

Introduction

The adding of new functionality to the kernel has meant that Inter-Process Communication (IPC) is no longer deterministic. The crazy scheduler is a tool that is designed to simulate the effect of IPC calls occurring at any time. With this tool, developers can check that their code will still work with the latest version of the kernel.

Crazy scheduler has two modes of operation:

  • Crazy delays

  • Crazy priorities

Note: Both modes of operation should not be enabled simultaneously since this could cause the system to deadlock.

Ideally, the test cases should be run twice (once with each mode of the crazy scheduler).

Crazy delay mode

This mode is used to test the effect of a delay in threads moving between states.

Crazy priority mode

This mode is used to test the effect of no longer being able to rely on thread priority to synchronize IPC calls. In this mode, an IPC call can occur at any time.

Prerequisites

Your build should have the crazy scheduler present. It is present in the udeb version of a build and is disabled by default.

Limitations

Crazy scheduler will only work on the udeb version of a build. Crazy scheduler in crazy priority mode does not impact the system as heavily as the crazy scheduler in crazy delay mode. Crazy Priority mode can only be enabled at ROM time or boot time (for the emulator). Do not expect this tool to find all the issues associated with IPC and synchronization. The crazy delay mode will slow the system down.

Note: When a build is booting with the crazy scheduler in crazy delay mode enabled, the booting process can take a long time. In fact it can appear that it has hung. To reduce the boot time, it is advisable to do the following:
  • Format the user NAND (C:) partition using a regular ROM image before booting the build with the crazy scheduler enabled.

It is advisable to execute the crazy scheduling tests on both the emulator and on hardware.

How to enable the crazy scheduler

The Crazy scheduler can be used on both the emulator and hardware builds.

Enabling for hardware

If the crazy scheduler is to be executed on hardware, then there are two ways to enable it:

  • Add the parameters -DCRAZYSCHEDDELAY (for the crazy delay) or -DCRAZYSCHEDPRIO (for crazy priority) to the buildrom arguments. Do not enable both parameters at the same time.

There are other ways of enabling the two modes of the crazy scheduler:

  • To enable the crazy priorities mode, include the following line into the relevant iby/oby file:

    CRAZYSCHEDULING(on)

  • To enable the crazy delay mode , include the following line into the relevant iby/oby file:

    kerneltrace 0x80000000 0 0x20 0 0 0 0 0

Enabling for the emulator

If the crazy scheduler is to run on the emulator, then:

  • To enable crazy delays, add the following line to the \epoc\data\epoc.ini file:

    debugmask2 0x20

  • To enable crazy priorities, add the following line to the \epoc32\data\epoc.ini file:

    crazyscheduling on

Note: Do not enable both crazy delays and crazy priorities on at once.

Runtime enabling

The crazy delays can be toggled on or off at runtime.

To do this, EShell must be running. The following commands can be used from within EShell:

Command

Description

trace on 69

Enable crazy delays

trace off 69

Disable crazy delays

Note: Crazy priority cannot be toggled on or off at runtime.

State of the crazy scheduler

The state of the crazy scheduler can be obtained by executing the following in EShell:

  • sysinfo

The output will tell you which of the crazy scheduler modes are enabled or disabled.

How to obtain the output from the crazy scheduler

The crazy scheduler does not produce output as such, instead it is expected to work in conjunction with other test tools. The only output from this tool is whether an application will still work or not.

How to interpret the output from the crazy scheduler

As for above.

Related concepts
SMP Tools Overview