* System call service routine and interrupt context
2018-04-30 14:43 System call service routine and interrupt context Pritam Bankar
@ 2018-04-30 15:12 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2018-04-30 15:12 UTC (permalink / raw)
To: kernelnewbies
On Mon, Apr 30, 2018 at 08:13:11PM +0530, Pritam Bankar wrote:
> Hi,
>
> My question is, do all the code of interrupt handler in system call
> gets executed in interrupt context?
No.
> System calls generate software interrupts.
Some do, some do not. It all depends :)
> So when I do open() syscall it we call do_sys_open() handler which
> will eventually call file system specific open function call.
Normal file open calls do not generate a hardware interrupt. Some
might, but some might not. It all depends.
> Will all this happen in interrupt context until I get open file
> descriptor in user land?
No, if disk I/O is needed, which requires interrupts, the system call
process (your process) will sleep in the kernel until the needed I/O
happens and is returned. That I/O can cause irq code to run, and if so,
that's fine, it runs in its own context.
> If not when does context change?
Often and frequently :)
Sorry, it's a complex thing, all depending on the hardware, system,
cache, and loads of other things. Try using ftrace or other function
tracing tools to follow a call through the kernel to see how this all
plays out.
hope this helps,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread