On 31/08/18 12:29, Peter Ujfalusi wrote: > Hi, > > On 2018-08-31 14:03, Seraj Alijan wrote: >> Modify documentation to add multi channel testing support. >> >> Signed-off-by: Seraj Alijan <seraj.alijan@xxxxxxxxxxx> >> --- >> Documentation/driver-api/dmaengine/dmatest.rst | 27 ++++++++++++++++++++------ >> 1 file changed, 21 insertions(+), 6 deletions(-) >> >> diff --git a/Documentation/driver-api/dmaengine/dmatest.rst b/Documentation/driver-api/dmaengine/dmatest.rst >> index 7ce5e71..0a7e4c3 100644 >> --- a/Documentation/driver-api/dmaengine/dmatest.rst >> +++ b/Documentation/driver-api/dmaengine/dmatest.rst >> @@ -26,28 +26,43 @@ Part 2 - When dmatest is built as a module >> >> Example of usage:: >> >> - % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1 >> + % modprobe dmatest timeout=2000 iterations=1 channel=dma0chan0 run=1 >> >> ...or:: >> >> % modprobe dmatest >> - % echo dma0chan0 > /sys/module/dmatest/parameters/channel >> % echo 2000 > /sys/module/dmatest/parameters/timeout >> % echo 1 > /sys/module/dmatest/parameters/iterations >> + % echo dma0chan0 > /sys/module/dmatest/parameters/channel >> % echo 1 > /sys/module/dmatest/parameters/run >> >> ...or on the kernel command line:: >> >> - dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1 >> + dmatest.timeout=2000 dmatest.iterations=1 dmatest.channel=dma0chan0 dmatest.run=1 >> + >> +Example of multi-channel test usage: >> + % modprobe dmatest >> + % echo 2000 > /sys/module/dmatest/parameters/timeout >> + % echo 1 > /sys/module/dmatest/parameters/iterations >> + % echo dma0chan0 > /sys/module/dmatest/parameters/channel >> + % echo dma0chan1 > /sys/module/dmatest/parameters/channel >> + % echo dma0chan2 > /sys/module/dmatest/parameters/channel >> + % echo 1 > /sys/module/dmatest/parameters/run >> >> +Note: the channel parameter should always be the last parameter set prior to >> +running the test (setting run=1), this is because upon setting the channel >> +parameter, that specific channel is requested using the dmaengine and a thread >> +is created with the existing parameters. > > When the channel is going to be released after this change? > > It is a bit awkward currently that after the test finished the > channel(s) are still requested and it can be released by > cat /sys/module/dmatest/parameters/run This patch does not tackle this issue, after the test is run these channels remain requested, you can still clear them the same way. > or to run the test again and before the next run the channel(s) are > going to be released just to be requested again. With this change, after you run your test, the channels remain requested but their respective threads are no longer considered pending. So when you issue: echo 1 > /sys/module/dmatest/parameters/run The test will check if it has any pending threads, if it sees that the thread list is populated, but non of the threads are pending, it will clear them all. You would have to requested the channels again before attempting to start another run. This same behavior is applied when you request a channel after running a test, it will clear all previous threads before requesting new channels. example scenario 1: issuing run command after completing test echo 2000 > /sys/module/dmatest/parameters/timeout echo 1 > /sys/module/dmatest/parameters/iterations echo dma0chan0 > /sys/module/dmatest/parameters/channel [ 1295.534205] dmatest: Added 1 threads using dma0chan0 echo dma0chan1 > /sys/module/dmatest/parameters/channel [ 1295.543496] dmatest: Added 1 threads using dma0chan1 echo dma0chan2 > /sys/module/dmatest/parameters/channel [ 1295.549113] dmatest: Added 1 threads using dma0chan2 echo 1 > /sys/module/dmatest/parameters/run [ 1296.436301] dmatest: dma0chan1-copy0: summary 1 tests, 0 failures 400.00 iops 0 KB/s (0) [ 1296.441081] dmatest: dma0chan2-copy0: summary 1 tests, 0 failures 181.81 iops 363 KB/s (0) [ 1296.441590] dmatest: dma0chan0-copy0: summary 1 tests, 0 failures 222.22 iops 666 KB/s (0) echo 1 > /sys/module/dmatest/parameters/run As you can see, issuing the run command again does nothing, it simply checked that it had no pending threads, so it cleared all channels. example scenarios 2: requesting channel after completing test echo dma0chan0 > /sys/module/dmatest/parameters/channel [ 1394.279145] dmatest: Added 1 threads using dma0chan0 echo dma0chan1 > /sys/module/dmatest/parameters/channel [ 1395.877829] dmatest: Added 1 threads using dma0chan1 echo dma0chan2 > /sys/module/dmatest/parameters/channel [ 1396.776893] dmatest: Added 1 threads using dma0chan2 echo 1 > /sys/module/dmatest/parameters/run [ 1400.798124] dmatest: dma0chan1-copy0: summary 1 tests, 0 failures 345.33 iops 758 KB/s (0) [ 1400.799443] dmatest: dma0chan0-copy0: summary 1 tests, 0 failures 333.33 iops 1000 KB/s (0) [ 1400.799688] dmatest: dma0chan2-copy0: summary 1 tests, 0 failures 333.33 iops 666 KB/s (0) echo dma0chan1 > /sys/module/dmatest/parameters/channel [ 1405.373603] dmatest: Added 1 threads using dma0chan1 echo 1 > /sys/module/dmatest/parameters/run [ 1406.512495] dmatest: dma0chan1-copy0: summary 1 tests, 0 failures 200.00 iops 400 KB/s (0) In this example you can see that you can request a new channel after completing a test, the test has automatically identified that it has a list of non pending threads from the previous run, it cleared them, and allocated the new channel. >> This thread is set as pending >> +and will be executed once run is set to 1. Any parameters set after the thread >> +is created are not applied. >> .. hint:: >> available channel list could be extracted by running the following command:: >> >> % ls -1 /sys/class/dma/ >> >> -Once started a message like "dmatest: Started 1 threads using dma0chan0" is >> -emitted. After that only test failure messages are reported until the test >> -stops. >> +Once started a message like " dmatest: Added 1 threads using dma0chan0" is >> +emitted. A thread for that specific channel is created and is now pending, the >> +pending thread is started once run is to 1. >> >> Note that running a new test will not stop any in progress test. >> >> > > - Péter > > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. > Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki >