Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/glibc/2.14/ports: 6610_all_glibc-r10k-workarounds.patch
Date: Tue, 05 Jul 2011 06:00:14
Message-Id: 20110705060004.E0AD720057@flycatcher.gentoo.org
1 vapier 11/07/05 06:00:04
2
3 Added: 6610_all_glibc-r10k-workarounds.patch
4 Log:
5 re-add the mips r10k errata workaround #373361 by Matt Turner
6
7 Revision Changes Path
8 1.1 src/patchsets/glibc/2.14/ports/6610_all_glibc-r10k-workarounds.patch
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14/ports/6610_all_glibc-r10k-workarounds.patch?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.14/ports/6610_all_glibc-r10k-workarounds.patch?rev=1.1&content-type=text/plain
12
13 Index: 6610_all_glibc-r10k-workarounds.patch
14 ===================================================================
15 http://bugs.gentoo.org/373361
16
17 From c804165aae6e4055a7a8c42cf66ea0b1a29ef3ed Mon Sep 17 00:00:00 2001
18 From: Matt Turner <mattst88@×××××.com>
19 Date: Tue, 28 Jun 2011 11:30:53 -0400
20 Subject: [PATCH] mips: work-around R10k ll/sc errata
21
22 The R10000 needs an LL/SC Workaround. If not applied all R10k before
23 rev 3.0 misbehave on atomic ops and rev 2.6 and lower (e.g. SGI IP28)
24 die after very few seconds with a deadlock due to even more erratas.
25 ---
26 ChangeLog.mips | 4 ++++
27 sysdeps/mips/bits/atomic.h | 38 ++++++++++++++++++++++++++++++++------
28 2 files changed, 36 insertions(+), 6 deletions(-)
29
30 diff --git a/sysdeps/mips/bits/atomic.h b/sysdeps/mips/bits/atomic.h
31 index 11b3467..2bd723d 100644
32 --- a/ports/sysdeps/mips/bits/atomic.h
33 +++ b/ports/sysdeps/mips/bits/atomic.h
34 @@ -49,6 +49,32 @@ typedef uintmax_t uatomic_max_t;
35 # define MIPS_SYNC sync
36 #endif
37
38 +/* Certain revisions of the R10000 Processor need an LL/SC Workaround
39 + enabled. Revisions before 3.0 misbehave on atomic operations, and
40 + Revs 2.6 and lower deadlock after several seconds due to other errata.
41 +
42 + To quote the R10K Errata:
43 + Workaround: The basic idea is to inhibit the four instructions
44 + from simultaneously becoming active in R10000. Padding all
45 + ll/sc sequences with nops or changing the looping branch in the
46 + routines to a branch likely (which is always predicted taken
47 + by R10000) will work. The nops should go after the loop, and the
48 + number of them should be 28. This number could be decremented for
49 + each additional instruction in the ll/sc loop such as the lock
50 + modifier(s) between the ll and sc, the looping branch and its
51 + delay slot. For typical short routines with one ll/sc loop, any
52 + instructions after the loop could also count as a decrement. The
53 + nop workaround pollutes the cache more but would be a few cycles
54 + faster if all the code is in the cache and the looping branch
55 + is predicted not taken. */
56 +
57 +
58 +#ifdef _MIPS_ARCH_R10000
59 +#define R10K_BEQZ_INSN "beqzl"
60 +#else
61 +#define R10K_BEQZ_INSN "beqz"
62 +#endif
63 +
64 #define MIPS_SYNC_STR_2(X) #X
65 #define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X)
66 #define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC)
67 @@ -74,7 +100,7 @@ typedef uintmax_t uatomic_max_t;
68 "bne %0,%3,2f\n\t" \
69 "move %1,%4\n\t" \
70 "sc %1,%2\n\t" \
71 - "beqz %1,1b\n" \
72 + R10K_BEQZ_INSN" %1,1b\n" \
73 acq "\n\t" \
74 ".set pop\n" \
75 "2:\n\t" \
76 @@ -98,7 +124,7 @@ typedef uintmax_t uatomic_max_t;
77 "bne %0,%3,2f\n\t" \
78 "move %1,%4\n\t" \
79 "scd %1,%2\n\t" \
80 - "beqz %1,1b\n" \
81 + R10K_BEQZ_INSN" %1,1b\n" \
82 acq "\n\t" \
83 ".set pop\n" \
84 "2:\n\t" \
85 @@ -192,7 +218,7 @@ typedef uintmax_t uatomic_max_t;
86 "ll %0,%4\n\t" \
87 "move %1,%3\n\t" \
88 "sc %1,%2\n\t" \
89 - "beqz %1,1b\n" \
90 + R10K_BEQZ_INSN" %1,1b\n" \
91 acq "\n\t" \
92 ".set pop\n" \
93 "2:\n\t" \
94 @@ -216,7 +242,7 @@ typedef uintmax_t uatomic_max_t;
95 "lld %0,%4\n\t" \
96 "move %1,%3\n\t" \
97 "scd %1,%2\n\t" \
98 - "beqz %1,1b\n" \
99 + R10K_BEQZ_INSN" %1,1b\n" \
100 acq "\n\t" \
101 ".set pop\n" \
102 "2:\n\t" \
103 @@ -251,7 +277,7 @@ typedef uintmax_t uatomic_max_t;
104 "ll %0,%4\n\t" \
105 "addu %1,%0,%3\n\t" \
106 "sc %1,%2\n\t" \
107 - "beqz %1,1b\n" \
108 + R10K_BEQZ_INSN" %1,1b\n" \
109 acq "\n\t" \
110 ".set pop\n" \
111 "2:\n\t" \
112 @@ -275,7 +301,7 @@ typedef uintmax_t uatomic_max_t;
113 "lld %0,%4\n\t" \
114 "daddu %1,%0,%3\n\t" \
115 "scd %1,%2\n\t" \
116 - "beqz %1,1b\n" \
117 + R10K_BEQZ_INSN" %1,1b\n" \
118 acq "\n\t" \
119 ".set pop\n" \
120 "2:\n\t" \
121 --
122 1.7.3.4