lkml.org 
[lkml]   [2015]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value
On Wed, 16 Dec 2015 15:11:25 +0800
Jisheng Zhang wrote:

> Dear Daniel,
>
> On Tue, 15 Dec 2015 21:59:30 +0100 Daniel Lezcano wrote:
>
> > On 11/25/2015 04:42 PM, Jisheng Zhang wrote:
> > > Let's assume the counter value is 0xf000000, the pistachio clocksource

oops, sorry, should be 0xf0000000. Do I need to send a v2 patch?

> > > read cycles function would return 0xffffffff0fffffff, but it should
> > > return 0xfffffff.
> > >
> > > We fix this issue by calculating bitwise-not counter, then cast to
> > > cycle_t.
> > >
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> >
> > Hi Jisheng,
> >
> > I tried to reproduce this behavior on x86_64 but without success.
> >
> > On which architecture did you produce this result ? Do you have a simple
> > test program to check with ?
>
> I have no HW platforms with pistachio, just read the code and run the
> following test code in x86_64 and x86_32:
>
> #include <stdio.h>
> unsigned long long pistachio_clocksource_read_cycles()
> {
> unsigned int counter = 0xf000000;

should be unsigned int counter = 0xf0000000;

> return ~(unsigned long long)counter;
> }
> int main()
> {
> printf("%llx\n", pistachio_clocksource_read_cycles());
> return 0;
> }
>
> Thanks,
> Jisheng
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



\
 
 \ /
  Last update: 2015-12-16 08:41    [W:0.156 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site