From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: System call service routine and interrupt context
Date: Mon, 30 Apr 2018 08:12:34 -0700 [thread overview]
Message-ID: <20180430151234.GD31520@kroah.com> (raw)
In-Reply-To: <CAE6Wm-ueYNNFp+U1wncSAdDwbvuTCi=oFFfkDuXREo+BX==5KQ@mail.gmail.com>
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
prev parent reply other threads:[~2018-04-30 15:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 14:43 System call service routine and interrupt context Pritam Bankar
2018-04-30 15:12 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180430151234.GD31520@kroah.com \
--to=greg@kroah.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.