From: Keith Owens <kaos@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: MCA/INIT: need to wire CURRENT_STACK?
Date: Wed, 21 Sep 2005 22:58:55 +0000 [thread overview]
Message-ID: <14241.1127343535@ocs3.ocs.com.au> (raw)
In-Reply-To: <16451.1127265127@ocs3.ocs.com.au>
On Wed, 21 Sep 2005 11:12:58 -0700,
David Mosberger-Tang <David.Mosberger@acm.org> wrote:
>> BUT ... it raises the question of whether you will do anything
>> in your MCA handler that will run into problems because the stack
>> is perhaps[1] not pinned ... just mapped by a DTC entry. I forget
>> what the exact issue is that led to pinning the stack with DTR[2],
>> but there is a correctness issue involved. David: memory jog time??
>
>Any virtually mapped memory that needs to be accessed with PSR.IC=0
>needs to be pinned because otherwise you'd get a nested TLB fault and
>things would go south from there real fast.
The virtual mode handlers are entered with psr.ic=1 and psr.i=0.
External interrupts are blocked until the handlers resume to the
original context. Internal interrupts like KDB_ENTER() use the
handler's stack in virtual mode with psr.ic=0, but by the time it gets
to ivt.S::non_syscall, the C code has already accessed the handler
stack with psr.ic=1. Worst case, the first access to the handler stack
in mca.c (which is with psr.ic) will take an alt DTLB fault and drop in
a DTC for the handler stack.
There is a theoretical problem case. After the DTC for the handler
stack has been loaded, the handler does enough data accesses that its
own DTC is flushed. Then the handler, without accessing its own stack,
causes an internal interrupt, e.g. KDB_ENTER(). That could cause a
nested DTLB fault.
I can change the mca_asm code to save, modify and restore
IA64_KR_CURRENT_STACK and IA64_TR_CURRENT_STACK around the C handlers.
But that gets awkward if the C code wants to resume to a new context,
the C code would have to set new values for IA64_KR_CURRENT_STACK and
IA64_TR_CURRENT_STACK while it was still using its own stack, which
might open the same problem.
next prev parent reply other threads:[~2005-09-21 22:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-21 1:12 MCA/INIT: need to wire CURRENT_STACK? Keith Owens
2005-09-21 17:47 ` Luck, Tony
2005-09-21 18:12 ` David Mosberger-Tang
2005-09-21 22:58 ` Keith Owens [this message]
2005-09-21 23:09 ` David Mosberger-Tang
2005-09-21 23:21 ` Keith Owens
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=14241.1127343535@ocs3.ocs.com.au \
--to=kaos@sgi.com \
--cc=linux-ia64@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