linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: vdso: Fix __arch_get_hw_counter()
@ 2019-10-16 13:40 Vincenzo Frascino
  2019-10-16 14:20 ` Maxime Bizon
  2019-10-18 22:13 ` Paul Burton
  0 siblings, 2 replies; 3+ messages in thread
From: Vincenzo Frascino @ 2019-10-16 13:40 UTC (permalink / raw)
  To: linux-mips; +Cc: pburton, mbizon, vincenzo.frascino

On some MIPS variants (e.g. MIPS r1), vDSO clock_mode is set to
VDSO_CLOCK_NONE.

When VDSO_CLOCK_NONE is set the expected kernel behavior is to fallback
on syscalls. To do that the generic vDSO library expects UULONG_MAX as
return value of __arch_get_hw_counter().

Fix __arch_get_hw_counter() on MIPS defining a __VDSO_USE_SYSCALL case
that addressed the described scenario.

Reported-by: Maxime Bizon <mbizon@freebox.fr>
Cc: Paul Burton <pburton@wavecomp.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/mips/include/asm/vdso/gettimeofday.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h
index e78462e8ca2e..b08825531e9f 100644
--- a/arch/mips/include/asm/vdso/gettimeofday.h
+++ b/arch/mips/include/asm/vdso/gettimeofday.h
@@ -24,6 +24,8 @@
 
 #define VDSO_HAS_CLOCK_GETRES		1
 
+#define __VDSO_USE_SYSCALL		ULLONG_MAX
+
 #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
 
 static __always_inline long gettimeofday_fallback(
@@ -205,7 +207,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode)
 		break;
 #endif
 	default:
-		cycle_now = 0;
+		cycle_now = __VDSO_USE_SYSCALL;
 		break;
 	}
 
-- 
2.23.0


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

* Re: [PATCH] mips: vdso: Fix __arch_get_hw_counter()
  2019-10-16 13:40 [PATCH] mips: vdso: Fix __arch_get_hw_counter() Vincenzo Frascino
@ 2019-10-16 14:20 ` Maxime Bizon
  2019-10-18 22:13 ` Paul Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Bizon @ 2019-10-16 14:20 UTC (permalink / raw)
  To: Vincenzo Frascino, linux-mips; +Cc: pburton


On Wed, 2019-10-16 at 14:40 +0100, Vincenzo Frascino wrote:

> On some MIPS variants (e.g. MIPS r1), vDSO clock_mode is set to
> VDSO_CLOCK_NONE.
> 
> When VDSO_CLOCK_NONE is set the expected kernel behavior is to
> fallback
> on syscalls. To do that the generic vDSO library expects UULONG_MAX
> as
> return value of __arch_get_hw_counter().
> 
> Fix __arch_get_hw_counter() on MIPS defining a __VDSO_USE_SYSCALL
> case
> that addressed the described scenario.
> 
> Reported-by: Maxime Bizon <mbizon@freebox.fr>
> Cc: Paul Burton <pburton@wavecomp.com>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Tested-by: Maxime Bizon <mbizon@freebox.fr>

Thanks,

-- 
Maxime




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

* Re: [PATCH] mips: vdso: Fix __arch_get_hw_counter()
  2019-10-16 13:40 [PATCH] mips: vdso: Fix __arch_get_hw_counter() Vincenzo Frascino
  2019-10-16 14:20 ` Maxime Bizon
@ 2019-10-18 22:13 ` Paul Burton
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Burton @ 2019-10-18 22:13 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-mips, pburton, mbizon, vincenzo.frascino, linux-mips

Hello,

Vincenzo Frascino wrote:
> On some MIPS variants (e.g. MIPS r1), vDSO clock_mode is set to
> VDSO_CLOCK_NONE.
> 
> When VDSO_CLOCK_NONE is set the expected kernel behavior is to fallback
> on syscalls. To do that the generic vDSO library expects UULONG_MAX as
> return value of __arch_get_hw_counter().
> 
> Fix __arch_get_hw_counter() on MIPS defining a __VDSO_USE_SYSCALL case
> that addressed the described scenario.

Applied to mips-fixes.

> commit 8a1bef4193e8
> https://git.kernel.org/mips/c/8a1bef4193e8
> 
> Reported-by: Maxime Bizon <mbizon@freebox.fr>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Tested-by: Maxime Bizon <mbizon@freebox.fr>
> Signed-off-by: Paul Burton <paulburton@kernel.org>

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paulburton@kernel.org to report it. ]

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

end of thread, other threads:[~2019-10-18 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 13:40 [PATCH] mips: vdso: Fix __arch_get_hw_counter() Vincenzo Frascino
2019-10-16 14:20 ` Maxime Bizon
2019-10-18 22:13 ` Paul Burton

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