Skip to content

Commit 323d93f

Browse files
Peter Zijlstraingomolnar
authored andcommitted
cleanup: Always inline everything
KASAN bloat caused cleanup helper functions to not get inlined: vmlinux.o: error: objtool: irqentry_exit+0x323: call to class_user_rw_access_destructor() with UACCESS enabled Force inline all the cleanup helpers like they already are on normal builds. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://patch.msgid.link/20251031105435.GU4068168@noisy.programming.kicks-ass.net
1 parent 32034df commit 323d93f

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

include/linux/cleanup.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
*/
209209

210210
#define DEFINE_FREE(_name, _type, _free) \
211-
static inline void __free_##_name(void *p) { _type _T = *(_type *)p; _free; }
211+
static __always_inline void __free_##_name(void *p) { _type _T = *(_type *)p; _free; }
212212

213213
#define __free(_name) __cleanup(__free_##_name)
214214

@@ -220,7 +220,7 @@
220220
__val; \
221221
})
222222

223-
static inline __must_check
223+
static __always_inline __must_check
224224
const volatile void * __must_check_fn(const volatile void *val)
225225
{ return val; }
226226

@@ -274,16 +274,16 @@ const volatile void * __must_check_fn(const volatile void *val)
274274

275275
#define DEFINE_CLASS(_name, _type, _exit, _init, _init_args...) \
276276
typedef _type class_##_name##_t; \
277-
static inline void class_##_name##_destructor(_type *p) \
277+
static __always_inline void class_##_name##_destructor(_type *p) \
278278
{ _type _T = *p; _exit; } \
279-
static inline _type class_##_name##_constructor(_init_args) \
279+
static __always_inline _type class_##_name##_constructor(_init_args) \
280280
{ _type t = _init; return t; }
281281

282282
#define EXTEND_CLASS(_name, ext, _init, _init_args...) \
283283
typedef class_##_name##_t class_##_name##ext##_t; \
284-
static inline void class_##_name##ext##_destructor(class_##_name##_t *p)\
284+
static __always_inline void class_##_name##ext##_destructor(class_##_name##_t *p) \
285285
{ class_##_name##_destructor(p); } \
286-
static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \
286+
static __always_inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \
287287
{ class_##_name##_t t = _init; return t; }
288288

289289
#define CLASS(_name, var) \
@@ -347,15 +347,15 @@ static __maybe_unused const bool class_##_name##_is_conditional = _is_cond
347347
})
348348

349349
#define __DEFINE_GUARD_LOCK_PTR(_name, _exp) \
350-
static inline void *class_##_name##_lock_ptr(class_##_name##_t *_T) \
350+
static __always_inline void *class_##_name##_lock_ptr(class_##_name##_t *_T) \
351351
{ \
352352
void *_ptr = (void *)(__force unsigned long)*(_exp); \
353353
if (IS_ERR(_ptr)) { \
354354
_ptr = NULL; \
355355
} \
356356
return _ptr; \
357357
} \
358-
static inline int class_##_name##_lock_err(class_##_name##_t *_T) \
358+
static __always_inline int class_##_name##_lock_err(class_##_name##_t *_T) \
359359
{ \
360360
long _rc = (__force unsigned long)*(_exp); \
361361
if (!_rc) { \
@@ -384,9 +384,9 @@ static __maybe_unused const bool class_##_name##_is_conditional = _is_cond
384384
EXTEND_CLASS(_name, _ext, \
385385
({ void *_t = _T; int _RET = (_lock); if (_T && !(_cond)) _t = ERR_PTR(_RET); _t; }), \
386386
class_##_name##_t _T) \
387-
static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \
387+
static __always_inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \
388388
{ return class_##_name##_lock_ptr(_T); } \
389-
static inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \
389+
static __always_inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \
390390
{ return class_##_name##_lock_err(_T); }
391391

392392
/*
@@ -466,23 +466,23 @@ typedef struct { \
466466
__VA_ARGS__; \
467467
} class_##_name##_t; \
468468
\
469-
static inline void class_##_name##_destructor(class_##_name##_t *_T) \
469+
static __always_inline void class_##_name##_destructor(class_##_name##_t *_T) \
470470
{ \
471471
if (!__GUARD_IS_ERR(_T->lock)) { _unlock; } \
472472
} \
473473
\
474474
__DEFINE_GUARD_LOCK_PTR(_name, &_T->lock)
475475

476476
#define __DEFINE_LOCK_GUARD_1(_name, _type, _lock) \
477-
static inline class_##_name##_t class_##_name##_constructor(_type *l) \
477+
static __always_inline class_##_name##_t class_##_name##_constructor(_type *l) \
478478
{ \
479479
class_##_name##_t _t = { .lock = l }, *_T = &_t; \
480480
_lock; \
481481
return _t; \
482482
}
483483

484484
#define __DEFINE_LOCK_GUARD_0(_name, _lock) \
485-
static inline class_##_name##_t class_##_name##_constructor(void) \
485+
static __always_inline class_##_name##_t class_##_name##_constructor(void) \
486486
{ \
487487
class_##_name##_t _t = { .lock = (void*)1 }, \
488488
*_T __maybe_unused = &_t; \
@@ -508,9 +508,9 @@ __DEFINE_LOCK_GUARD_0(_name, _lock)
508508
if (_T->lock && !(_cond)) _T->lock = ERR_PTR(_RET);\
509509
_t; }), \
510510
typeof_member(class_##_name##_t, lock) l) \
511-
static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \
511+
static __always_inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \
512512
{ return class_##_name##_lock_ptr(_T); } \
513-
static inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \
513+
static __always_inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \
514514
{ return class_##_name##_lock_err(_T); }
515515

516516
#define DEFINE_LOCK_GUARD_1_COND_3(_name, _ext, _lock) \

0 commit comments

Comments
 (0)