public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Russ Anderson <rja@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [patch] per cpu MCA/INIT save areas (take 2)
Date: Wed, 17 Nov 2004 17:47:51 +0000	[thread overview]
Message-ID: <200411171747.iAHHlpS3110348@ben.americas.sgi.com> (raw)
In-Reply-To: <200411122327.iACNRR5h131335@ben.americas.sgi.com>

Tony Luck wrote:
> 
> >Can you remind me why k3?  Are you worried about the TR mapping the
> >per-CPU region getting corrupted?
> 
> This isn't for correctness, or even efficiency (since this is a
> very low frequency execution path).  It is just to make the code
> easier to read and maintain.  The current code in the MCA path that
> loops through the array of tlb info structures looking for the
> one that matches the current cpus cr.lid is quite ugly.  Replicating
> it in the INIT code to find the per-cpu save+stack area will add
> to the ugliness.  Having the phys address of the per-cpu area in
> ar.k3 would clean things up.
> 
> For the INIT case it would be safe to just "tpa" a per-cpu address,
> but in the MCA case we shouldn't trust the TR mapping.

So one way to hide the uglyness is to put it in a macro, such 
as in the example at the bottom.

That cleans up the current place (in mca_asm.S) where it is called to be:

        // The following code purges TC and TR entries. Then reload all TC entries.
        // Purge percpu data TC entries.
begin_tlb_purge_and_reload:
        MCA_SAVE_AREA_PTR(r2, lbl1, err);;
        addl    r2=IA64_MCA_TLB_INFO,r2;;
        mov     r17=r2
        ;;

One technical concern is that the routine uses r16, r17, r18, r19, r20.
Optimizing is may squeeze out a couple but the bigger question is what
scratch registers are available?  Specificly, ia64_os_mca_proc_state_dump
saves off r16+ registers, so it would be good not to trash them before they
are saved.  

Other than that issue, it looks like a macro could be used instead of k3.

----------------------------------------------------------------------
/*
 * MCA_SAVE_AREA_PTR() gets the physical address pointer to this cpus
 * MCA/INIT save area.
 *      paddr (register) ends up holding the physical address.
 */

#define MCA_SAVE_AREA_PTR(paddr, tlbl, tmperr)                  \
        mov r16=cr.lid;;                                        \
        LOAD_PHYSICAL(p0,r17,ia64_mca_tlb_list);;               \
        mov r19=0;;                                             \
        mov r20=NR_CPUS;;                                       \
tlbl:   cmp.eq p6,p7=r19,r20;;                                  \
(p6)    br.spnt.few tmperr;;                                    \
        ld8 r18=[r17],IA64_MCA_TLB_INFO_SIZE;;                  \
        add r19=1,r19;;                                         \
        cmp.eq p6,p7=r18,r16;;                                  \
(p7)    br.sptk.few 1b;;                                        \
        adds r17=-IA64_MCA_TLB_INFO_SIZE,r17;;                  \
        mov paddr = r17;;
----------------------------------------------------------------------

Thanks,
-- 
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          rja@sgi.com

  parent reply	other threads:[~2004-11-17 17:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-12 23:27 [patch] per cpu MCA/INIT save areas (take 2) Russ Anderson
2004-11-13  7:05 ` David Mosberger
2004-11-13 23:24 ` Russ Anderson
2004-11-14  0:07 ` Jack Steiner
2004-11-14 20:07 ` Luck, Tony
2004-11-15 19:13 ` David Mosberger
2004-11-17 17:47 ` Russ Anderson [this message]
2004-11-17 18:59 ` Luck, Tony
2004-11-18 21:36 ` Russ Anderson
2004-11-18 22:18 ` Luck, Tony
2004-11-18 22:56 ` Russ Anderson
2004-11-23 23:36 ` Russ Anderson
2004-11-24  2:41 ` Keith Owens
2004-11-24 23:32 ` Luck, Tony
2004-12-03 21:33 ` Russ Anderson
2004-12-09  4:15 ` Russ Anderson
2004-12-09  4:35 ` 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=200411171747.iAHHlpS3110348@ben.americas.sgi.com \
    --to=rja@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