Re: [PATCH] clocksource: Fix arm_arch_timer clockmode when vDSO disabled

From: Vincenzo Frascino
Date: Fri Feb 21 2020 - 10:56:16 EST


Hi Marc,

On 21/02/2020 15:28, Marc Zyngier wrote:

[...]

>
> This isn't what I'm saying. What I'm suggesting here is that there is
> possibly a missing indirection, which defaults to ARCH_TIMER when the
> VDSO is selected, and NONE when it isn't.
>
> Overloading a known symbol feels like papering over the issue.
>
> Ideally, this default symbol would be provided by asm/clocksource.h, but
> that may not even be the right thing to do.
>

I must admit I really like this idea :), how about:

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 03bbfc312fe7..97864aabc2a6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,6 +3,7 @@ config ARM
bool
default y
select ARCH_32BIT_OFF_T
+ select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_BINFMT_FLAT
select ARCH_HAS_DEBUG_VIRTUAL if MMU
select ARCH_HAS_DEVMEM_IS_ALLOWED
diff --git a/arch/arm/include/asm/clocksource.h b/arch/arm/include/asm/clocksource.h
index 73beb7f131de..e37f6d74ba49 100644
--- a/arch/arm/include/asm/clocksource.h
+++ b/arch/arm/include/asm/clocksource.h
@@ -1,7 +1,18 @@
#ifndef _ASM_CLOCKSOURCE_H
#define _ASM_CLOCKSOURCE_H

+/*
+ * Unused required for compilation only
+ */
+struct arch_clocksource_data {
+ bool __reserved;
+};
+
+#ifdef CONFIG_GENERIC_GETTIMEOFDAY
#define VDSO_ARCH_CLOCKMODES \
VDSO_CLOCKMODE_ARCHTIMER
+#else
+#define VDSO_CLOCKMODE_ARCHTIMER VDSO_CLOCKMODE_NONE
+#endif

#endif


[...]

>
> Fair enough. But don't override the symbol locally. Create a new one:
>

I see what you mean now, you mean to not overload the semantical meaning of the
symbol. The symbol (VDSO_CLOCKMODE_ARCHTIMER) at this point is never defined
when VDSO=n, but I agree with you it can cause confusion.

--
Regards,
Vincenzo

Attachment: pEpkey.asc
Description: application/pgp-keys