public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [patch 1/6] remove dead code in ia64_leave_kernel
Date: Tue, 31 Jan 2006 09:06:58 +0000	[thread overview]
Message-ID: <200601310907.k0V976g12698@unix-os.sc.intel.com> (raw)

The code around restoring user backing store in ia64_leave_kernel
is just plain dumb.  ia64_leave_kernel is used for non-syscall
exit path.  When entering the kernel from the user space, we
already preserved the user stack register frame by doing a
cover instruction.  on the way out, ia64_leave_kernel uncondition-
ally bypass a section of code by "br dont_preserve_current_frame"
(pNonSys should always be one in that path).  However, part of
code in the beginning of rbs_switch is used by ia64_leave_syscall
to calculate new "ndirty" bytes since in leave syscall, kernel
have to preserve the current frame and thus needing to re
calculate new ndirty size for loadrs.  Streamline that section of
code into ia64_leave_syscall and remove unneeded reading ar.bsp
in the leave kernel path.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

--- ./arch/ia64/kernel/entry.S.orig	2006-01-02 19:21:10.000000000 -0800
+++ ./arch/ia64/kernel/entry.S	2006-01-22 02:20:46.475278554 -0800
@@ -787,6 +787,13 @@ ENTRY(ia64_leave_syscall)
 
 	mov.m ar.ssd=r0			// M2   clear ar.ssd
 	mov f11ð			// F    clear f11
+	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
+	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
+	;;
+	sub r19=r19,r16			// calculate total byte size of dirty partition
+	add r18d,r18			// don't force in0-in7 into memory...
+	;;
+	shl r19=r19,16			// shift size of dirty partition into loadrs pos
 	br.cond.sptk.many rbs_switch	// B
 END(ia64_leave_syscall)
 
@@ -951,32 +958,17 @@ GLOBAL_ENTRY(ia64_leave_kernel)
 (pUStk)	st1 [r18]=r17		// restore current->thread.on_ustack
 	shr.u r18=r19,16	// get byte size of existing "dirty" partition
 	;;
-	mov r16=ar.bsp		// get existing backing store pointer
 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
 	;;
 	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
 (pKStk)	br.cond.dpnt skip_rbs_switch
 
+rbs_switch:
 	/*
 	 * Restore user backing store.
 	 *
 	 * NOTE: alloc, loadrs, and cover can't be predicated.
-	 */
-(pNonSys) br.cond.dpnt dont_preserve_current_frame
-	cover				// add current frame into dirty partition and set cr.ifs
-	;;
-	mov r19=ar.bsp			// get new backing store pointer
-rbs_switch:
-	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
-	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
-	;;
-	sub r19=r19,r16			// calculate total byte size of dirty partition
-	add r18d,r18			// don't force in0-in7 into memory...
-	;;
-	shl r19=r19,16			// shift size of dirty partition into loadrs position
-	;;
-dont_preserve_current_frame:
-	/*
+	 *
 	 * To prevent leaking bits between the kernel and user-space,
 	 * we must clear the stacked registers in the "invalid" partition here.
 	 * Not pretty, but at least it's fast (3.34 registers/cycle on Itanium,



             reply	other threads:[~2006-01-31  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-31  9:06 Chen, Kenneth W [this message]
2006-01-31 19:48 ` FW: [patch 1/6] remove dead code in ia64_leave_kernel Chen, Kenneth W
2006-02-01  3:12 ` David Mosberger-Tang

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=200601310907.k0V976g12698@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.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