dmatest.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ==============
  2. DMA Test Guide
  3. ==============
  4. Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  5. This small document introduces how to test DMA drivers using dmatest module.
  6. .. note::
  7. The test suite works only on the channels that have at least one
  8. capability of the following: DMA_MEMCPY (memory-to-memory), DMA_MEMSET
  9. (const-to-memory or memory-to-memory, when emulated), DMA_XOR, DMA_PQ.
  10. Part 1 - How to build the test module
  11. =====================================
  12. The menuconfig contains an option that could be found by following path:
  13. Device Drivers -> DMA Engine support -> DMA Test client
  14. In the configuration file the option called CONFIG_DMATEST. The dmatest could
  15. be built as module or inside kernel. Let's consider those cases.
  16. Part 2 - When dmatest is built as a module
  17. ==========================================
  18. Example of usage::
  19. % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1
  20. ...or::
  21. % modprobe dmatest
  22. % echo dma0chan0 > /sys/module/dmatest/parameters/channel
  23. % echo 2000 > /sys/module/dmatest/parameters/timeout
  24. % echo 1 > /sys/module/dmatest/parameters/iterations
  25. % echo 1 > /sys/module/dmatest/parameters/run
  26. ...or on the kernel command line::
  27. dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1
  28. .. hint::
  29. available channel list could be extracted by running the following command::
  30. % ls -1 /sys/class/dma/
  31. Once started a message like "dmatest: Started 1 threads using dma0chan0" is
  32. emitted. After that only test failure messages are reported until the test
  33. stops.
  34. Note that running a new test will not stop any in progress test.
  35. The following command returns the state of the test. ::
  36. % cat /sys/module/dmatest/parameters/run
  37. To wait for test completion userpace can poll 'run' until it is false, or use
  38. the wait parameter. Specifying 'wait=1' when loading the module causes module
  39. initialization to pause until a test run has completed, while reading
  40. /sys/module/dmatest/parameters/wait waits for any running test to complete
  41. before returning. For example, the following scripts wait for 42 tests
  42. to complete before exiting. Note that if 'iterations' is set to 'infinite' then
  43. waiting is disabled.
  44. Example::
  45. % modprobe dmatest run=1 iterations=42 wait=1
  46. % modprobe -r dmatest
  47. ...or::
  48. % modprobe dmatest run=1 iterations=42
  49. % cat /sys/module/dmatest/parameters/wait
  50. % modprobe -r dmatest
  51. Part 3 - When built-in in the kernel
  52. ====================================
  53. The module parameters that is supplied to the kernel command line will be used
  54. for the first performed test. After user gets a control, the test could be
  55. re-run with the same or different parameters. For the details see the above
  56. section `Part 2 - When dmatest is built as a module`_.
  57. In both cases the module parameters are used as the actual values for the test
  58. case. You always could check them at run-time by running ::
  59. % grep -H . /sys/module/dmatest/parameters/*
  60. Part 4 - Gathering the test results
  61. ===================================
  62. Test results are printed to the kernel log buffer with the format::
  63. "dmatest: result <channel>: <test id>: '<error msg>' with src_off=<val> dst_off=<val> len=<val> (<err code>)"
  64. Example of output::
  65. % dmesg | tail -n 1
  66. dmatest: result dma0chan0-copy0: #1: No errors with src_off=0x7bf dst_off=0x8ad len=0x3fea (0)
  67. The message format is unified across the different types of errors. A
  68. number in the parentheses represents additional information, e.g. error
  69. code, error counter, or status. A test thread also emits a summary line at
  70. completion listing the number of tests executed, number that failed, and a
  71. result code.
  72. Example::
  73. % dmesg | tail -n 1
  74. dmatest: dma0chan0-copy0: summary 1 test, 0 failures 1000 iops 100000 KB/s (0)
  75. The details of a data miscompare error are also emitted, but do not follow the
  76. above format.