Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7233aae

Browse files
committed
Fix PPC s_lock operations to work correctly on multi-CPU machines.
Need 'isync' during TAS and 'sync' during S_UNLOCK.
1 parentb2735fc commit7233aae

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

‎src/backend/storage/lmgr/s_lock.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/s_lock.c,v 1.8 2002/06/20 20:29:35 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/s_lock.c,v 1.9 2002/09/21 00:14:05 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -115,6 +115,9 @@ _success:\n\
115115
/* used in darwin. */
116116
/* We key off __APPLE__ here because this function differs from
117117
* the LinuxPPC implementation only in compiler syntax.
118+
*
119+
* NOTE: per the Enhanced PowerPC Architecture manual, v1.0 dated 7-May-2002,
120+
* an isync is a sufficient synchronization barrier after a lwarx/stwcx loop.
118121
*/
119122
staticvoid
120123
tas_dummy()
@@ -134,6 +137,7 @@ tas:\n\
134137
fail:li r3,1\n\
135138
blr \n\
136139
success:\n\
140+
isync\n\
137141
li r3,0\n\
138142
blr\n\
139143
");
@@ -158,6 +162,7 @@ tas:\n\
158162
fail:li3,1 \n\
159163
blr \n\
160164
success:\n\
165+
isync\n\
161166
li 3,0\n\
162167
blr\n\
163168
");

‎src/include/storage/s_lock.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
6464
* Portions Copyright (c) 1994, Regents of the University of California
6565
*
66-
* $Id: s_lock.h,v 1.100 2002/09/02 04:42:52 momjian Exp $
66+
* $Id: s_lock.h,v 1.101 2002/09/21 00:14:05 tgl Exp $
6767
*
6868
*-------------------------------------------------------------------------
6969
*/
@@ -217,6 +217,21 @@ tas(volatile slock_t *lock)
217217
#endif/* defined(__mc68000__) && defined(__linux__) */
218218

219219

220+
#if defined(__ppc__)|| defined(__powerpc__)
221+
/*
222+
* We currently use out-of-line assembler for TAS on PowerPC; see s_lock.c.
223+
* S_UNLOCK is almost standard but requires a "sync" instruction.
224+
*/
225+
#defineS_UNLOCK(lock)\
226+
do \
227+
{\
228+
__asm__ __volatile__ ("sync \n"); \
229+
*((volatile slock_t *) (lock)) = 0; \
230+
} while (0)
231+
232+
#endif/* defined(__ppc__) || defined(__powerpc__) */
233+
234+
220235
#if defined(NEED_VAX_TAS_ASM)
221236
/*
222237
* VAXen -- even multiprocessor ones

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp