public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] hrtimer: Mark is_migration_base() with __maybe_unused
@ 2025-01-16 16:07 Andy Shevchenko
  2025-01-23 10:57 ` [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline tip-bot2 for Andy Shevchenko
  2025-01-23 19:13 ` tip-bot2 for Andy Shevchenko
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-01-16 16:07 UTC (permalink / raw)
  To: Thomas Gleixner, linux-kernel, llvm
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Andy Shevchenko

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").

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kernel/time/hrtimer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 80fe3749d2db..0a2b90f99412 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -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;
 }
-- 
2.43.0.rc1.1336.g36b5255a03ac


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
  2025-01-16 16:07 [PATCH v1 1/1] hrtimer: Mark is_migration_base() with __maybe_unused Andy Shevchenko
@ 2025-01-23 10:57 ` tip-bot2 for Andy Shevchenko
  2025-01-23 14:39   ` Andy Shevchenko
  2025-01-23 19:13 ` tip-bot2 for Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: tip-bot2 for Andy Shevchenko @ 2025-01-23 10:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Andy Shevchenko, Thomas Gleixner, x86, linux-kernel

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 <andriy.shevchenko@linux.intel.com>
AuthorDate:    Thu, 16 Jan 2025 18:07:45 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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 ]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250116160745.243358-1-andriy.shevchenko@linux.intel.com

---
 kernel/time/hrtimer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index f6d8df9..14bd09c 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -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;
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
  2025-01-23 10:57 ` [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline tip-bot2 for Andy Shevchenko
@ 2025-01-23 14:39   ` Andy Shevchenko
  2025-01-23 19:02     ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-01-23 14:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-tip-commits, Thomas Gleixner, x86

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 <andriy.shevchenko@linux.intel.com>
> AuthorDate:    Thu, 16 Jan 2025 18:07:45 +02:00
> Committer:     Thomas Gleixner <tglx@linutronix.de>
> 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 ]

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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
  2025-01-23 14:39   ` Andy Shevchenko
@ 2025-01-23 19:02     ` Thomas Gleixner
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2025-01-23 19:02 UTC (permalink / raw)
  To: Andy Shevchenko, linux-kernel; +Cc: linux-tip-commits, x86

On Thu, Jan 23 2025 at 16:39, Andy Shevchenko wrote:
> 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 <andriy.shevchenko@linux.intel.com>
>> AuthorDate:    Thu, 16 Jan 2025 18:07:45 +02:00
>> Committer:     Thomas Gleixner <tglx@linutronix.de>
>> 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 ]
>
> 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.

This is insane. Let me undo that for heavens sake.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
  2025-01-16 16:07 [PATCH v1 1/1] hrtimer: Mark is_migration_base() with __maybe_unused Andy Shevchenko
  2025-01-23 10:57 ` [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline tip-bot2 for Andy Shevchenko
@ 2025-01-23 19:13 ` tip-bot2 for Andy Shevchenko
  2025-01-23 20:22   ` Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: tip-bot2 for Andy Shevchenko @ 2025-01-23 19:13 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Andy Shevchenko, Thomas Gleixner, x86, linux-kernel

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 <andriy.shevchenko@linux.intel.com>
AuthorDate:    Thu, 16 Jan 2025 18:07:45 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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 ]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250116160745.243358-1-andriy.shevchenko@linux.intel.com


---
 kernel/time/hrtimer.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index f6d8df9..4fb81f8 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline
  2025-01-23 19:13 ` tip-bot2 for Andy Shevchenko
@ 2025-01-23 20:22   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-01-23 20:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-tip-commits, Thomas Gleixner, x86

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 <andriy.shevchenko@linux.intel.com>
> AuthorDate:    Thu, 16 Jan 2025 18:07:45 +02:00
> Committer:     Thomas Gleixner <tglx@linutronix.de>
> 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 ]

This works, thanks!
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-23 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 16:07 [PATCH v1 1/1] hrtimer: Mark is_migration_base() with __maybe_unused Andy Shevchenko
2025-01-23 10:57 ` [tip: timers/urgent] hrtimers: Mark is_migration_base() with __always_inline tip-bot2 for Andy Shevchenko
2025-01-23 14:39   ` Andy Shevchenko
2025-01-23 19:02     ` Thomas Gleixner
2025-01-23 19:13 ` tip-bot2 for Andy Shevchenko
2025-01-23 20:22   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox