diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-03-05 23:31:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-03-05 23:31:14 -0500 |
commit | ce380619fab99036f5e745c7a865b21c59f005f6 (patch) | |
tree | 04c32364dabb8917c3beeb740357b4c0d0232792 | |
parent | 094b58e1040a44f991d7ab628035e69c4d6b79c9 (diff) | |
parent | 48e362dd96f37d819042f848888b2c6407e01e6d (diff) |
Merge tag 'please-pull-ia64_misc' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
Pull ia64 cleanups from Tony Luck:
- More atomic cleanup from willy
- Fix a python script to work with version 3
- Some other small cleanups
* tag 'please-pull-ia64_misc' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
ia64/err-inject: fix spelling mistake: "capapbilities" -> "capabilities"
ia64/err-inject: Use get_user_pages_fast()
ia64: doc: tweak whitespace for 'console=' parameter
ia64: Convert remaining atomic operations
ia64: convert unwcheck.py to python3
-rw-r--r-- | Documentation/ia64/serial.txt | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/atomic.h | 69 | ||||
-rw-r--r-- | arch/ia64/kernel/err_inject.c | 4 | ||||
-rw-r--r-- | arch/ia64/scripts/unwcheck.py | 16 |
4 files changed, 34 insertions, 57 deletions
diff --git a/Documentation/ia64/serial.txt b/Documentation/ia64/serial.txt index 6869c73de4e2..a63d2c54329b 100644 --- a/Documentation/ia64/serial.txt +++ b/Documentation/ia64/serial.txt | |||
@@ -111,7 +111,7 @@ TROUBLESHOOTING SERIAL CONSOLE PROBLEMS | |||
111 | 111 | ||
112 | - If you don't have an HCDP, the kernel doesn't know where | 112 | - If you don't have an HCDP, the kernel doesn't know where |
113 | your console lives until the driver discovers serial | 113 | your console lives until the driver discovers serial |
114 | devices. Use "console=uart, io,0x3f8" (or appropriate | 114 | devices. Use "console=uart,io,0x3f8" (or appropriate |
115 | address for your machine). | 115 | address for your machine). |
116 | 116 | ||
117 | Kernel and init script output works fine, but no "login:" prompt: | 117 | Kernel and init script output works fine, but no "login:" prompt: |
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h index 762eeb0fcc1d..2524fb60fbc2 100644 --- a/arch/ia64/include/asm/atomic.h +++ b/arch/ia64/include/asm/atomic.h | |||
@@ -66,38 +66,35 @@ ATOMIC_OPS(add, +) | |||
66 | ATOMIC_OPS(sub, -) | 66 | ATOMIC_OPS(sub, -) |
67 | 67 | ||
68 | #ifdef __OPTIMIZE__ | 68 | #ifdef __OPTIMIZE__ |
69 | #define __ia64_atomic_const(i) __builtin_constant_p(i) ? \ | 69 | #define __ia64_atomic_const(i) \ |
70 | static const int __ia64_atomic_p = __builtin_constant_p(i) ? \ | ||
70 | ((i) == 1 || (i) == 4 || (i) == 8 || (i) == 16 || \ | 71 | ((i) == 1 || (i) == 4 || (i) == 8 || (i) == 16 || \ |
71 | (i) == -1 || (i) == -4 || (i) == -8 || (i) == -16) : 0 | 72 | (i) == -1 || (i) == -4 || (i) == -8 || (i) == -16) : 0;\ |
73 | __ia64_atomic_p | ||
74 | #else | ||
75 | #define __ia64_atomic_const(i) 0 | ||
76 | #endif | ||
72 | 77 | ||
73 | #define atomic_add_return(i, v) \ | 78 | #define atomic_add_return(i,v) \ |
74 | ({ \ | 79 | ({ \ |
75 | int __i = (i); \ | 80 | int __ia64_aar_i = (i); \ |
76 | static const int __ia64_atomic_p = __ia64_atomic_const(i); \ | 81 | __ia64_atomic_const(i) \ |
77 | __ia64_atomic_p ? ia64_fetch_and_add(__i, &(v)->counter) : \ | 82 | ? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \ |
78 | ia64_atomic_add(__i, v); \ | 83 | : ia64_atomic_add(__ia64_aar_i, v); \ |
79 | }) | 84 | }) |
80 | 85 | ||
81 | #define atomic_sub_return(i, v) \ | 86 | #define atomic_sub_return(i,v) \ |
82 | ({ \ | 87 | ({ \ |
83 | int __i = (i); \ | 88 | int __ia64_asr_i = (i); \ |
84 | static const int __ia64_atomic_p = __ia64_atomic_const(i); \ | 89 | __ia64_atomic_const(i) \ |
85 | __ia64_atomic_p ? ia64_fetch_and_add(-__i, &(v)->counter) : \ | 90 | ? ia64_fetch_and_add(-__ia64_asr_i, &(v)->counter) \ |
86 | ia64_atomic_sub(__i, v); \ | 91 | : ia64_atomic_sub(__ia64_asr_i, v); \ |
87 | }) | 92 | }) |
88 | #else | ||
89 | #define atomic_add_return(i, v) ia64_atomic_add(i, v) | ||
90 | #define atomic_sub_return(i, v) ia64_atomic_sub(i, v) | ||
91 | #endif | ||
92 | 93 | ||
93 | #define atomic_fetch_add(i,v) \ | 94 | #define atomic_fetch_add(i,v) \ |
94 | ({ \ | 95 | ({ \ |
95 | int __ia64_aar_i = (i); \ | 96 | int __ia64_aar_i = (i); \ |
96 | (__builtin_constant_p(i) \ | 97 | __ia64_atomic_const(i) \ |
97 | && ( (__ia64_aar_i == 1) || (__ia64_aar_i == 4) \ | ||
98 | || (__ia64_aar_i == 8) || (__ia64_aar_i == 16) \ | ||
99 | || (__ia64_aar_i == -1) || (__ia64_aar_i == -4) \ | ||
100 | || (__ia64_aar_i == -8) || (__ia64_aar_i == -16))) \ | ||
101 | ? ia64_fetchadd(__ia64_aar_i, &(v)->counter, acq) \ | 98 | ? ia64_fetchadd(__ia64_aar_i, &(v)->counter, acq) \ |
102 | : ia64_atomic_fetch_add(__ia64_aar_i, v); \ | 99 | : ia64_atomic_fetch_add(__ia64_aar_i, v); \ |
103 | }) | 100 | }) |
@@ -105,11 +102,7 @@ ATOMIC_OPS(sub, -) | |||
105 | #define atomic_fetch_sub(i,v) \ | 102 | #define atomic_fetch_sub(i,v) \ |
106 | ({ \ | 103 | ({ \ |
107 | int __ia64_asr_i = (i); \ | 104 | int __ia64_asr_i = (i); \ |
108 | (__builtin_constant_p(i) \ | 105 | __ia64_atomic_const(i) \ |
109 | && ( (__ia64_asr_i == 1) || (__ia64_asr_i == 4) \ | ||
110 | || (__ia64_asr_i == 8) || (__ia64_asr_i == 16) \ | ||
111 | || (__ia64_asr_i == -1) || (__ia64_asr_i == -4) \ | ||
112 | || (__ia64_asr_i == -8) || (__ia64_asr_i == -16))) \ | ||
113 | ? ia64_fetchadd(-__ia64_asr_i, &(v)->counter, acq) \ | 106 | ? ia64_fetchadd(-__ia64_asr_i, &(v)->counter, acq) \ |
114 | : ia64_atomic_fetch_sub(__ia64_asr_i, v); \ | 107 | : ia64_atomic_fetch_sub(__ia64_asr_i, v); \ |
115 | }) | 108 | }) |
@@ -170,11 +163,7 @@ ATOMIC64_OPS(sub, -) | |||
170 | #define atomic64_add_return(i,v) \ | 163 | #define atomic64_add_return(i,v) \ |
171 | ({ \ | 164 | ({ \ |
172 | long __ia64_aar_i = (i); \ | 165 | long __ia64_aar_i = (i); \ |
173 | (__builtin_constant_p(i) \ | 166 | __ia64_atomic_const(i) \ |
174 | && ( (__ia64_aar_i == 1) || (__ia64_aar_i == 4) \ | ||
175 | || (__ia64_aar_i == 8) || (__ia64_aar_i == 16) \ | ||
176 | || (__ia64_aar_i == -1) || (__ia64_aar_i == -4) \ | ||
177 | || (__ia64_aar_i == -8) || (__ia64_aar_i == -16))) \ | ||
178 | ? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \ | 167 | ? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \ |
179 | : ia64_atomic64_add(__ia64_aar_i, v); \ | 168 | : ia64_atomic64_add(__ia64_aar_i, v); \ |
180 | }) | 169 | }) |
@@ -182,11 +171,7 @@ ATOMIC64_OPS(sub, -) | |||
182 | #define atomic64_sub_return(i,v) \ | 171 | #define atomic64_sub_return(i,v) \ |
183 | ({ \ | 172 | ({ \ |
184 | long __ia64_asr_i = (i); \ | 173 | long __ia64_asr_i = (i); \ |
185 | (__builtin_constant_p(i) \ | 174 | __ia64_atomic_const(i) \ |
186 | && ( (__ia64_asr_i == 1) || (__ia64_asr_i == 4) \ | ||
187 | || (__ia64_asr_i == 8) || (__ia64_asr_i == 16) \ | ||
188 | || (__ia64_asr_i == -1) || (__ia64_asr_i == -4) \ | ||
189 | || (__ia64_asr_i == -8) || (__ia64_asr_i == -16))) \ | ||
190 | ? ia64_fetch_and_add(-__ia64_asr_i, &(v)->counter) \ | 175 | ? ia64_fetch_and_add(-__ia64_asr_i, &(v)->counter) \ |
191 | : ia64_atomic64_sub(__ia64_asr_i, v); \ | 176 | : ia64_atomic64_sub(__ia64_asr_i, v); \ |
192 | }) | 177 | }) |
@@ -194,11 +179,7 @@ ATOMIC64_OPS(sub, -) | |||
194 | #define atomic64_fetch_add(i,v) \ | 179 | #define atomic64_fetch_add(i,v) \ |
195 | ({ \ | 180 | ({ \ |
196 | long __ia64_aar_i = (i); \ | 181 | long __ia64_aar_i = (i); \ |
197 | (__builtin_constant_p(i) \ | 182 | __ia64_atomic_const(i) \ |
198 | && ( (__ia64_aar_i == 1) || (__ia64_aar_i == 4) \ | ||
199 | || (__ia64_aar_i == 8) || (__ia64_aar_i == 16) \ | ||
200 | || (__ia64_aar_i == -1) || (__ia64_aar_i == -4) \ | ||
201 | || (__ia64_aar_i == -8) || (__ia64_aar_i == -16))) \ | ||
202 | ? ia64_fetchadd(__ia64_aar_i, &(v)->counter, acq) \ | 183 | ? ia64_fetchadd(__ia64_aar_i, &(v)->counter, acq) \ |
203 | : ia64_atomic64_fetch_add(__ia64_aar_i, v); \ | 184 | : ia64_atomic64_fetch_add(__ia64_aar_i, v); \ |
204 | }) | 185 | }) |
@@ -206,11 +187,7 @@ ATOMIC64_OPS(sub, -) | |||
206 | #define atomic64_fetch_sub(i,v) \ | 187 | #define atomic64_fetch_sub(i,v) \ |
207 | ({ \ | 188 | ({ \ |
208 | long __ia64_asr_i = (i); \ | 189 | long __ia64_asr_i = (i); \ |
209 | (__builtin_constant_p(i) \ | 190 | __ia64_atomic_const(i) \ |
210 | && ( (__ia64_asr_i == 1) || (__ia64_asr_i == 4) \ | ||
211 | || (__ia64_asr_i == 8) || (__ia64_asr_i == 16) \ | ||
212 | || (__ia64_asr_i == -1) || (__ia64_asr_i == -4) \ | ||
213 | || (__ia64_asr_i == -8) || (__ia64_asr_i == -16))) \ | ||
214 | ? ia64_fetchadd(-__ia64_asr_i, &(v)->counter, acq) \ | 191 | ? ia64_fetchadd(-__ia64_asr_i, &(v)->counter, acq) \ |
215 | : ia64_atomic64_fetch_sub(__ia64_asr_i, v); \ | 192 | : ia64_atomic64_fetch_sub(__ia64_asr_i, v); \ |
216 | }) | 193 | }) |
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index 85bba43e7d5d..8b5b8e6bc9d9 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c | |||
@@ -117,7 +117,7 @@ store_call_start(struct device *dev, struct device_attribute *attr, | |||
117 | 117 | ||
118 | #ifdef ERR_INJ_DEBUG | 118 | #ifdef ERR_INJ_DEBUG |
119 | printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]); | 119 | printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]); |
120 | printk(KERN_DEBUG "capapbilities=%lx,\n", capabilities[cpu]); | 120 | printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]); |
121 | printk(KERN_DEBUG "resources=%lx\n", resources[cpu]); | 121 | printk(KERN_DEBUG "resources=%lx\n", resources[cpu]); |
122 | #endif | 122 | #endif |
123 | return size; | 123 | return size; |
@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, | |||
142 | u64 virt_addr=simple_strtoull(buf, NULL, 16); | 142 | u64 virt_addr=simple_strtoull(buf, NULL, 16); |
143 | int ret; | 143 | int ret; |
144 | 144 | ||
145 | ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL); | 145 | ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL); |
146 | if (ret<=0) { | 146 | if (ret<=0) { |
147 | #ifdef ERR_INJ_DEBUG | 147 | #ifdef ERR_INJ_DEBUG |
148 | printk("Virtual address %lx is not existing.\n",virt_addr); | 148 | printk("Virtual address %lx is not existing.\n",virt_addr); |
diff --git a/arch/ia64/scripts/unwcheck.py b/arch/ia64/scripts/unwcheck.py index 89f3a1480a63..c55276e31b6b 100644 --- a/arch/ia64/scripts/unwcheck.py +++ b/arch/ia64/scripts/unwcheck.py | |||
@@ -16,7 +16,7 @@ import re | |||
16 | import sys | 16 | import sys |
17 | 17 | ||
18 | if len(sys.argv) != 2: | 18 | if len(sys.argv) != 2: |
19 | print "Usage: %s FILE" % sys.argv[0] | 19 | print("Usage: %s FILE" % sys.argv[0]) |
20 | sys.exit(2) | 20 | sys.exit(2) |
21 | 21 | ||
22 | readelf = os.getenv("READELF", "readelf") | 22 | readelf = os.getenv("READELF", "readelf") |
@@ -29,7 +29,7 @@ def check_func (func, slots, rlen_sum): | |||
29 | global num_errors | 29 | global num_errors |
30 | num_errors += 1 | 30 | num_errors += 1 |
31 | if not func: func = "[%#x-%#x]" % (start, end) | 31 | if not func: func = "[%#x-%#x]" % (start, end) |
32 | print "ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum) | 32 | print("ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum)) |
33 | return | 33 | return |
34 | 34 | ||
35 | num_funcs = 0 | 35 | num_funcs = 0 |
@@ -43,23 +43,23 @@ for line in os.popen("%s -u %s" % (readelf, sys.argv[1])): | |||
43 | check_func(func, slots, rlen_sum) | 43 | check_func(func, slots, rlen_sum) |
44 | 44 | ||
45 | func = m.group(1) | 45 | func = m.group(1) |
46 | start = long(m.group(2), 16) | 46 | start = int(m.group(2), 16) |
47 | end = long(m.group(3), 16) | 47 | end = int(m.group(3), 16) |
48 | slots = 3 * (end - start) / 16 | 48 | slots = 3 * (end - start) / 16 |
49 | rlen_sum = 0L | 49 | rlen_sum = 0 |
50 | num_funcs += 1 | 50 | num_funcs += 1 |
51 | else: | 51 | else: |
52 | m = rlen_pattern.match(line) | 52 | m = rlen_pattern.match(line) |
53 | if m: | 53 | if m: |
54 | rlen_sum += long(m.group(1)) | 54 | rlen_sum += int(m.group(1)) |
55 | check_func(func, slots, rlen_sum) | 55 | check_func(func, slots, rlen_sum) |
56 | 56 | ||
57 | if num_errors == 0: | 57 | if num_errors == 0: |
58 | print "No errors detected in %u functions." % num_funcs | 58 | print("No errors detected in %u functions." % num_funcs) |
59 | else: | 59 | else: |
60 | if num_errors > 1: | 60 | if num_errors > 1: |
61 | err="errors" | 61 | err="errors" |
62 | else: | 62 | else: |
63 | err="error" | 63 | err="error" |
64 | print "%u %s detected in %u functions." % (num_errors, err, num_funcs) | 64 | print("%u %s detected in %u functions." % (num_errors, err, num_funcs)) |
65 | sys.exit(1) | 65 | sys.exit(1) |