I am using Linux kernel with preempt-rt patch, I did a a simple test to measure time between interrupt and notification of the interrupt to userspace. The idea is quite simple I have a module, that implements a read:
static ssize_t my_read(struct file *filp, char __user *buf, size_t count,loff_t *f_pos)
{
atomic_set(&intflag, 0);
if (wait_event_interruptible(my_hack, atomic_read(&intflag) != 0))
return -ERESTARTSYS;
do_gettimeofday(&tv2);
trace_printk("wait_event_interruptible% d\n",(int) (tv2.tv_usec - tv1.tv_usec));
return 0;
}
then from the interrupt routine I wake the read:
static irqreturn_t
my_interrupt(int irq, void *dev_id)
{
...
atomic_set(&intflag,1);
do_gettimeofday(&tv1);
wake_up_interruptible(&mm_fec_hack);
return IRQ_HANDLED;
}
The value printed is around 65 and 70 e.g.
myproc-532 [002] ....... 8049.789350: 0xbf0c81f0: wake_up_interruptible 65
My CPU is a 4 core:
model name : ARMv7 Processor rev 10 (v7l) BogoMIPS : 7.54
and frequency is
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 996000
I think that 65-70 us is pretty much to wakeup a process.
I tried to change irq and process priority with chrt and to relegate the irq to a specific core with smp_affinity and process to the same core or different core with taskset but the results basically are not changing.
What am I doing wrong?