mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] um: Use asm-generic/timex.h over the host architecture one
@ 2026-08-19  7:24 Thomas Weißschuh
  2026-08-21  8:22 ` David Gow
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Weißschuh @ 2026-08-19  7:24 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg,
	Christophe Leroy (CS GROUP),
	Thomas Gleixner
  Cc: linux-um, linux-kernel, Thomas Weißschuh

The removal of the architecture-specific asm/timex.h was meant to fall
back to asm-generic/timex.h. However on UML, the host architecture
headers are earlier on the include path and therefore asm/timex.h from
the host architecture is used.
On x86 that header in turn requires the generation of cpufeaturemasks.h,
which is not set up for UML and the build fails.

In file included from ../arch/x86/include/asm/tsc.h:9,
                 from ../arch/x86/include/asm/timex.h:6,
                 from ../include/linux/timex.h:67,
                 from ../include/linux/time32.h:13,
                 from ../include/linux/time.h:60,
                 from ../include/linux/jiffies.h:10,
                 from ../include/linux/ktime.h:25,
                 from ../include/linux/timer.h:6,
                 from ../include/linux/uprobes.h:18,
                 from ../include/linux/mm_types.h:16,
                 from ../include/linux/mmzone.h:22,
                 from ../include/linux/gfp.h:7,
                 from ../include/linux/slab.h:17,
                 from ../include/linux/crypto.h:18,
                 from ../arch/um/kernel/asm-offsets.c:6:
arch/x86/include/asm/tsc.h: In function ‘get_cycles’:
arch/um/include/asm/cpufeature.h:52:39: error: implicit declaration of function ‘DISABLED_MASK_BIT_SET’ [-Wimplicit-function-declaration]
   52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
      |                                       ^~~~~~~~~~~~~~~~~~~~~
arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
   79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
      |              ^~~~~~~~~~~~~~~~~~~
arch/um/include/asm/cpufeature.h:115:17: error: implicit declaration of function ‘_static_cpu_has’ [-Wimplicit-function-declaration]
  115 |                 _static_cpu_has(bit)                            \
      |                 ^~~~~~~~~~~~~~~
arch/um/include/asm/cpufeature.h:52:72: note: in expansion of macro ‘_static_cpu_has’
   52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
      |                                                                        ^~~~~~~~~~~~~~~
arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
   79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
      |              ^~~~~~~~~~~~~~~~~~~
arch/um/include/asm/cpufeature.h:115:17: note: ‘_static_cpu_has’ is a function-like macro and might be used incorrectly
arch/um/include/asm/cpufeature.h:52:72: note: in expansion of macro ‘_static_cpu_has’
   52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
      |                                                                        ^~~~~~~~~~~~~~~
arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
   79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
      |              ^~~~~~~~~~~~~~~~~~~

The x86-specific timex.h also doesn't make sense on UML in general.

Reintroduce the UML-specific asm/timex.h and add a comment to document
its necessity.

Fixes: 3ed403bbc967 ("treewide: Remove CLOCK_TICK_RATE")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 arch/um/include/asm/timex.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h
new file mode 100644
index 000000000000..dfb4f460fb87
--- /dev/null
+++ b/arch/um/include/asm/timex.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __UM_TIMEX_H
+#define __UM_TIMEX_H
+
+/* Do not fall back to the host architecture header. */
+#include <asm-generic/timex.h>
+
+#endif

---
base-commit: bd5f485f3f026225b86573e559af0b7254ef4184
change-id: 20260819-uml-timex-fix-fccb27f9ca51

Best regards,
--  
Thomas Weißschuh <thomas.weissschuh@linutronix.de>


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

* Re: [PATCH] um: Use asm-generic/timex.h over the host architecture one
  2026-08-19  7:24 [PATCH] um: Use asm-generic/timex.h over the host architecture one Thomas Weißschuh
@ 2026-08-21  8:22 ` David Gow
  2026-08-25  1:53 ` [tip: timers/urgent] " tip-bot2 for Thomas Weißschuh
  2026-08-30 15:52 ` [PATCH] " SJ Park
  2 siblings, 0 replies; 4+ messages in thread
From: David Gow @ 2026-08-21  8:22 UTC (permalink / raw)
  To: Thomas Weißschuh, Richard Weinberger, Anton Ivanov,
	Johannes Berg, Christophe Leroy (CS GROUP),
	Thomas Gleixner
  Cc: linux-um, linux-kernel

Le 19/08/2026 à 3:24 PM, Thomas Weißschuh a écrit :
> The removal of the architecture-specific asm/timex.h was meant to fall
> back to asm-generic/timex.h. However on UML, the host architecture
> headers are earlier on the include path and therefore asm/timex.h from
> the host architecture is used.
> On x86 that header in turn requires the generation of cpufeaturemasks.h,
> which is not set up for UML and the build fails.
> 
> In file included from ../arch/x86/include/asm/tsc.h:9,
>                  from ../arch/x86/include/asm/timex.h:6,
>                  from ../include/linux/timex.h:67,
>                  from ../include/linux/time32.h:13,
>                  from ../include/linux/time.h:60,
>                  from ../include/linux/jiffies.h:10,
>                  from ../include/linux/ktime.h:25,
>                  from ../include/linux/timer.h:6,
>                  from ../include/linux/uprobes.h:18,
>                  from ../include/linux/mm_types.h:16,
>                  from ../include/linux/mmzone.h:22,
>                  from ../include/linux/gfp.h:7,
>                  from ../include/linux/slab.h:17,
>                  from ../include/linux/crypto.h:18,
>                  from ../arch/um/kernel/asm-offsets.c:6:
> arch/x86/include/asm/tsc.h: In function ‘get_cycles’:
> arch/um/include/asm/cpufeature.h:52:39: error: implicit declaration of function ‘DISABLED_MASK_BIT_SET’ [-Wimplicit-function-declaration]
>    52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
>       |                                       ^~~~~~~~~~~~~~~~~~~~~
> arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
>    79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
>       |              ^~~~~~~~~~~~~~~~~~~
> arch/um/include/asm/cpufeature.h:115:17: error: implicit declaration of function ‘_static_cpu_has’ [-Wimplicit-function-declaration]
>   115 |                 _static_cpu_has(bit)                            \
>       |                 ^~~~~~~~~~~~~~~
> arch/um/include/asm/cpufeature.h:52:72: note: in expansion of macro ‘_static_cpu_has’
>    52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
>       |                                                                        ^~~~~~~~~~~~~~~
> arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
>    79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
>       |              ^~~~~~~~~~~~~~~~~~~
> arch/um/include/asm/cpufeature.h:115:17: note: ‘_static_cpu_has’ is a function-like macro and might be used incorrectly
> arch/um/include/asm/cpufeature.h:52:72: note: in expansion of macro ‘_static_cpu_has’
>    52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
>       |                                                                        ^~~~~~~~~~~~~~~
> arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
>    79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
>       |              ^~~~~~~~~~~~~~~~~~~
> 
> The x86-specific timex.h also doesn't make sense on UML in general.
> 
> Reintroduce the UML-specific asm/timex.h and add a comment to document
> its necessity.
> 
> Fixes: 3ed403bbc967 ("treewide: Remove CLOCK_TICK_RATE")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---

Thanks: I just hit this, and came up with the identical fix. Can confirm
it works again across both 32- and 64-bit UML.

Reviewed-by: David Gow <david@davidgow.net>

Cheers,
-- David

>  arch/um/include/asm/timex.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h
> new file mode 100644
> index 000000000000..dfb4f460fb87
> --- /dev/null
> +++ b/arch/um/include/asm/timex.h
> @@ -0,0 +1,8 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __UM_TIMEX_H
> +#define __UM_TIMEX_H
> +
> +/* Do not fall back to the host architecture header. */
> +#include <asm-generic/timex.h>
> +
> +#endif
> 
> ---
> base-commit: bd5f485f3f026225b86573e559af0b7254ef4184
> change-id: 20260819-uml-timex-fix-fccb27f9ca51
> 
> Best regards,
> --  
> Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> 
> 


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

* [tip: timers/urgent] um: Use asm-generic/timex.h over the host architecture one
  2026-08-19  7:24 [PATCH] um: Use asm-generic/timex.h over the host architecture one Thomas Weißschuh
  2026-08-21  8:22 ` David Gow
@ 2026-08-25  1:53 ` tip-bot2 for Thomas Weißschuh
  2026-08-30 15:52 ` [PATCH] " SJ Park
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Thomas Weißschuh @ 2026-08-25  1:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: thomas.weissschuh, Borislav Petkov (AMD), David Gow, x86, linux-kernel

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     64f74d8f728877858372c52067e5c0c091f8db24
Gitweb:        https://git.kernel.org/tip/64f74d8f728877858372c52067e5c0c091f8db24
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Wed, 19 Aug 2026 09:24:21 +02:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Mon, 24 Aug 2026 17:10:35 -07:00

um: Use asm-generic/timex.h over the host architecture one

The removal of the architecture-specific asm/timex.h was meant to fall back to
asm-generic/timex.h. However on UML, the host architecture headers are earlier
on the include path and therefore asm/timex.h from the host architecture is
used.

On x86 that header in turn requires the generation of cpufeaturemasks.h, which
is not set up for UML and the build fails.

  In file included from ../arch/x86/include/asm/tsc.h:9,
                   from ../arch/x86/include/asm/timex.h:6,
                   from ../include/linux/timex.h:67,
                   from ../include/linux/time32.h:13,
                   from ../include/linux/time.h:60,
                   from ../include/linux/jiffies.h:10,
                   from ../include/linux/ktime.h:25,
                   from ../include/linux/timer.h:6,
                   from ../include/linux/uprobes.h:18,
                   from ../include/linux/mm_types.h:16,
                   from ../include/linux/mmzone.h:22,
                   from ../include/linux/gfp.h:7,
                   from ../include/linux/slab.h:17,
                   from ../include/linux/crypto.h:18,
                   from ../arch/um/kernel/asm-offsets.c:6:
  arch/x86/include/asm/tsc.h: In function ‘get_cycles’:
  arch/um/include/asm/cpufeature.h:52:39: error: implicit declaration of function ‘DISABLED_MASK_BIT_SET’ [-Wimplicit-function-declaration]
     52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
        |                                       ^~~~~~~~~~~~~~~~~~~~~
  arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
     79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
        |              ^~~~~~~~~~~~~~~~~~~
  arch/um/include/asm/cpufeature.h:115:17: error: implicit declaration of function ‘_static_cpu_has’ [-Wimplicit-function-declaration]
    115 |                 _static_cpu_has(bit)                            \
        |                 ^~~~~~~~~~~~~~~
  ...

The x86-specific timex.h also doesn't make sense on UML in general.

Reintroduce the UML-specific asm/timex.h and add a comment to document
its necessity.

  [ bp: Improve that comment to actually state why stuff is there. ]

Fixes: 3ed403bbc967 ("treewide: Remove CLOCK_TICK_RATE")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: David Gow <david@davidgow.net>
Link: https://patch.msgid.link/20260819-uml-timex-fix-v1-1-f690b514fc9f@linutronix.de
---
 arch/um/include/asm/timex.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 arch/um/include/asm/timex.h

diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h
new file mode 100644
index 0000000..39e392e
--- /dev/null
+++ b/arch/um/include/asm/timex.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __UM_TIMEX_H
+#define __UM_TIMEX_H
+
+/*
+ * Do not fall back to the host architecture header because latter likely
+ * includes facilities like cpu_feature_enabled() which are present only
+ * there. That would result in build breakages and/or efforts to "emulate"
+ * those facilities in UML.
+ */
+#include <asm-generic/timex.h>
+
+#endif

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

* Re: [PATCH] um: Use asm-generic/timex.h over the host architecture one
  2026-08-19  7:24 [PATCH] um: Use asm-generic/timex.h over the host architecture one Thomas Weißschuh
  2026-08-21  8:22 ` David Gow
  2026-08-25  1:53 ` [tip: timers/urgent] " tip-bot2 for Thomas Weißschuh
@ 2026-08-30 15:52 ` SJ Park
  2 siblings, 0 replies; 4+ messages in thread
From: SJ Park @ 2026-08-30 15:52 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: SJ Park, Richard Weinberger, Anton Ivanov, Johannes Berg,
	Christophe Leroy (CS GROUP),
	Thomas Gleixner, linux-um, linux-kernel

On Wed, 19 Aug 2026 09:24:21 +0200 Thomas Weißschuh <thomas.weissschuh@linutronix.de> wrote:

> The removal of the architecture-specific asm/timex.h was meant to fall
> back to asm-generic/timex.h. However on UML, the host architecture
> headers are earlier on the include path and therefore asm/timex.h from
> the host architecture is used.
> On x86 that header in turn requires the generation of cpufeaturemasks.h,
> which is not set up for UML and the build fails.
> 
> In file included from ../arch/x86/include/asm/tsc.h:9,
>                  from ../arch/x86/include/asm/timex.h:6,
>                  from ../include/linux/timex.h:67,
>                  from ../include/linux/time32.h:13,
>                  from ../include/linux/time.h:60,
>                  from ../include/linux/jiffies.h:10,
>                  from ../include/linux/ktime.h:25,
>                  from ../include/linux/timer.h:6,
>                  from ../include/linux/uprobes.h:18,
>                  from ../include/linux/mm_types.h:16,
>                  from ../include/linux/mmzone.h:22,
>                  from ../include/linux/gfp.h:7,
>                  from ../include/linux/slab.h:17,
>                  from ../include/linux/crypto.h:18,
>                  from ../arch/um/kernel/asm-offsets.c:6:
> arch/x86/include/asm/tsc.h: In function ‘get_cycles’:
> arch/um/include/asm/cpufeature.h:52:39: error: implicit declaration of function ‘DISABLED_MASK_BIT_SET’ [-Wimplicit-function-declaration]
>    52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
>       |                                       ^~~~~~~~~~~~~~~~~~~~~
> arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
>    79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
>       |              ^~~~~~~~~~~~~~~~~~~
> arch/um/include/asm/cpufeature.h:115:17: error: implicit declaration of function ‘_static_cpu_has’ [-Wimplicit-function-declaration]
>   115 |                 _static_cpu_has(bit)                            \
>       |                 ^~~~~~~~~~~~~~~
> arch/um/include/asm/cpufeature.h:52:72: note: in expansion of macro ‘_static_cpu_has’
>    52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
>       |                                                                        ^~~~~~~~~~~~~~~
> arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
>    79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
>       |              ^~~~~~~~~~~~~~~~~~~
> arch/um/include/asm/cpufeature.h:115:17: note: ‘_static_cpu_has’ is a function-like macro and might be used incorrectly
> arch/um/include/asm/cpufeature.h:52:72: note: in expansion of macro ‘_static_cpu_has’
>    52 |         (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit))
>       |                                                                        ^~~~~~~~~~~~~~~
> arch/x86/include/asm/tsc.h:79:14: note: in expansion of macro ‘cpu_feature_enabled’
>    79 |         if (!cpu_feature_enabled(X86_FEATURE_TSC))
>       |              ^~~~~~~~~~~~~~~~~~~
> 
> The x86-specific timex.h also doesn't make sense on UML in general.
> 
> Reintroduce the UML-specific asm/timex.h and add a comment to document
> its necessity.

I got the same issue, and confirmed this patch fixes it on my setup.  Thank you
for sharing this patch.

> 
> Fixes: 3ed403bbc967 ("treewide: Remove CLOCK_TICK_RATE")
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

Tested-by: SJ Park <sj@kernel.org>


Thanks,
SJ

[...]

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

end of thread, other threads:[~2026-08-30 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-19  7:24 [PATCH] um: Use asm-generic/timex.h over the host architecture one Thomas Weißschuh
2026-08-21  8:22 ` David Gow
2026-08-25  1:53 ` [tip: timers/urgent] " tip-bot2 for Thomas Weißschuh
2026-08-30 15:52 ` [PATCH] " SJ Park

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

all inboxes | Powered by JetHome®