I want to implement non-busy wait mechanism for creating a delay in nanoseconds in linux kernel module.
Right now I was looking at the function
ndelay(ns);
But https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
Here it is mentioned that ndelay function is a busy wait mechanism.
But I want non busy wait delay. So, I'm thinking about nop
in linux kernel module like this:
asm volatile ("nop");
I have studied that nop takes one cycle to execute. So, I will be implementing nested nop's to get the required delay. My question is -
By using nop will I be implementing a delay in nanoseconds in a non-busy waiting way? Can anyone please confirm on this? Also some reference to some journals and resources will be helpful.