Linux driver example to print the current running CPU - smp_processor_id()

When you have multiple processors present in the system, and want to find out on which the processor your driver code is running, use smp_processor_id().

Header file: #include <linux/smp.h>

Example:




Output:



You can see from the above screenshot, the init function of the driver was running on Processor 1 and Kernel thread was running on Processor 4

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto