linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled
@ 2020-02-21 18:18 Vincenzo Frascino
  2020-02-21 18:18 ` [PATCH v2 1/3] arm: clocksource: Add VDSO default clockmode Vincenzo Frascino
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-21 18:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel
  Cc: catalin.marinas, will.deacon, linux, tglx, luto, m.szyprowski,
	Mark.Rutland, maz, vincenzo.frascino

The arm_arch_timer requires that VDSO_CLOCKMODE_ARCHTIMER to be
defined to compile correctly. On arm the vDSO can be disabled and when
this is the case the compilation ends prematurely with an error:

 $ make ARCH=arm multi_v7_defconfig
 $ ./scripts/config -d VDSO
 $ make

 drivers/clocksource/arm_arch_timer.c:73:44: error:
 ‘VDSO_CLOCKMODE_ARCHTIMER’ undeclared here (not in a function)
 static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
                                            ^
 scripts/Makefile.build:267: recipe for target
 'drivers/clocksource/arm_arch_timer.o' failed
 make[2]: *** [drivers/clocksource/arm_arch_timer.o] Error 1
 make[2]: *** Waiting for unfinished jobs....
 scripts/Makefile.build:505: recipe for target 'drivers/clocksource' failed
 make[1]: *** [drivers/clocksource] Error 2
 make[1]: *** Waiting for unfinished jobs....
 Makefile:1683: recipe for target 'drivers' failed
 make: *** [drivers] Error 2

This patch series addresses the issue defining a default arch clockmode
for arm and arm64 and using it to initialize the arm_arch_timer.

Changes:
--------
v2:
  - Addressed Marc Zyngier comments.
  - Rebased on 5.6-rc2.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Rutland <Mark.Rutland@arm.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Vincenzo Frascino (3):
  arm: clocksource: Add VDSO default clockmode
  arm64: clocksource: Add VDSO default clockmode
  clocksource: Fix arm_arch_timer clockmode when vDSO disabled

 arch/arm/Kconfig                     |  1 +
 arch/arm/include/asm/clocksource.h   | 10 ++++++++++
 arch/arm64/include/asm/clocksource.h |  1 +
 drivers/clocksource/arm_arch_timer.c |  2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.25.0


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

* [PATCH v2 1/3] arm: clocksource: Add VDSO default clockmode
  2020-02-21 18:18 [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
@ 2020-02-21 18:18 ` Vincenzo Frascino
  2020-02-21 18:18 ` [PATCH v2 2/3] arm64: " Vincenzo Frascino
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-21 18:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel
  Cc: catalin.marinas, will.deacon, linux, tglx, luto, m.szyprowski,
	Mark.Rutland, maz, vincenzo.frascino

The arm_arch_timer requires that VDSO_CLOCKMODE_ARCHTIMER to be
defined to compile correctly. On arm the vDSO can be disabled and when
this is the case the compilation ends prematurely with an error.

Define VDSO_CLOCKMODE_ARCH_DEFAULT to represent the default vDSO
clockmode for arm_arch_timer.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm/Kconfig                   |  1 +
 arch/arm/include/asm/clocksource.h | 10 ++++++++++
 2 files changed, 11 insertions(+)

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..3f7812d5764f 100644
--- a/arch/arm/include/asm/clocksource.h
+++ b/arch/arm/include/asm/clocksource.h
@@ -1,7 +1,17 @@
 #ifndef _ASM_CLOCKSOURCE_H
 #define _ASM_CLOCKSOURCE_H
 
+struct arch_clocksource_data {
+	/* Empty on purpose */
+};
+
+#ifdef CONFIG_GENERIC_GETTIMEOFDAY
 #define VDSO_ARCH_CLOCKMODES	\
 	VDSO_CLOCKMODE_ARCHTIMER
+#define VDSO_CLOCKMODE_ARCH_DEFAULT	VDSO_CLOCKMODE_ARCHTIMER
+#else
+/* The define below is required because on arm the VDSOs can be disabled */
+#define VDSO_CLOCKMODE_ARCH_DEFAULT	VDSO_CLOCKMODE_NONE
+#endif
 
 #endif
-- 
2.25.0


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

* [PATCH v2 2/3] arm64: clocksource: Add VDSO default clockmode
  2020-02-21 18:18 [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
  2020-02-21 18:18 ` [PATCH v2 1/3] arm: clocksource: Add VDSO default clockmode Vincenzo Frascino
@ 2020-02-21 18:18 ` Vincenzo Frascino
  2020-02-21 18:18 ` [PATCH v2 3/3] clocksource: Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
  2020-02-22 10:40 ` [PATCH v2 0/3] " Marc Zyngier
  3 siblings, 0 replies; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-21 18:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel
  Cc: catalin.marinas, will.deacon, linux, tglx, luto, m.szyprowski,
	Mark.Rutland, maz, vincenzo.frascino

Define VDSO_CLOCKMODE_ARCH_DEFAULT to represent the default vDSO
clockmode for arm_arch_timer.

The change to arm_arch_timer will be in the next patch of this
series.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/clocksource.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/include/asm/clocksource.h b/arch/arm64/include/asm/clocksource.h
index eb82e9d95c5d..36a2cca213ae 100644
--- a/arch/arm64/include/asm/clocksource.h
+++ b/arch/arm64/include/asm/clocksource.h
@@ -4,5 +4,6 @@
 
 #define VDSO_ARCH_CLOCKMODES	\
 	VDSO_CLOCKMODE_ARCHTIMER
+#define VDSO_CLOCKMODE_ARCH_DEFAULT	VDSO_CLOCKMODE_ARCHTIMER
 
 #endif
-- 
2.25.0


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

* [PATCH v2 3/3] clocksource: Fix arm_arch_timer clockmode when vDSO disabled
  2020-02-21 18:18 [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
  2020-02-21 18:18 ` [PATCH v2 1/3] arm: clocksource: Add VDSO default clockmode Vincenzo Frascino
  2020-02-21 18:18 ` [PATCH v2 2/3] arm64: " Vincenzo Frascino
@ 2020-02-21 18:18 ` Vincenzo Frascino
  2020-02-22 10:40 ` [PATCH v2 0/3] " Marc Zyngier
  3 siblings, 0 replies; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-21 18:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel
  Cc: catalin.marinas, will.deacon, linux, tglx, luto, m.szyprowski,
	Mark.Rutland, maz, vincenzo.frascino

The arm_arch_timer requires that VDSO_CLOCKMODE_ARCHTIMER to be
defined to compile correctly. On arm the vDSO can be disabled and when
this is the case the compilation ends prematurely with an error:

 $ make ARCH=arm multi_v7_defconfig
 $ ./scripts/config -d VDSO
 $ make

drivers/clocksource/arm_arch_timer.c:73:44: error:
‘VDSO_CLOCKMODE_ARCHTIMER’ undeclared here (not in a function)
  static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
                                             ^
scripts/Makefile.build:267: recipe for target
'drivers/clocksource/arm_arch_timer.o' failed
make[2]: *** [drivers/clocksource/arm_arch_timer.o] Error 1
make[2]: *** Waiting for unfinished jobs....
scripts/Makefile.build:505: recipe for target 'drivers/clocksource' failed
make[1]: *** [drivers/clocksource] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:1683: recipe for target 'drivers' failed
make: *** [drivers] Error 2

Set vdso_default to VDSO_CLOCKMODE_ARCH_DEFAULT to address the issue.

Fixes: 5e3c6a312a09 ("ARM/arm64: vdso: Use common vdso clock mode storage")
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Rutland <Mark.Rutland@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 drivers/clocksource/arm_arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index ee2420d56f67..eadc99973fe1 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -69,7 +69,7 @@ static enum arch_timer_ppi_nr arch_timer_uses_ppi = ARCH_TIMER_VIRT_PPI;
 static bool arch_timer_c3stop;
 static bool arch_timer_mem_use_virtual;
 static bool arch_counter_suspend_stop;
-static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
+static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCH_DEFAULT;
 
 static cpumask_t evtstrm_available = CPU_MASK_NONE;
 static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
-- 
2.25.0


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

* Re: [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled
  2020-02-21 18:18 [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
                   ` (2 preceding siblings ...)
  2020-02-21 18:18 ` [PATCH v2 3/3] clocksource: Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
@ 2020-02-22 10:40 ` Marc Zyngier
  2020-02-24  9:12   ` Thomas Gleixner
  3 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2020-02-22 10:40 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, linux-kernel, catalin.marinas,
	will.deacon, linux, tglx, luto, m.szyprowski, Mark.Rutland

On Fri, 21 Feb 2020 18:18:46 +0000
Vincenzo Frascino <vincenzo.frascino@arm.com> wrote:

> The arm_arch_timer requires that VDSO_CLOCKMODE_ARCHTIMER to be
> defined to compile correctly. On arm the vDSO can be disabled and when
> this is the case the compilation ends prematurely with an error:
> 
>  $ make ARCH=arm multi_v7_defconfig
>  $ ./scripts/config -d VDSO
>  $ make
> 
>  drivers/clocksource/arm_arch_timer.c:73:44: error:
>  ‘VDSO_CLOCKMODE_ARCHTIMER’ undeclared here (not in a function)
>  static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
>                                             ^
>  scripts/Makefile.build:267: recipe for target
>  'drivers/clocksource/arm_arch_timer.o' failed
>  make[2]: *** [drivers/clocksource/arm_arch_timer.o] Error 1
>  make[2]: *** Waiting for unfinished jobs....
>  scripts/Makefile.build:505: recipe for target 'drivers/clocksource' failed
>  make[1]: *** [drivers/clocksource] Error 2
>  make[1]: *** Waiting for unfinished jobs....
>  Makefile:1683: recipe for target 'drivers' failed
>  make: *** [drivers] Error 2
> 
> This patch series addresses the issue defining a default arch clockmode
> for arm and arm64 and using it to initialize the arm_arch_timer.

arm only. arm64 is just fine.

> 
> Changes:
> --------
> v2:
>   - Addressed Marc Zyngier comments.
>   - Rebased on 5.6-rc2.

This doesn't apply to -rc2, and is rather against next.

> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Mark Rutland <Mark.Rutland@arm.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> 
> Vincenzo Frascino (3):
>   arm: clocksource: Add VDSO default clockmode
>   arm64: clocksource: Add VDSO default clockmode
>   clocksource: Fix arm_arch_timer clockmode when vDSO disabled

Please squash the three patches into a single one. There is zero point
in having 3 patches for something that small.

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled
  2020-02-22 10:40 ` [PATCH v2 0/3] " Marc Zyngier
@ 2020-02-24  9:12   ` Thomas Gleixner
  2020-02-24 10:12     ` Vincenzo Frascino
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2020-02-24  9:12 UTC (permalink / raw)
  To: Marc Zyngier, Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, linux-kernel, catalin.marinas,
	will.deacon, linux, luto, m.szyprowski, Mark.Rutland

Marc Zyngier <maz@kernel.org> writes:
> On Fri, 21 Feb 2020 18:18:46 +0000
> Vincenzo Frascino <vincenzo.frascino@arm.com> wrote:
>> 
>> This patch series addresses the issue defining a default arch clockmode
>> for arm and arm64 and using it to initialize the arm_arch_timer.
>
> arm only. arm64 is just fine.

Right. ARM64 unconditionaly enables VDSO

>
> This doesn't apply to -rc2, and is rather against next.

More precise it's against tip timers/core which has the VDSO changes
which caused this fallout.

>> Vincenzo Frascino (3):
>>   arm: clocksource: Add VDSO default clockmode
>>   arm64: clocksource: Add VDSO default clockmode
>>   clocksource: Fix arm_arch_timer clockmode when vDSO disabled
>
> Please squash the three patches into a single one. There is zero point
> in having 3 patches for something that small.

I really don't see why we need all this redefine foo. What's wrong with
the obvious?

--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -69,7 +69,12 @@ static enum arch_timer_ppi_nr arch_timer
 static bool arch_timer_c3stop;
 static bool arch_timer_mem_use_virtual;
 static bool arch_counter_suspend_stop;
+
+#ifdef CONFIG_GENERIC_GETTIMEOFDAY
 static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
+#else
+static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
+#endif
 
 static cpumask_t evtstrm_available = CPU_MASK_NONE;
 static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);

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

* Re: [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled
  2020-02-24  9:12   ` Thomas Gleixner
@ 2020-02-24 10:12     ` Vincenzo Frascino
  0 siblings, 0 replies; 7+ messages in thread
From: Vincenzo Frascino @ 2020-02-24 10:12 UTC (permalink / raw)
  To: Thomas Gleixner, Marc Zyngier
  Cc: linux-arch, linux-arm-kernel, linux-kernel, catalin.marinas,
	will.deacon, linux, luto, m.szyprowski, Mark.Rutland

On 2/24/20 9:12 AM, Thomas Gleixner wrote:
> Marc Zyngier <maz@kernel.org> writes:
>> On Fri, 21 Feb 2020 18:18:46 +0000
>> Vincenzo Frascino <vincenzo.frascino@arm.com> wrote:
>>>
>>> This patch series addresses the issue defining a default arch clockmode
>>> for arm and arm64 and using it to initialize the arm_arch_timer.
>>
>> arm only. arm64 is just fine.
> 
> Right. ARM64 unconditionaly enables VDSO
> 
>>
>> This doesn't apply to -rc2, and is rather against next.
> 
> More precise it's against tip timers/core which has the VDSO changes
> which caused this fallout.
>

Agree, I will fix it in the next iteration.

>>> Vincenzo Frascino (3):
>>>   arm: clocksource: Add VDSO default clockmode
>>>   arm64: clocksource: Add VDSO default clockmode
>>>   clocksource: Fix arm_arch_timer clockmode when vDSO disabled
>>
>> Please squash the three patches into a single one. There is zero point
>> in having 3 patches for something that small.
> 
> I really don't see why we need all this redefine foo. What's wrong with
> the obvious?
> 
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -69,7 +69,12 @@ static enum arch_timer_ppi_nr arch_timer
>  static bool arch_timer_c3stop;
>  static bool arch_timer_mem_use_virtual;
>  static bool arch_counter_suspend_stop;
> +
> +#ifdef CONFIG_GENERIC_GETTIMEOFDAY
>  static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
> +#else
> +static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
> +#endif
>  
>  static cpumask_t evtstrm_available = CPU_MASK_NONE;
>  static bool evtstrm_enable = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
> 

Nothing, I agree :) I think we over engineered here a bit.

-- 
Regards,
Vincenzo

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

end of thread, other threads:[~2020-02-24 10:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 18:18 [PATCH v2 0/3] Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
2020-02-21 18:18 ` [PATCH v2 1/3] arm: clocksource: Add VDSO default clockmode Vincenzo Frascino
2020-02-21 18:18 ` [PATCH v2 2/3] arm64: " Vincenzo Frascino
2020-02-21 18:18 ` [PATCH v2 3/3] clocksource: Fix arm_arch_timer clockmode when vDSO disabled Vincenzo Frascino
2020-02-22 10:40 ` [PATCH v2 0/3] " Marc Zyngier
2020-02-24  9:12   ` Thomas Gleixner
2020-02-24 10:12     ` Vincenzo Frascino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).