This is my first query in stack exchange so please bear with me. Almost all the questions which come to my mind already got resolved from the forum, but I cannot able to found this one.
I have made a simple device driver in Linux where in my_init() function I have written following code:-
spinlock_t mylock = SPIN_LOCK_UNLOCKED
static int __init my_init()
{
unsigned long flags;
printk("Testing spinlock\n");
spin_lock_irqsave(&mylock, flag);
printk("Grabbing spinlock and return\n");
}
Thus simply I am returning without releasing the spinlock.According to the theory and Linux source code, the Interrupt got disabled in ARM. So I seen CPSR register of ARM using debugger with 'I' bit gets masked and thus IRQ are disabled. However to my surprise the Linux prompt and even schedule() function are working as usual.
So my query is in Linux do we use IRQ mode only for some of the peripherals? If this is the case how can we guarantee perfect synchronization between Thread Context and Interrupt Context?
A bit detail about my Target : TI81xx Soc, Linux 3.2, Lauterbach Debugger.
Thanks