All of lore.kernel.org
 help / color / mirror / Atom feed
From: jszhang@marvell.com (Jisheng Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value
Date: Wed, 16 Dec 2015 15:28:07 +0800	[thread overview]
Message-ID: <20151216152807.23491eee@xhacker> (raw)
In-Reply-To: <20151216151125.1e91b4f4@xhacker>

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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Jisheng Zhang <jszhang@marvell.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: <tglx@linutronix.de>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value
Date: Wed, 16 Dec 2015 15:28:07 +0800	[thread overview]
Message-ID: <20151216152807.23491eee@xhacker> (raw)
In-Reply-To: <20151216151125.1e91b4f4@xhacker>

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


  reply	other threads:[~2015-12-16  7:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 15:42 [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value Jisheng Zhang
2015-11-25 15:42 ` Jisheng Zhang
2015-12-15 20:59 ` Daniel Lezcano
2015-12-15 20:59   ` Daniel Lezcano
2015-12-16  7:11   ` Jisheng Zhang
2015-12-16  7:11     ` Jisheng Zhang
2015-12-16  7:28     ` Jisheng Zhang [this message]
2015-12-16  7:28       ` Jisheng Zhang
2015-12-16  7:36       ` Jisheng Zhang
2015-12-16  7:36         ` Jisheng Zhang
2015-12-16  7:49         ` Jisheng Zhang
2015-12-16  7:49           ` Jisheng Zhang
2015-12-16  9:21         ` Daniel Lezcano
2015-12-16  9:21           ` Daniel Lezcano
2015-12-16  9:33           ` Russell King - ARM Linux
2015-12-16  9:33             ` Russell King - ARM Linux
2015-12-16 10:32             ` Daniel Lezcano
2015-12-16 10:32               ` Daniel Lezcano
2015-12-16 10:38               ` Russell King - ARM Linux
2015-12-16 10:38                 ` Russell King - ARM Linux
2015-12-16 16:23                 ` Daniel Lezcano
2015-12-16 16:23                   ` Daniel Lezcano
2015-12-17  9:07                 ` Jisheng Zhang
2015-12-17  9:07                   ` Jisheng Zhang
2015-12-16  9:01       ` Daniel Lezcano
2015-12-16  9:01         ` Daniel Lezcano
2015-12-16  9:02     ` Daniel Lezcano
2015-12-16  9:02       ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151216152807.23491eee@xhacker \
    --to=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.