hrtimer: Mark is_migration_base() with __maybe_unused
PATCH 1/1 hrtimer: Mark is_migration_base() with __maybe_unused
When is_migration_base() is unused, it prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static inline bool is_migration_base(struct hrtimer_clock_base *base)
| ^~~~~~~~~~~~~~~~~
Fix this by marking it with __maybe_unused.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").
--- kernel/time/hrtimer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/hrtimer.c +2 -2
@@ -145,7 +145,7 @@ static struct hrtimer_cpu_base migration_cpu_base = {#define migration_base migration_cpu_base.clock_base[0] -static inline bool is_migration_base (struct hrtimer_clock_base *base) +static inline __maybe_unused bool is_migration_base (struct hrtimer_clock_base *base) {return base == &migration_base; }
@@ -275,7 +275,7 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,#else /* CONFIG_SMP */ -static inline bool is_migration_base (struct hrtimer_clock_base *base) +static inline __maybe_unused bool is_migration_base (struct hrtimer_clock_base *base) {return false; }
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
[tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
The following commit has been merged into the timers/urgent branch of tip:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 3ff6e36be060f0a8870f76155e14de128058b964 Gitweb: https://git.kernel.org/tip/3ff6e36be060f0a8870f76155e14de128058b964 Author: Andy Shevchenko <[email protected]> AuthorDate: Thu, 16 Jan 2025 18:07:45 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 23 Jan 2025 11:47:23 +01:00
hrtimers: Mark is_migration_base() with __always_inline
When is_migration_base() is unused, it prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static inline bool is_migration_base(struct hrtimer_clock_base *base)
| ^~~~~~~~~~~~~~~~~
Fix this by marking it with __always_inline.
[ tglx: Use __always_inline instead of __maybe_unused ]
--- kernel/time/hrtimer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/hrtimer.c +2 -2
@@ -145,7 +145,7 @@ static struct hrtimer_cpu_base migration_cpu_base = {#define migration_base migration_cpu_base.clock_base[0] -static inline bool is_migration_base (struct hrtimer_clock_base *base) +static __always_inline bool is_migration_base(struct hrtimer_clock_base *base) {return base == &migration_base; }
@@ -275,7 +275,7 @@ again:#else /* CONFIG_SMP */ -static inline bool is_migration_base (struct hrtimer_clock_base *base) +static __always_inline bool is_migration_base(struct hrtimer_clock_base *base) {return false; }
Re: [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
Quoted 14 lines · On Thu, Jan 23, 2025 at 10:57:32AM -0000, tip-bot2 for Andy Shevchenko wrote:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 3ff6e36be060f0a8870f76155e14de128058b964 Gitweb: https://git.kernel.org/tip/3ff6e36be060f0a8870f76155e14de128058b964 Author: Andy Shevchenko <[email protected]> AuthorDate: Thu, 16 Jan 2025 18:07:45 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 23 Jan 2025 11:47:23 +01:00hrtimers: Mark
is_migration_base()with__always_inlineWhen
is_migration_base()is unused, it prevents kernel builds with clang,make W=1andCONFIG_WERROR=y:
Quoted 7 lines
kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static inline boolis_migration_base(struct hrtimer_clock_base *base)| ^~~~~~~~~~~~~~~~~Fix this by marking it with
__always_inline.[ tglx: Use
__always_inlineinstead of__maybe_unused]
Thanks, but it doesn't fix the problem:
kernel/time/hrtimer.c:156:29: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static __always_inline bool is_migration_base(struct hrtimer_clock_base *base)
| ^~~~~~~~~~~~~~~~~
1 error generated.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
Quoted 21 lines · Andy Shevchenko
Quoted 19 lines · On Thu, Jan 23, 2025 at 10:57:32AM -0000, tip-bot2 for Andy Shevchenko wrote:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 3ff6e36be060f0a8870f76155e14de128058b964 Gitweb: https://git.kernel.org/tip/3ff6e36be060f0a8870f76155e14de128058b964 Author: Andy Shevchenko <[email protected]> AuthorDate: Thu, 16 Jan 2025 18:07:45 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 23 Jan 2025 11:47:23 +01:00hrtimers: Mark
is_migration_base()with__always_inlineWhen
is_migration_base()is unused, it prevents kernel builds with clang,make W=1andCONFIG_WERROR=y:
kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static inline boolis_migration_base(struct hrtimer_clock_base *base)| ^~~~~~~~~~~~~~~~~Fix this by marking it with
__always_inline.
Quoted 8 lines
Quoted 1 line
[ tglx: Use
__always_inlineinstead of__maybe_unused]Thanks, but it doesn't fix the problem:
kernel/time/hrtimer.c:156:29: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static__always_inlineboolis_migration_base(struct hrtimer_clock_base *base)| ^~~~~~~~~~~~~~~~~1 error generated.
This is insane. Let me undo that for heavens sake.
[tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
In reply to Andy ShevchenkoThe following commit has been merged into the timers/urgent branch of tip:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 27af31e44949fa85550176520ef7086a0d00fd7b Gitweb: https://git.kernel.org/tip/27af31e44949fa85550176520ef7086a0d00fd7b Author: Andy Shevchenko <[email protected]> AuthorDate: Thu, 16 Jan 2025 18:07:45 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 23 Jan 2025 20:06:35 +01:00
hrtimers: Mark is_migration_base() with __always_inline
When is_migration_base() is unused, it prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static inline bool is_migration_base(struct hrtimer_clock_base *base)
| ^~~~~~~~~~~~~~~~~
Fix this by marking it with __always_inline.
[ tglx: Use __always_inline instead of __maybe_unused and move it into the
usage sites conditional ]
--- kernel/time/hrtimer.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
kernel/time/hrtimer.c +12 -10
@@ -145,11 +145,6 @@ static struct hrtimer_cpu_base migration_cpu_base = {#define migration_base migration_cpu_base.clock_base[0] -static inline bool is_migration_base (struct hrtimer_clock_base *base) -{ -return base == &migration_base; -} -/* * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock * means that all timers which are tied to this base via timer->base are
@@ -275,11 +270,6 @@ again:#else /* CONFIG_SMP */ -static inline bool is_migration_base (struct hrtimer_clock_base *base) -{ -return false; -} -static inline struct hrtimer_clock_base *lock_hrtimer_base (const struct hrtimer *timer,unsigned long *flags) __acquires(&timer->base->cpu_base->lock)
@@ -1370,6 +1360,18 @@ static void hrtimer_sync_wait_running(struct hrtimer_cpu_base *cpu_base, } } +#ifdef CONFIG_SMP +static __always_inline bool is_migration_base(struct hrtimer_clock_base *base) +{ +return base == &migration_base; +} +#else +static __always_inline bool is_migration_base(struct hrtimer_clock_base *base) +{ +return false; +} +#endif +/* * This function is called on PREEMPT_RT kernels when the fast path * deletion of a timer failed because the timer callback function was
Andy Shevchenko
Tested-byRe: [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
Quoted 14 lines · On Thu, Jan 23, 2025 at 07:13:18PM -0000, tip-bot2 for Andy Shevchenko wrote:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 27af31e44949fa85550176520ef7086a0d00fd7b Gitweb: https://git.kernel.org/tip/27af31e44949fa85550176520ef7086a0d00fd7b Author: Andy Shevchenko <[email protected]> AuthorDate: Thu, 16 Jan 2025 18:07:45 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Thu, 23 Jan 2025 20:06:35 +01:00hrtimers: Mark
is_migration_base()with__always_inlineWhen
is_migration_base()is unused, it prevents kernel builds with clang,make W=1andCONFIG_WERROR=y:
Quoted 8 lines
kernel/time/hrtimer.c:156:20: error: unused function 'is_migration_base' [-Werror,-Wunused-function]
156 | static inline boolis_migration_base(struct hrtimer_clock_base *base)| ^~~~~~~~~~~~~~~~~Fix this by marking it with
__always_inline.[ tglx: Use
__always_inlineinstead of__maybe_unusedand move it into the
usage sites conditional ]
This works, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko