简体   繁体   中英

Linux PCIe driver and app showing high CPU Usage

I've a custom Xilinx PCIe Endpoint Hardware, I've written a linux driver for it and also a sample app to test it. Driver loads correctly and Device is also recognized. Then the CPU Usage is also stable until I run my application. When I run my application, one out of my 4 Cores are Hitting 100% when other cores stay below 10%. Then opening any other application (may be firefox browser as I did), The system completely Hangs and requires a hard restart to get back to normal. The process wise CPU Usage shows only my application at 25% and remaining all stays at 0-1%.

The communication between the Driver and Application is only the Interrupts. When there is an MSI Interrupt, the read call on the device file in the application unblocks and again application starts waiting for another interrupt. Also I access the BAR Regions from the application using resource files.

Why does only one core is showing 100% CPU Usage? and Why my system completely hangs when another application is started even when 3 cores are almost completely free?

Found the issue.

In the app I run, 4 Threads are created which will handle each PCIe Interrupt. Apart from that, The main function polls on a global variable with an empty while loop. This is the reason for high CPU Usage. Figured out a way and used usleep instead of while loop and done. CPU Usage is less than 20% now.

Thanks for your comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM