diff --git a/Documentation/implementation/critical_sections.rst b/Documentation/implementation/critical_sections.rst index 227935b012..7448a313d9 100644 --- a/Documentation/implementation/critical_sections.rst +++ b/Documentation/implementation/critical_sections.rst @@ -208,12 +208,71 @@ a Critical Section Monitor. This is internal instrumentation that records the time that a task holds a critical section. It also records the amount of time that interrupts are disabled globally. The Critical Section Monitor then retains the maximum time that the critical section is in place, both per-task and globally. +We also extend the critical section monitor to do task sched cost statistics, which +can high effectively do cpuload statistic. In order to save not necessary cost when +you only focus on specific feature, we isolate the crtimon features to difference +configurations. Allow you only open some of the features to minimum the side effect +of the performance etc. The Critical Section Monitor is enabled with the following setting in the -configuration:: +configurations:: CONFIG_SCHED_CRITMONITOR=y +Enable sched critmon globally, all other features need this configuration as a prefix. + +**Thread executing**:: + + CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD=0 + +* Default 0 to enable executing time statistic, and make it a source to support cpuload. +* > 0 to also do alert log when executing time above the configuration ticks. +* -1 to disable thread executing time statistic feature. + +This method is **recommend** as a cpuload backend if you don't have more requirements +in critmon. When disabled all other statistics in critmon, this method is a high +efficiency way do cpu load statistic. As we did not add hooks to critical sections +and preemption operations. Only have instructions when scheduler triggers context switch. + +**Workq executing**:: + + CONFIG_SCHED_CRITMONITOR_MAXTIME_WQUEUE=-1 + +* Default -1 to disable workq queue max execution time +* > 0 to do alert log when workq executing time above the configuration ticks. + +**Preemption disabled time**:: + + CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION=-1 + +* Default -1 to disable preemption disabled time statistic. +* >= 0 to enable preemption disabled time statistic, data will be in critmon procfs. +* > 0 to also do alert log when preemption disabled time above the configuration ticks. + +**Critical section entered time**:: + + CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION=-1 + +* Default -1 to disable critical section entered time statistic. +* >= 0 to enable critical section entered time statistic, data will be in critmon procfs. +* > 0 to also do alert log when critical section entered time above the configuration ticks. + +**Irq executing time**:: + + CONFIG_SCHED_CRITMONITOR_MAXTIME_IRQ=-1 + +* Default -1 to disable irq executing time statistic. +* >= 0 to enable irq executing time statistic, data will be in critmon procfs. +* > 0 to also do alert log when irq executing time above the configuration ticks. + +**Wdog executing time**:: + + CONFIG_SCHED_CRITMONITOR_MAXTIME_WDOG=-1 + +* Default -1 to disable wdog executing time statistic. +* >= 0 to enable wdog executing time statistic, data will be in critmon procfs. +* > 0 to also do alert log when wdog executing time above the configuration ticks. + **Perf Timers interface** .. todo:: missing description for perf_xxx interface