This program causes interrupts during its execution
I assume the User Space program is doing a soft interrupt/system call , and you have edited the kernel system call table , and assigned the number of your custom system call and recompiled and installed the kernel with your custom system call/soft interrupt.
When the interrupt is coming, the program should be suspended, and
stay suspended - until the interrupt handler in kernel module will
finish handling this interrupt.
For this to happen when your program calls the soft interrupt , you must make your irq , to run atomically , this way , before your program calls another soft interrupt , the previous interrupt would have been handled at a go , without being preempted by any other , higher priority interrupt. To achieve this atomicity , you can use spinlocks in your irq handler.
Example
spinlock_t mLock = SPIN_LOCK_UNLOCK;
unsigned long flags;
spin_lock_irqsave(&mLock, flags); // save the state, if locked already it is saved in flags
// IRQ Handler Code here
spin_unlock_irqsave(&mLock, flags); // return to the formally state specified in flags