dmatest.txt 3.4 KB

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