LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [ppc] Disparity between sys_clock_getres and vdso implementation
@ 2008-01-27 14:02 Sripathi Kodi
  2008-02-04  6:08 ` Tony Breeds
  2008-02-05  5:16 ` [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso Tony Breeds
  0 siblings, 2 replies; 4+ messages in thread
From: Sripathi Kodi @ 2008-01-27 14:02 UTC (permalink / raw)
  To: paulus; +Cc: linux-kernel, linuxppc-dev, john stultz

Hi Paul,

On PPC, I see a disparity between clock_getres implementations in the
vdso and syscall. I am using a IBM Openpower hardware and 2.6.24 kernel
with CONFIG_HIGH_RES_TIMERS=y. 

clock_getres call for CLOCK_REALTIME returns 1 millisecond. However,
when I edit arch/powerpc/kernel/vdso*/gettimeofday.S to force it to use 
sys_clock_getres, I get 1 nanosecond resolution. The code in vdso seems
to be returning some pre-defined (incorrect) variables.

Could you please let me know the reason for this? Is it something that
should be fixed in vdso?

Thanks,
Sripathi.

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

* Re: [ppc] Disparity between sys_clock_getres and vdso implementation
  2008-01-27 14:02 [ppc] Disparity between sys_clock_getres and vdso implementation Sripathi Kodi
@ 2008-02-04  6:08 ` Tony Breeds
  2008-02-05  5:16 ` [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso Tony Breeds
  1 sibling, 0 replies; 4+ messages in thread
From: Tony Breeds @ 2008-02-04  6:08 UTC (permalink / raw)
  To: Sripathi Kodi; +Cc: paulus, linux-kernel, linuxppc-dev, john stultz

On Sun, Jan 27, 2008 at 07:32:59PM +0530, Sripathi Kodi wrote:
> Hi Paul,
> 
> On PPC, I see a disparity between clock_getres implementations in the
> vdso and syscall. I am using a IBM Openpower hardware and 2.6.24 kernel
> with CONFIG_HIGH_RES_TIMERS=y. 
> 
> clock_getres call for CLOCK_REALTIME returns 1 millisecond. However,
> when I edit arch/powerpc/kernel/vdso*/gettimeofday.S to force it to use 
> sys_clock_getres, I get 1 nanosecond resolution. The code in vdso seems
> to be returning some pre-defined (incorrect) variables.
> 
> Could you please let me know the reason for this? Is it something that
> should be fixed in vdso?

Almost certainly It's something I missed when I enabled highres timers
on powerpc.

I'll fix this tomorrow.

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!


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

* [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso.
  2008-01-27 14:02 [ppc] Disparity between sys_clock_getres and vdso implementation Sripathi Kodi
  2008-02-04  6:08 ` Tony Breeds
@ 2008-02-05  5:16 ` Tony Breeds
  2008-02-05  9:07   ` Chirag Jog
  1 sibling, 1 reply; 4+ messages in thread
From: Tony Breeds @ 2008-02-05  5:16 UTC (permalink / raw)
  To: Sripathi Kodi; +Cc: paulus, linux-kernel, linuxppc-dev, john stultz

On Sun, Jan 27, 2008 at 07:32:59PM +0530, Sripathi Kodi wrote:
> Hi Paul,
> 
> On PPC, I see a disparity between clock_getres implementations in the
> vdso and syscall. I am using a IBM Openpower hardware and 2.6.24 kernel
> with CONFIG_HIGH_RES_TIMERS=y. 
> 
> clock_getres call for CLOCK_REALTIME returns 1 millisecond. However,
> when I edit arch/powerpc/kernel/vdso*/gettimeofday.S to force it to use 
> sys_clock_getres, I get 1 nanosecond resolution. The code in vdso seems
> to be returning some pre-defined (incorrect) variables.
> 
> Could you please let me know the reason for this? Is it something that
> should be fixed in vdso?

Can you try the attached patch and see it if works for you?

From: Tony Breeds <tony@bakeyournoodle.com>
Subject: [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso.

This ensures that the syscall and the (fast) vdso versions of clock_getres()
will return the same resolution.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
---
 arch/powerpc/kernel/asm-offsets.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index ed083fe..e6e4928 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -22,6 +22,7 @@
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/suspend.h>
+#include <linux/hrtimer.h>
 #ifdef CONFIG_PPC64
 #include <linux/time.h>
 #include <linux/hardirq.h>
@@ -312,7 +313,7 @@ int main(void)
 	DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
 	DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
 	DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
-	DEFINE(CLOCK_REALTIME_RES, TICK_NSEC);
+	DEFINE(CLOCK_REALTIME_RES, (KTIME_MONOTONIC_RES).tv64);
 
 #ifdef CONFIG_BUG
 	DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
-- 
1.5.4


Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!


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

* Re: [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso.
  2008-02-05  5:16 ` [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso Tony Breeds
@ 2008-02-05  9:07   ` Chirag Jog
  0 siblings, 0 replies; 4+ messages in thread
From: Chirag Jog @ 2008-02-05  9:07 UTC (permalink / raw)
  To: Tony Breeds
  Cc: Sripathi Kodi, paulus, linux-kernel, linuxppc-dev, john stultz

* Tony Breeds <tony@bakeyournoodle.com> [2008-02-05 16:16:48]:

> On Sun, Jan 27, 2008 at 07:32:59PM +0530, Sripathi Kodi wrote:
> > Hi Paul,
> > 
> > On PPC, I see a disparity between clock_getres implementations in the
> > vdso and syscall. I am using a IBM Openpower hardware and 2.6.24 kernel
> > with CONFIG_HIGH_RES_TIMERS=y. 
> > 
> > clock_getres call for CLOCK_REALTIME returns 1 millisecond. However,
> > when I edit arch/powerpc/kernel/vdso*/gettimeofday.S to force it to use 
> > sys_clock_getres, I get 1 nanosecond resolution. The code in vdso seems
> > to be returning some pre-defined (incorrect) variables.
> > 
> > Could you please let me know the reason for this? Is it something that
> > should be fixed in vdso?
> 
> Can you try the attached patch and see it if works for you?
I tried this patch.
It seems to solve the reported problem and give a 1ns resolution.
Thanks.
 

-- 
Cheers,
Chirag Jog


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

end of thread, other threads:[~2008-02-05  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-27 14:02 [ppc] Disparity between sys_clock_getres and vdso implementation Sripathi Kodi
2008-02-04  6:08 ` Tony Breeds
2008-02-05  5:16 ` [PATCH] [POWERPC] Use a sensible default for clock_getres() in the vdso Tony Breeds
2008-02-05  9:07   ` Chirag Jog

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