From: Frederic Weisbecker <fweisbec@gmail.com>
To: "Leonidas ." <leonidas137@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Can current macro be accessed from interrupt context?
Date: Thu, 22 Oct 2009 13:27:51 +0200 [thread overview]
Message-ID: <20091022112746.GA4928@nowhere> (raw)
In-Reply-To: <f22d86810910220410r33002b5ei403ddf6632254472@mail.gmail.com>
On Thu, Oct 22, 2009 at 04:10:49AM -0700, Leonidas . wrote:
> Hello,
>
> Going through UTLK, it says that current macro makes sense only in
> case of process context,
> in case of interrupt context it is invalid.
Indeed, usually it makes only sense in process context.
> But current would still be pointing to interrupted process right? The
> pointer would still be valid?
Yeah, unless you irq handler executes in a threaded interrupt, in
which case current will be pointing to the given irq thread.
There are few tiny cases where it is unsafe to deref "current",
such as the very beginning of a cpu's awakening, when the per cpu
datas are not yet ready for this cpu.
> Can I safely assume that whether or not interrupt handlers are
> executing on separate stacks or
> interrupted threads stack, current macro can be accessed from interrupt context?
Yep.
For example we do that in the function graph tracer. Because we store return
addresses of functions in the "current" task structure. Even if the task
is interrupted, it still makes sense to use current because we want
to know the flow of execution as a linear thing per cpu, the interrupt
is part of that flow
I hope that helps.
Frederic.
next prev parent reply other threads:[~2009-10-22 11:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 11:10 Can current macro be accessed from interrupt context? Leonidas .
2009-10-22 11:27 ` Frederic Weisbecker [this message]
2009-10-22 11:43 ` Leonidas .
2009-10-22 11:49 ` Leonidas .
2009-10-22 12:06 ` Frederic Weisbecker
2009-10-22 13:37 ` Leonidas .
2009-10-22 13:45 ` Arjan van de Ven
2009-10-22 15:17 ` Valdis.Kletnieks
2009-10-22 17:46 ` Leonidas .
2009-10-22 18:12 ` Leonidas .
2009-10-23 8:13 ` Clemens Ladisch
2009-10-23 9:34 ` Leonidas .
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=20091022112746.GA4928@nowhere \
--to=fweisbec@gmail.com \
--cc=leonidas137@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox