History

Merge tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fixes from Borislav Petkov: - Allow the compiler to optimize away unused percpu accesses and change the local_lock_* macros back to inline functions - A couple of fixes to static call insn patching * tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: Revert "mm/page_alloc: mark pagesets as __maybe_unused" Revert "locking/local_lock: Make the empty local_lock_*() function a macro." x86/percpu: Remove volatile from arch_raw_cpu_ptr(). static_call: Remove __DEFINE_STATIC_CALL macro static_call: Properly initialise DEFINE_STATIC_CALL_RET0() static_call: Don't make __static_call_return0 static x86,static_call: Fix __static_call_return0 for i386

Linus Torvalds committed 4 years ago

Commit 50c94de2 parents 7136849 273ba8510 files · +585 −572Browse files

Showing the changes to include (2 of 10 files). Show all

Unified · Split

2 files
  1. include/linux/local_lock_internal.h +3 −3
  2. include/linux/static_call.h +28 −20
include/linux/local_lock_internal.h+3−3
@@ -44,9 +44,9 @@ static inline void local_lock_debug_init(local_lock_t *l) · 43 unmodified lines
4444 }
4545 #else /* CONFIG_DEBUG_LOCK_ALLOC */
4646 # define LOCAL_LOCK_DEBUG_INIT(lockname)
47−# define local_lock_acquire(__ll) do { typecheck(local_lock_t *, __ll); } while (0)
48−# define local_lock_release(__ll) do { typecheck(local_lock_t *, __ll); } while (0)
49−# define local_lock_debug_init(__ll) do { typecheck(local_lock_t *, __ll); } while (0)
47+static inline void local_lock_acquire(local_lock_t *l) { }
48+static inline void local_lock_release(local_lock_t *l) { }
49+static inline void local_lock_debug_init(local_lock_t *l) { }
5050 #endif /* !CONFIG_DEBUG_LOCK_ALLOC */
5151
5252 #define INIT_LOCAL_LOCK(lockname) { LOCAL_LOCK_DEBUG_INIT(lockname) }
include/linux/static_call.h+28−20
@@ -180,13 +180,13 @@ extern int static_call_text_reserved(void *start, void *end); · 179 unmodified lines
180180
181181 extern long __static_call_return0(void);
182182
183−#define __DEFINE_STATIC_CALL(name, _func, _func_init) \
183+#define DEFINE_STATIC_CALL(name, _func) \
184184 DECLARE_STATIC_CALL(name, _func); \
185185 struct static_call_key STATIC_CALL_KEY(name) = { \
186− .func = _func_init, \
186+ .func = _func, \
187187 .type = 1, \
188188 }; \
189− ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func_init)
189+ ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func)
190190
191191 #define DEFINE_STATIC_CALL_NULL(name, _func) \
192192 DECLARE_STATIC_CALL(name, _func); \
@@ -196,6 +196,14 @@ extern long __static_call_return0(void); · 3 unmodified lines
196196 }; \
197197 ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)
198198
199+#define DEFINE_STATIC_CALL_RET0(name, _func) \
200+ DECLARE_STATIC_CALL(name, _func); \
201+ struct static_call_key STATIC_CALL_KEY(name) = { \
202+ .func = __static_call_return0, \
203+ .type = 1, \
204+ }; \
205+ ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name)
206+
199207 #define static_call_cond(name) (void)__static_call(name)
200208
201209 #define EXPORT_STATIC_CALL(name) \
@@ -217,12 +225,12 @@ extern long __static_call_return0(void); · 15 unmodified lines
217225
218226 static inline int static_call_init(void) { return 0; }
219227
220−#define __DEFINE_STATIC_CALL(name, _func, _func_init) \
228+#define DEFINE_STATIC_CALL(name, _func) \
221229 DECLARE_STATIC_CALL(name, _func); \
222230 struct static_call_key STATIC_CALL_KEY(name) = { \
223− .func = _func_init, \
231+ .func = _func, \
224232 }; \
225− ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func_init)
233+ ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func)
226234
227235 #define DEFINE_STATIC_CALL_NULL(name, _func) \
228236 DECLARE_STATIC_CALL(name, _func); \
@@ -231,6 +239,12 @@ static inline int static_call_init(void) { return 0; } · 2 unmodified lines
231239 }; \
232240 ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)
233241
242+#define DEFINE_STATIC_CALL_RET0(name, _func) \
243+ DECLARE_STATIC_CALL(name, _func); \
244+ struct static_call_key STATIC_CALL_KEY(name) = { \
245+ .func = __static_call_return0, \
246+ }; \
247+ ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name)
234248
235249 #define static_call_cond(name) (void)__static_call(name)
236250
@@ -248,10 +262,7 @@ static inline int static_call_text_reserved(void *start, void *end) · 11 unmodified lines
248262 return 0;
249263 }
250264
251−static inline long __static_call_return0(void)
252−{
253− return 0;
254−}
265+extern long __static_call_return0(void);
255266
256267 #define EXPORT_STATIC_CALL(name) \
257268 EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \
@@ -281,11 +292,14 @@ static inline long __static_call_return0(void) · 23 unmodified lines
281292 .func = _func_init, \
282293 }
283294
295+#define DEFINE_STATIC_CALL(name, _func) \
296+ __DEFINE_STATIC_CALL(name, _func, _func)
297+
284298 #define DEFINE_STATIC_CALL_NULL(name, _func) \
285− DECLARE_STATIC_CALL(name, _func); \
286− struct static_call_key STATIC_CALL_KEY(name) = { \
287− .func = NULL, \
288− }
299+ __DEFINE_STATIC_CALL(name, _func, NULL)
300+
301+#define DEFINE_STATIC_CALL_RET0(name, _func) \
302+ __DEFINE_STATIC_CALL(name, _func, __static_call_return0)
289303
290304 static inline void __static_call_nop(void) { }
291305
@@ -327,10 +341,4 @@ static inline int static_call_text_reserved(void *start, void *end) · 35 unmodified lines
327341
328342 #endif /* CONFIG_HAVE_STATIC_CALL */
329343
330−#define DEFINE_STATIC_CALL(name, _func) \
331− __DEFINE_STATIC_CALL(name, _func, _func)
332−
333−#define DEFINE_STATIC_CALL_RET0(name, _func) \
334− __DEFINE_STATIC_CALL(name, _func, __static_call_return0)
335−
336344 #endif /* _LINUX_STATIC_CALL_H */