public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mallick, Asit K" <asit.k.mallick@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Patch to fix Itanium copy_user for uninitialized NaT
Date: Sat, 27 Jul 2002 01:05:16 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590701905841@msgid-missing> (raw)

[-- Attachment #1: Type: text/plain, Size: 1595 bytes --]

We recently found a problem with Itanium version of copy_user while running
optimized spec benchmarks. We root caused this to an uninitialized register
use in the copy_user.S that happens to have a NaT and was causing NaT
consumption fault -> resulted in seg fault.

This is due to the case in copy_user for handling unaligned accesses it uses
the rotating registers R[N] and R[N-1] in Nth cycle. So, when the loop count
is smaller than the pipe depth last R[N-1] is uninitialized. The patch
cahnges the register usage to R[N+1] and R[N] and initializes both registers
in the loop and fixes this problem. McKinley optimized version of the
copy_user function (in memcpy_mck.S) does not have this problem.

Thanks,
Asit

--- linux/arch/ia64/lib/copy_user.S.orig	Wed Jul 24 16:43:54 2002
+++ linux/arch/ia64/lib/copy_user.S	Wed Jul 24 16:46:27 2002
@@ -237,15 +237,17 @@
 .copy_user_bit##rshift:						\
 1:								\
 	EX(.failure_out,(EPI) st8 [dst1]=tmp,8);		\
-(EPI_1) shrp tmp=val1[PIPE_DEPTH-3],val1[PIPE_DEPTH-2],rshift;	\
-	EX(3f,(p16) ld8 val1[0]=[src1],8);			\
+(EPI_1) shrp tmp=val1[PIPE_DEPTH-2],val1[PIPE_DEPTH-1],rshift;	\
+	EX(3f,(p16) ld8 val1[1]=[src1],8);			\
+(p16)	mov val1[0]=r0;						\
 	br.ctop.dptk 1b;					\
 	;;							\
 	br.cond.sptk.many .diff_align_do_tail;			\
 2:								\
 (EPI)	st8 [dst1]=tmp,8;					\
-(EPI_1)	shrp tmp=val1[PIPE_DEPTH-3],val1[PIPE_DEPTH-2],rshift;	\
+(EPI_1)	shrp tmp=val1[PIPE_DEPTH-2],val1[PIPE_DEPTH-1],rshift;	\
 3:								\
+(p16)	mov val1[1]=r0;						\
 (p16)	mov val1[0]=r0;						\
 	br.ctop.dptk 2b;					\
 	;;							\

 <<nat-patch.diff>> 

[-- Attachment #2: nat-patch.diff --]
[-- Type: application/octet-stream, Size: 854 bytes --]

--- linux/arch/ia64/lib/copy_user.S.orig	Wed Jul 24 16:43:54 2002
+++ linux/arch/ia64/lib/copy_user.S	Wed Jul 24 16:46:27 2002
@@ -237,15 +237,17 @@
 .copy_user_bit##rshift:						\
 1:								\
 	EX(.failure_out,(EPI) st8 [dst1]=tmp,8);		\
-(EPI_1) shrp tmp=val1[PIPE_DEPTH-3],val1[PIPE_DEPTH-2],rshift;	\
-	EX(3f,(p16) ld8 val1[0]=[src1],8);			\
+(EPI_1) shrp tmp=val1[PIPE_DEPTH-2],val1[PIPE_DEPTH-1],rshift;	\
+	EX(3f,(p16) ld8 val1[1]=[src1],8);			\
+(p16)	mov val1[0]=r0;						\
 	br.ctop.dptk 1b;					\
 	;;							\
 	br.cond.sptk.many .diff_align_do_tail;			\
 2:								\
 (EPI)	st8 [dst1]=tmp,8;					\
-(EPI_1)	shrp tmp=val1[PIPE_DEPTH-3],val1[PIPE_DEPTH-2],rshift;	\
+(EPI_1)	shrp tmp=val1[PIPE_DEPTH-2],val1[PIPE_DEPTH-1],rshift;	\
 3:								\
+(p16)	mov val1[1]=r0;						\
 (p16)	mov val1[0]=r0;						\
 	br.ctop.dptk 2b;					\
 	;;							\

                 reply	other threads:[~2002-07-27  1:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=marc-linux-ia64-105590701905841@msgid-missing \
    --to=asit.k.mallick@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