monitor_wip.rst 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Monitor wip
  2. ===========
  3. - Name: wip - wakeup in preemptive
  4. - Type: per-cpu deterministic automaton
  5. - Author: Daniel Bristot de Oliveira <bristot@kernel.org>
  6. Description
  7. -----------
  8. The wakeup in preemptive (wip) monitor is a sample per-cpu monitor
  9. that verifies if the wakeup events always take place with
  10. preemption disabled::
  11. |
  12. |
  13. v
  14. #==================#
  15. H preemptive H <+
  16. #==================# |
  17. | |
  18. | preempt_disable | preempt_enable
  19. v |
  20. sched_waking +------------------+ |
  21. +--------------- | | |
  22. | | non_preemptive | |
  23. +--------------> | | -+
  24. +------------------+
  25. The wakeup event always takes place with preemption disabled because
  26. of the scheduler synchronization. However, because the preempt_count
  27. and its trace event are not atomic with regard to interrupts, some
  28. inconsistencies might happen. For example::
  29. preempt_disable() {
  30. __preempt_count_add(1)
  31. -------> smp_apic_timer_interrupt() {
  32. preempt_disable()
  33. do not trace (preempt count >= 1)
  34. wake up a thread
  35. preempt_enable()
  36. do not trace (preempt count >= 1)
  37. }
  38. <------
  39. trace_preempt_disable();
  40. }
  41. This problem was reported and discussed here:
  42. https://lore.kernel.org/r/cover.1559051152.git.bristot@redhat.com/
  43. Specification
  44. -------------
  45. Grapviz Dot file in tools/verification/models/wip.dot