All of lore.kernel.org
 help / color / mirror / Atom feed
From: John David Anglin <dave@hiauly1.hia.nrc.ca>
To: Carlos O'Donell <carlos@systemhalted.org>
Cc: dave.anglin@nrc-cnrc.gc.ca, deller@gmx.de, gniibe@fsij.org,
	linux-parisc@vger.kernel.org
Subject: [PATCH] LWS fixes for syscall.S
Date: Sun, 11 Apr 2010 13:26:34 -0400	[thread overview]
Message-ID: <20100411172634.GD7756@hiauly1.hia.nrc.ca> (raw)
In-Reply-To: <x2p119aab441004090714v107c8fc1s9ca94066871a3e8b@mail.gmail.com>

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

On Fri, 09 Apr 2010, Carlos O'Donell wrote:

> We need to start splitting up your giant "stability" patch into
> manageable chunks.

Here's the fifth chunk.  It contains a variety of fixes to the LWS
code in syscall.S.

1) Gate immediately and save a branch.
2) Fix off by one error in checking entry number.
3) Use sr7 instead of sr3 in error return path as sr3 might not
   contain correct value.
4) Enable locking on UP systems to prevent incorrect operation of
   the cas_action critical region on page faults.

Fixes 2 and 4 are new.

Tested on several systems, including UP c3750 with 2.6.33.2 kernel.

Signed-off-by: John David Anglin <dave.anglin@nrc-cnrc.gc.ca>

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

