Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
Date: Fri, 6 Mar 2015 13:52:23 -0800	[thread overview]
Message-ID: <54FA2197.2000005@imgtec.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1503061228410.15786@eddie.linux-mips.org>

Thank you Maciej for the review!


On 03/06/2015 04:47 AM, Maciej W. Rozycki wrote:
> On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
>
>> Use sb1250 hpt for sched_clock source. This implementation will give high
>> resolution cputime accounting.
>>
>> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
>> ---
>>   arch/mips/kernel/csrc-sb1250.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
>> index df84836..6546fff 100644
>> --- a/arch/mips/kernel/csrc-sb1250.c
>> +++ b/arch/mips/kernel/csrc-sb1250.c
>> @@ -12,6 +12,7 @@
>>    * GNU General Public License for more details.
>>    */
>>   #include <linux/clocksource.h>
>> +#include <linux/sched_clock.h>
>>   
>>   #include <asm/addrspace.h>
>>   #include <asm/io.h>
>> @@ -46,6 +47,11 @@ struct clocksource bcm1250_clocksource = {
>>   	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
>>   };
>>   
>> +static u64 notrace sb1250_read_sched_clock(void)
>> +{
>> +	return sb1250_hpt_read(NULL);
>> +}
>> +
>   I think you're abusing the API of `sb1250_hpt_read' here, by relying on
> the implementation not using its `cs' argument.
>
>   I think it would make sense to reverse the implementation, by calling
> `sb1250_read_sched_clock' from `sb1250_hpt_read' instead.  Or perhaps
> better yet use a static inline helper for both, so as to avoid the extra
> tail call and the associated performance hit.
>
>    Maciej

Good point. Will do in v2.


Deng-Cheng

WARNING: multiple messages have this Message-ID (diff)
From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
Date: Fri, 6 Mar 2015 13:52:23 -0800	[thread overview]
Message-ID: <54FA2197.2000005@imgtec.com> (raw)
Message-ID: <20150306215223.uCrM75Jqdq_s7wGv90EWPHE3GG_7jxEp1Cd_jk-RPWw@z> (raw)
In-Reply-To: <alpine.LFD.2.11.1503061228410.15786@eddie.linux-mips.org>

Thank you Maciej for the review!


On 03/06/2015 04:47 AM, Maciej W. Rozycki wrote:
> On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
>
>> Use sb1250 hpt for sched_clock source. This implementation will give high
>> resolution cputime accounting.
>>
>> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
>> ---
>>   arch/mips/kernel/csrc-sb1250.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
>> index df84836..6546fff 100644
>> --- a/arch/mips/kernel/csrc-sb1250.c
>> +++ b/arch/mips/kernel/csrc-sb1250.c
>> @@ -12,6 +12,7 @@
>>    * GNU General Public License for more details.
>>    */
>>   #include <linux/clocksource.h>
>> +#include <linux/sched_clock.h>
>>   
>>   #include <asm/addrspace.h>
>>   #include <asm/io.h>
>> @@ -46,6 +47,11 @@ struct clocksource bcm1250_clocksource = {
>>   	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
>>   };
>>   
>> +static u64 notrace sb1250_read_sched_clock(void)
>> +{
>> +	return sb1250_hpt_read(NULL);
>> +}
>> +
>   I think you're abusing the API of `sb1250_hpt_read' here, by relying on
> the implementation not using its `cs' argument.
>
>   I think it would make sense to reverse the implementation, by calling
> `sb1250_read_sched_clock' from `sb1250_hpt_read' instead.  Or perhaps
> better yet use a static inline helper for both, so as to avoid the extra
> tail call and the associated performance hit.
>
>    Maciej

Good point. Will do in v2.


Deng-Cheng

  reply	other threads:[~2015-03-06 21:52 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05  0:58 [PATCH 00/15] MIPS: Add cputime/clock/hrtick features Deng-Cheng Zhu
2015-03-05  0:58 ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 01/15] MIPS: Add SCHED_HRTICK support Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 02/15] MIPS: Fall back to generic implementation of cmpxchg64 on 32-bit platforms Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 03/15] MIPS: Add support for full dynticks CPU time accounting Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 04/15] MIPS: Add sched_clock support Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-06 11:58   ` Maciej W. Rozycki
2015-03-06 23:23     ` Deng-Cheng Zhu
2015-03-06 23:23       ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 05/15] MIPS: csrc-r4k: Implement read_sched_clock Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 06/15] MIPS: csrc-bcm1480: Remove FSF mail address from GPL notice Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 07/15] MIPS: csrc-bcm1480: Implement read_sched_clock Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 08/15] MIPS: csrc-ioasic: Remove FSF mail address from GPL notice Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-06 11:23   ` Maciej W. Rozycki
2015-03-05  0:58 ` [PATCH 09/15] MIPS: csrc-ioasic: Implement read_sched_clock Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-06 12:07   ` Maciej W. Rozycki
2015-03-05  0:58 ` [PATCH 10/15] MIPS: sgi-ip27: " Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 11/15] MIPS: cevt-txx9: " Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 12/15] MIPS: jz4740: " Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 13/15] MIPS: csrc-sb1250: Remove FSF mail address from GPL notice Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu
2015-03-06 12:47   ` Maciej W. Rozycki
2015-03-06 21:52     ` Deng-Cheng Zhu [this message]
2015-03-06 21:52       ` Deng-Cheng Zhu
2015-03-05  0:58 ` [PATCH 15/15] MIPS: Add support for fine granularity task level IRQ time accounting Deng-Cheng Zhu
2015-03-05  0:58   ` Deng-Cheng Zhu

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=54FA2197.2000005@imgtec.com \
    --to=dengcheng.zhu@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox