public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Takao Indoh <indou.takao@jp.fujitsu.com>
To: linux-ia64@vger.kernel.org
Subject: Re: why ms->pmsa_xip is used?
Date: Thu, 05 Nov 2009 22:53:41 +0000	[thread overview]
Message-ID: <31CA5E6AD23329indou.takao@jp.fujitsu.com> (raw)
In-Reply-To: <F6CA51BB11EE80indou.takao@jp.fujitsu.com>

On Tue, 27 Oct 2009 18:21:11 -0400, Takao Indoh wrote:

>On Tue, 27 Oct 2009 10:36:53 +1100, Keith Owens wrote:
>
>>On Mon, 26 Oct 2009 18:15:22 -0400, 
>>Takao Indoh <indou.takao@jp.fujitsu.com> wrote:
>>>As Intel manual says, it seems that pmsa_iip has a value of ip register
>>>where INIT interrupted when psr.ic is 0. Ok, I'll make a patch so that
>>>pmsa_iip is used irrespective of a value of psr.ic.
>>>
>>>Please let me know if I need to confirm something else before I make a
>>>patch.
>>
>>That looks good.  The only problem I can think of is an MCA/INIT
>>arriving while code like SAVE_MIN or SAVE_REST is executing.  Back
>>tracing at that point using pmsa_iip is going to be a problem, you have
>>no idea what state the registers or stack are in.
>
>I inserted another debug code into IA64_NATIVE_DO_SAVE_MIN to send
>INIT during SAVE_MIN.
>
>diff -Nurp a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h
>--- a/arch/ia64/kernel/minstate.h   2009-10-22 12:28:07.000000000 -0400
>+++ b/arch/ia64/kernel/minstate.h   2009-10-27 12:42:02.000000000 -0400
>@@ -55,6 +55,14 @@
>    mov r21=ar.fpsr;        /* M */                         \
>    __COVER;                /* B;; (or nothing) */              \
>    ;;                                          \
>+   movl r24Þbug_flag;    \
>+   ;;  \
>+   ld8 r23=[r24];  \
>+   ;;  \
>+   cmp.eq p2,p3=0,r23; \
>+(p2) br.sptk 2f;   \
>+1:   br.sptk 1b;   \
>+2: \
>    adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16;                     \
>    ;;                                          \
>    ld1 r17=[r16];              /* load current->thread.on_ustack flag */   \
>
>As a result, backtrace in the case using xip works, and backtrace in the
>case using iip does NOT work, as you said. Hm, it seems that I have to
>reconsider how to fix.

Now I think it's better to keep it as-is, I mean, use
pmsa_{xip,xpsr,xfs} if PSR.ic is 0. Instead of that, I'd like to
save pmsa_{iip,ipsr,ifs} somewhere for debugging. For example,

diff -Nurp a/arch/ia64/include/asm/mca.h b/arch/ia64/include/asm/mca.h
--- a/arch/ia64/include/asm/mca.h	2009-10-22 12:28:07.000000000 -0400
+++ b/arch/ia64/include/asm/mca.h	2009-11-03 17:01:33.000000000 -0500
@@ -106,6 +106,11 @@ struct ia64_sal_os_state {
 	unsigned long		os_status;		/* OS status to SAL, enum below */
 	unsigned long		context;		/* 0 if return to same context
 							   1 if return to new context */
+
+	/* I-resources */
+	unsigned long		iip;
+	unsigned long		ipsr;
+	unsigned long		ifs;
 };
 
 enum {
diff -Nurp a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
--- a/arch/ia64/kernel/mca.c	2009-10-22 12:28:07.000000000 -0400
+++ b/arch/ia64/kernel/mca.c	2009-11-05 11:10:45.000000000 -0500
@@ -888,9 +888,10 @@ ia64_mca_modify_comm(const struct task_s
 }
 
 static void
-finish_pt_regs(struct pt_regs *regs, const pal_min_state_area_t *ms,
+finish_pt_regs(struct pt_regs *regs, struct ia64_sal_os_state *sos,
 		unsigned long *nat)
 {
+	const pal_min_state_area_t *ms = sos->pal_min_state;
 	const u64 *bank;
 
 	/* If ipsr.ic then use pmsa_{iip,ipsr,ifs}, else use
@@ -904,6 +905,10 @@ finish_pt_regs(struct pt_regs *regs, con
 		regs->cr_iip = ms->pmsa_xip;
 		regs->cr_ipsr = ms->pmsa_xpsr;
 		regs->cr_ifs = ms->pmsa_xfs;
+
+		sos->iip = ms->pmsa_iip;
+		sos->ipsr = ms->pmsa_ipsr;
+		sos->ifs = ms->pmsa_ifs;
 	}
 	regs->pr = ms->pmsa_pr;
 	regs->b0 = ms->pmsa_br0;
(snip)

Any idea or comments?

Thanks,
Takao Indoh

  parent reply	other threads:[~2009-11-05 22:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20 19:25 why ms->pmsa_xip is used? Takao Indoh
2009-10-20 23:53 ` Keith Owens
2009-10-26 22:15 ` Takao Indoh
2009-10-26 23:36 ` Keith Owens
2009-10-27 22:21 ` Takao Indoh
2009-11-05 22:53 ` Takao Indoh [this message]
2009-11-05 23:10 ` 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=31CA5E6AD23329indou.takao@jp.fujitsu.com \
    --to=indou.takao@jp.fujitsu.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