[-- Attachment #2: syscall.S.d --]
[-- Type: text/plain, Size: 2899 bytes --]

diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index f5f9602..68e75ce 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -47,18 +47,17 @@ ENTRY(linux_gateway_page)
 	KILL_INSN
 	.endr
 
-	/* ADDRESS 0xb0 to 0xb4, lws uses 1 insns for entry */
+	/* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */
 	/* Light-weight-syscall entry must always be located at 0xb0 */
 	/* WARNING: Keep this number updated with table size changes */
 #define __NR_lws_entries (2)
 
 lws_entry:
-	/* Unconditional branch to lws_start, located on the 
-	   same gateway page */
-	b,n	lws_start
+	gate	lws_start, %r0		/* increase privilege */
+	depi	3, 31, 2, %r31		/* Ensure we return into user mode. */
 
-	/* Fill from 0xb4 to 0xe0 */
-	.rept 11
+	/* Fill from 0xb8 to 0xe0 */
+	.rept 10
 	KILL_INSN
 	.endr
 
@@ -423,9 +422,6 @@ tracesys_sigexit:
 
 	*********************************************************/
 lws_start:
-	/* Gate and ensure we return to userspace */
-	gate	.+8, %r0
-	depi	3, 31, 2, %r31	/* Ensure we return to userspace */
 
 #ifdef CONFIG_64BIT
 	/* FIXME: If we are a 64-bit kernel just
@@ -442,7 +438,7 @@ lws_start:
 #endif	
 
         /* Is the lws entry number valid? */
-	comiclr,>>=	__NR_lws_entries, %r20, %r0
+	comiclr,>>	__NR_lws_entries, %r20, %r0
 	b,n	lws_exit_nosys
 
 	/* WARNING: Trashing sr2 and sr3 */
@@ -473,7 +469,7 @@ lws_exit:
 	/* now reset the lowest bit of sp if it was set */
 	xor	%r30,%r1,%r30
 #endif
-	be,n	0(%sr3, %r31)
+	be,n	0(%sr7, %r31)
 
 
 	
@@ -529,7 +525,6 @@ lws_compare_and_swap32:
 #endif
 
 lws_compare_and_swap:
-#ifdef CONFIG_SMP
 	/* Load start of lock table */
 	ldil	L%lws_lock_start, %r20
 	ldo	R%lws_lock_start(%r20), %r28
@@ -572,8 +567,6 @@ cas_wouldblock:
 	ldo	2(%r0), %r28				/* 2nd case */
 	b	lws_exit				/* Contended... */
 	ldo	-EAGAIN(%r0), %r21			/* Spin in userspace */
-#endif
-/* CONFIG_SMP */
 
 	/*
 		prev = *addr;
@@ -601,13 +594,11 @@ cas_action:
 1:	ldw	0(%sr3,%r26), %r28
 	sub,<>	%r28, %r25, %r0
 2:	stw	%r24, 0(%sr3,%r26)
-#ifdef CONFIG_SMP
 	/* Free lock */
 	stw	%r20, 0(%sr2,%r20)
-# if ENABLE_LWS_DEBUG
+#if ENABLE_LWS_DEBUG
 	/* Clear thread register indicator */
 	stw	%r0, 4(%sr2,%r20)
-# endif
 #endif
 	/* Return to userspace, set no error */
 	b	lws_exit
@@ -615,12 +606,10 @@ cas_action:
 
 3:		
 	/* Error occured on load or store */
-#ifdef CONFIG_SMP
 	/* Free lock */
 	stw	%r20, 0(%sr2,%r20)
-# if ENABLE_LWS_DEBUG
+#if ENABLE_LWS_DEBUG
 	stw	%r0, 4(%sr2,%r20)
-# endif
 #endif
 	b	lws_exit
 	ldo	-EFAULT(%r0),%r21	/* set errno */
@@ -672,7 +661,6 @@ ENTRY(sys_call_table64)
 END(sys_call_table64)
 #endif
 
-#ifdef CONFIG_SMP
 	/*
 		All light-weight-syscall atomic operations 
 		will use this set of locks 
@@ -694,8 +682,6 @@ ENTRY(lws_lock_start)
 	.endr
 END(lws_lock_start)
 	.previous
-#endif
-/* CONFIG_SMP for lws_lock_start */
 
 .end
 

  parent reply	other threads:[~2010-04-11 17:26 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4BA43CE5.4020807@fsij.org>
     [not found] ` <87hbo4ek8l.fsf@thialfi.karme.de>
     [not found]   ` <4BB18B46.2070203@fsij.org>
     [not found]     ` <4BB53D26.60601@fsij.org>
2010-04-02  2:41       ` threads and fork on machine with VIPT-WB cache NIIBE Yutaka
2010-04-02  3:30         ` James Bottomley
2010-04-02  3:48           ` NIIBE Yutaka
2010-04-02  8:05             ` NIIBE Yutaka
2010-04-02 19:35               ` John David Anglin
2010-04-08 21:11                 ` Helge Deller
2010-04-08 21:54                   ` John David Anglin
2010-04-08 22:44                     ` John David Anglin
2010-04-09 14:14                       ` Carlos O'Donell
2010-04-09 15:13                         ` John David Anglin
2010-04-09 15:48                           ` James Bottomley
2010-04-09 16:22                             ` John David Anglin
2010-04-09 16:31                               ` James Bottomley
2010-04-10 20:46                           ` Helge Deller
2010-04-10 21:56                             ` John David Anglin
2010-04-10 22:53                             ` John David Anglin
2010-04-11 18:50                               ` Helge Deller
2010-04-11 22:25                                 ` John David Anglin
2010-04-12 21:02                                   ` Helge Deller
2010-04-12 21:41                                     ` John David Anglin
2010-04-13 11:55                                       ` Helge Deller
2010-04-13 14:03                                         ` John David Anglin
2010-04-15 22:35                                         ` John David Anglin
2010-04-19 16:26                                         ` John David Anglin
2010-04-20 17:59                                           ` Helge Deller
2010-04-20 18:52                                             ` John David Anglin
2010-05-09 12:43                                             ` John David Anglin
2010-05-09 14:14                                               ` Carlos O'Donell
2010-05-10  9:56                                               ` Helge Deller
2010-05-10 14:56                                                 ` John David Anglin
2010-05-10 19:20                                                   ` Helge Deller
2010-05-10 21:07                                                     ` John David Anglin
2010-05-11 16:37                                                       ` John David Anglin
2010-05-11 21:39                                                         ` John David Anglin
2010-05-11 20:44                                                       ` Helge Deller
2010-05-11 20:41                                                     ` Helge Deller
2010-05-11 21:26                                                       ` John David Anglin
2010-05-11 21:41                                                         ` Helge Deller
2010-05-15 21:02                                                           ` John David Anglin
2010-05-16 20:22                                                             ` Helge Deller
2010-05-16 21:38                                                               ` John David Anglin
2010-05-22 17:25                                                               ` John David Anglin
2010-05-23 13:11                                                             ` Carlos O'Donell
2010-05-23 14:43                                                               ` John David Anglin
2010-05-01 18:34                                           ` Thibaut VARENE
2010-05-01 20:17                                             ` John David Anglin
2010-05-02 10:53                                               ` Thibaut VARÈNE
2010-04-11 16:36                           ` [PATCH] Call pagefault_disable/pagefault_enable in kmap_atomic/kunmap_atomic John David Anglin
2010-04-11 17:03                         ` [PATCH] Remove unnecessary macros from entry.S John David Anglin
2010-04-11 17:08                         ` [PATCH] Delete unnecessary nop's in entry.S John David Anglin
2010-04-11 17:12                         ` [PATCH] Avoid interruption in critical region " John David Anglin
2010-04-11 18:24                           ` James Bottomley
2010-04-11 18:45                             ` John David Anglin
2010-04-11 18:53                               ` James Bottomley
2010-04-11 17:26                         ` John David Anglin [this message]
2010-06-02 15:33                       ` Bug#561203: threads and fork on machine with VIPT-WB cache Modestas Vainius
2010-06-02 17:16                         ` John David Anglin
2010-06-02 17:56                           ` Bug#561203: " dann frazier
2010-06-03  8:50                             ` Modestas Vainius
2010-06-04  1:03                               ` NIIBE Yutaka
2010-06-04  5:21                                 ` dann frazier
2010-06-04 10:44                                   ` Thibaut VARENE
2010-06-07 17:11                                     ` dann frazier
2010-06-07 18:27                                       ` Thibaut VARÈNE
2010-06-07 23:33                                         ` dann frazier
2010-06-06  1:01                                   ` Modestas Vainius
2010-04-02 12:22             ` James Bottomley
2010-04-05  0:39               ` NIIBE Yutaka
2010-04-05  2:51                 ` John David Anglin
2010-04-05  2:58                   ` John David Anglin
2010-04-05 16:18                   ` James Bottomley
2010-04-06  4:57                     ` NIIBE Yutaka
2010-04-06 13:37                       ` James Bottomley
2010-04-06 13:44                         ` James Bottomley

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=20100411172634.GD7756@hiauly1.hia.nrc.ca \
    --to=dave@hiauly1.hia.nrc.ca \
    --cc=carlos@systemhalted.org \
    --cc=dave.anglin@nrc-cnrc.gc.ca \
    --cc=deller@gmx.de \
    --cc=gniibe@fsij.org \
    --cc=linux-parisc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.