cancel
Showing results for 
Search instead for 
Did you mean: 

stm32mp1 spi transaction slow down main application

Ara.1
Senior

Hi All

I have disabled the second core to validate one of old product, which runs on single core,

and same application cpu usage i have seen is 90-95 %

and same application runs and does the same spi transaction, i am seeing the cpu usage is 57%

all constraint are same except the core

following is the top of stm32mp1

top - 04:18:53 up 37 min, 1 user, load average: 1.70, 1.65, 1.51

Tasks: 107 total,  4 running, 103 sleeping,  0 stopped,  0 zombie

%Cpu(s): 4.5 us, 93.4 sy, 0.0 ni, 1.5 id, 0.3 wa, 0.0 hi, 0.3 si, 0.0 st

   9 root     20  0      0     0     0 S  2.3  0.0  0:05.56 ksoftirqd/0                                                              

  78 root     20  0      0     0     0 I  1.6  0.0  0:03.88 kworker/0:2-pm                                                           

 768 root     20  0   4556  1544  1204 R  1.0  0.2  0:01.27 top                                                                      

 612 root     20  0 113608  6668  4068 R 57.6  0.7 21:52.52 pxl                                                                      

  78 root     20  0      0     0     0 I 16.8  0.0  1:44.42 kworker/0:2-pm                                                           

  63 root     20  0      0     0     0 S  8.2  0.0  2:43.77 spi1                                                                     

  62 root    -51  0      0     0     0 S  7.4  0.0  2:30.84 irq/30-44005000                                                          

 9137 root     20  0      0     0     0 I  2.4  0.0  0:01.96 kworker/0:0-pm                                                           

  10 root     20  0      0     0     0 R  0.6  0.0  0:10.91 rcu_preempt                                                              

 768 root     20  0   4556  1544  1204 R  0.6  0.2  0:18.68 top                                                                      

   9 root     20  0      0     0     0 R  0.3  0.0  0:10.92 ksoftirqd/0     

what am observing , is that the SPI irq is running with very high priority -51, which makes our APP(pxl) deviates from cpu usage from 90 to 57,

is there any solution, to get pxl use cpu 90-95%

5 REPLIES 5
Olivier GALLIEN
ST Employee

Hi @Ara.1​ ,

Sorry it's not clear.

Do you mean that you application pxl is not working properly ?

CPU usage is not meaningful as such.

What was the old core performance ? ( mips, frequency )

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

application $APP is working for the number of while (1){} ,

number of execution rate per sec are reduced when spi in action,

I have checked the drivers/spi/spi-stm32.c driver, while transfer spi

[  78.789827] transfer of 4 bytes (4 data frames)

[  78.794371] dma disabled

[  78.796905] timeout set to 10 msecs

how to enable dma for SPI ?

Ara.1
Senior

if we increase the nice the normal thread

 63 root     25  5      0     0     0 S  8.2  0.0  1:19.19 spi1 

spi normal thread...

this brings back $APP normal.

root@mp1som:~# top

top - 02:54:47 up 17 min, 1 user, load average: 2.01, 1.99, 1.44

Tasks: 110 total,  3 running, 107 sleeping,  0 stopped,  0 zombie

%Cpu(s): 4.6 us, 93.8 sy, 0.0 ni, 1.0 id, 0.3 wa, 0.0 hi, 0.3 si, 0.0 st

MiB Mem :   935.4 total,   810.0 free,    47.7 used,    77.6 buff/cache

MiB Swap:     0.0 total,     0.0 free,     0.0 used.   852.2 avail Mem

 PID USER     PR NI   VIRT   RES   SHR S %CPU %MEM    TIME+ COMMAND                                                                  

 540 root     20  0 113636  6744  4176 R 64.7  0.7 10:56.47 pxl                                                                      

  62 root    -51  0      0     0     0 S 12.1  0.0  1:57.49 irq/30-44005000                                                          

  63 root     25  5      0     0     0 S  8.2  0.0  1:19.19 spi1                                                                     

  23 root     20  0      0     0     0 I  6.9  0.0  0:29.57 kworker/0:1-pm                                                           

 3289 root     20  0   4556  1604  1264 R  1.0  0.2  0:03.61 top      

Olivier GALLIEN
ST Employee

Hi @Ara.1​ ,

Ok you application doing while (1) it take all remaining CPU and is a good indicator of CPU taken by other threads.

Anyway I don't get you last status :

"if we increase the nice the normal thread"

What do you mean ? Can you rephrase ?

Does this mean point is close ?

Thx

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.