* [PATCH 00/15] MIPS: Add cputime/clock/hrtick features
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Some generic features are applicable to MIPS but currently missing. Some
need low-level support. This patch set is mainly for providing high
resolution cpu/task time accounting. Testing was done on Malta. Welcome
Tested-by's for other platforms.
Deng-Cheng Zhu (15):
MIPS: Add SCHED_HRTICK support
MIPS: Fall back to generic implementation of cmpxchg64 on 32-bit
platforms
MIPS: Add support for full dynticks CPU time accounting
MIPS: Add sched_clock support
MIPS: csrc-r4k: Implement read_sched_clock
MIPS: csrc-bcm1480: Remove FSF mail address from GPL notice
MIPS: csrc-bcm1480: Implement read_sched_clock
MIPS: csrc-ioasic: Remove FSF mail address from GPL notice
MIPS: csrc-ioasic: Implement read_sched_clock
MIPS: sgi-ip27: Implement read_sched_clock
MIPS: cevt-txx9: Implement read_sched_clock
MIPS: jz4740: Implement read_sched_clock
MIPS: csrc-sb1250: Remove FSF mail address from GPL notice
MIPS: csrc-sb1250: Implement read_sched_clock
MIPS: Add support for fine granularity task level IRQ time accounting
arch/mips/Kconfig | 6 ++++++
arch/mips/include/asm/cmpxchg.h | 11 ++++++-----
arch/mips/jz4740/time.c | 8 ++++++++
arch/mips/kernel/cevt-txx9.c | 9 +++++++++
arch/mips/kernel/csrc-bcm1480.c | 12 ++++++++----
arch/mips/kernel/csrc-ioasic.c | 13 +++++++++----
arch/mips/kernel/csrc-r4k.c | 8 ++++++++
arch/mips/kernel/csrc-sb1250.c | 12 ++++++++----
arch/mips/sgi-ip27/ip27-timer.c | 8 ++++++++
9 files changed, 70 insertions(+), 17 deletions(-)
--
1.8.5.3
^ permalink raw reply [flat|nested] 42+ messages in thread* [PATCH 01/15] MIPS: Add SCHED_HRTICK support
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
We have HIGH_RES_TIMERS to support SCHED_HRTICK. But SCHED_HRTICK is in
kernel/Kconfig.hz where HZ values unsuitable for MIPS are defined. So we
simply add this config in arch/mips/Kconfig as opposed to including the
whole kernel/Kconfig.hz.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 294f82e..17f23ed 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2500,6 +2500,9 @@ config HZ
default 1000 if HZ_1000
default 1024 if HZ_1024
+config SCHED_HRTICK
+ def_bool HIGH_RES_TIMERS
+
source "kernel/Kconfig.preempt"
config KEXEC
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 01/15] MIPS: Add SCHED_HRTICK support
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
We have HIGH_RES_TIMERS to support SCHED_HRTICK. But SCHED_HRTICK is in
kernel/Kconfig.hz where HZ values unsuitable for MIPS are defined. So we
simply add this config in arch/mips/Kconfig as opposed to including the
whole kernel/Kconfig.hz.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 294f82e..17f23ed 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2500,6 +2500,9 @@ config HZ
default 1000 if HZ_1000
default 1024 if HZ_1024
+config SCHED_HRTICK
+ def_bool HIGH_RES_TIMERS
+
source "kernel/Kconfig.preempt"
config KEXEC
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 02/15] MIPS: Fall back to generic implementation of cmpxchg64 on 32-bit platforms
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is in preparation of adding HAVE_VIRT_CPU_ACCOUNTING_GEN support in
the next patch.
Without having cmpxchg64 to use the generic implementation, kernel linking
will complain:
kernel/built-in.o: In function `cputime_adjust':
cputime.c:(.text+0x33748): undefined reference to `__cmpxchg_called_with_bad_pointer'
cputime.c:(.text+0x33810): undefined reference to `__cmpxchg_called_with_bad_pointer'
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/include/asm/cmpxchg.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
index d0a2a68..412f945 100644
--- a/arch/mips/include/asm/cmpxchg.h
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -229,21 +229,22 @@ extern void __cmpxchg_called_with_bad_pointer(void);
#define cmpxchg(ptr, old, new) __cmpxchg(ptr, old, new, smp_mb__before_llsc(), smp_llsc_mb())
#define cmpxchg_local(ptr, old, new) __cmpxchg(ptr, old, new, , )
-#define cmpxchg64(ptr, o, n) \
+#ifdef CONFIG_64BIT
+#define cmpxchg64_local(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
- cmpxchg((ptr), (o), (n)); \
+ cmpxchg_local((ptr), (o), (n)); \
})
-#ifdef CONFIG_64BIT
-#define cmpxchg64_local(ptr, o, n) \
+#define cmpxchg64(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
- cmpxchg_local((ptr), (o), (n)); \
+ cmpxchg((ptr), (o), (n)); \
})
#else
#include <asm-generic/cmpxchg-local.h>
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
#endif
#endif /* __ASM_CMPXCHG_H */
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 02/15] MIPS: Fall back to generic implementation of cmpxchg64 on 32-bit platforms
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is in preparation of adding HAVE_VIRT_CPU_ACCOUNTING_GEN support in
the next patch.
Without having cmpxchg64 to use the generic implementation, kernel linking
will complain:
kernel/built-in.o: In function `cputime_adjust':
cputime.c:(.text+0x33748): undefined reference to `__cmpxchg_called_with_bad_pointer'
cputime.c:(.text+0x33810): undefined reference to `__cmpxchg_called_with_bad_pointer'
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/include/asm/cmpxchg.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
index d0a2a68..412f945 100644
--- a/arch/mips/include/asm/cmpxchg.h
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -229,21 +229,22 @@ extern void __cmpxchg_called_with_bad_pointer(void);
#define cmpxchg(ptr, old, new) __cmpxchg(ptr, old, new, smp_mb__before_llsc(), smp_llsc_mb())
#define cmpxchg_local(ptr, old, new) __cmpxchg(ptr, old, new, , )
-#define cmpxchg64(ptr, o, n) \
+#ifdef CONFIG_64BIT
+#define cmpxchg64_local(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
- cmpxchg((ptr), (o), (n)); \
+ cmpxchg_local((ptr), (o), (n)); \
})
-#ifdef CONFIG_64BIT
-#define cmpxchg64_local(ptr, o, n) \
+#define cmpxchg64(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
- cmpxchg_local((ptr), (o), (n)); \
+ cmpxchg((ptr), (o), (n)); \
})
#else
#include <asm-generic/cmpxchg-local.h>
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
#endif
#endif /* __ASM_CMPXCHG_H */
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 03/15] MIPS: Add support for full dynticks CPU time accounting
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
With the correct cmpxchg64 on 32-bit platforms, we can now add the config
HAVE_VIRT_CPU_ACCOUNTING_GEN into arch/mips/Kconfig.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 17f23ed..068592a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -55,6 +55,7 @@ config MIPS
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_BINFMT_ELF_STATE
select SYSCTL_EXCEPTION_TRACE
+ select HAVE_VIRT_CPU_ACCOUNTING_GEN
menu "Machine selection"
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 03/15] MIPS: Add support for full dynticks CPU time accounting
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
With the correct cmpxchg64 on 32-bit platforms, we can now add the config
HAVE_VIRT_CPU_ACCOUNTING_GEN into arch/mips/Kconfig.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 17f23ed..068592a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -55,6 +55,7 @@ config MIPS
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
select ARCH_BINFMT_ELF_STATE
select SYSCTL_EXCEPTION_TRACE
+ select HAVE_VIRT_CPU_ACCOUNTING_GEN
menu "Machine selection"
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 04/15] MIPS: Add sched_clock support
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This will provide sched_clock interface to implement individual
read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
sched_clock() directly (not using the sched_clock_register interface).
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 068592a..09405dc 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -43,6 +43,7 @@ config MIPS
select GENERIC_SMP_IDLE_THREAD
select BUILDTIME_EXTABLE_SORT
select GENERIC_CLOCKEVENTS
+ select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
select GENERIC_CMOS_UPDATE
select HAVE_MOD_ARCH_SPECIFIC
select VIRT_TO_BUS
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 04/15] MIPS: Add sched_clock support
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This will provide sched_clock interface to implement individual
read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
sched_clock() directly (not using the sched_clock_register interface).
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 068592a..09405dc 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -43,6 +43,7 @@ config MIPS
select GENERIC_SMP_IDLE_THREAD
select BUILDTIME_EXTABLE_SORT
select GENERIC_CLOCKEVENTS
+ select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
select GENERIC_CMOS_UPDATE
select HAVE_MOD_ARCH_SPECIFIC
select VIRT_TO_BUS
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 04/15] MIPS: Add sched_clock support
2015-03-05 0:58 ` Deng-Cheng Zhu
@ 2015-03-06 11:58 ` Maciej W. Rozycki
-1 siblings, 0 replies; 42+ messages in thread
From: Maciej W. Rozycki @ 2015-03-06 11:58 UTC (permalink / raw)
To: Deng-Cheng Zhu, Russell King
Cc: linux-mips, Ralf Baechle, linux-kernel, linux-arm-kernel
On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
> This will provide sched_clock interface to implement individual
> read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
> sched_clock() directly (not using the sched_clock_register interface).
>
> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
> ---
> arch/mips/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 068592a..09405dc 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -43,6 +43,7 @@ config MIPS
> select GENERIC_SMP_IDLE_THREAD
> select BUILDTIME_EXTABLE_SORT
> select GENERIC_CLOCKEVENTS
> + select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
> select GENERIC_CMOS_UPDATE
> select HAVE_MOD_ARCH_SPECIFIC
> select VIRT_TO_BUS
Why does this change add this question:
ARM Versatile (Express) reference platforms clock source (CLKSRC_VERSATILE) [N/y/?] (NEW) ?
This option enables clock source based on free running
counter available in the "System Registers" block of
ARM Versatile, RealView and Versatile Express reference
platforms.
Symbol: CLKSRC_VERSATILE [=n]
Type : boolean
Prompt: ARM Versatile (Express) reference platforms clock source
Location:
-> Device Drivers
-> Clock Source drivers
Defined at drivers/clocksource/Kconfig:216
Depends on: GENERIC_SCHED_CLOCK [=y] && !ARCH_USES_GETTIMEOFFSET [=n]
Selects: CLKSRC_OF [=n]
to a MIPS configuration? I find it silly, this appears a platform
device to me (use reverse dependencies?).
Maciej
^ permalink raw reply [flat|nested] 42+ messages in thread* [PATCH 04/15] MIPS: Add sched_clock support
@ 2015-03-06 11:58 ` Maciej W. Rozycki
0 siblings, 0 replies; 42+ messages in thread
From: Maciej W. Rozycki @ 2015-03-06 11:58 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
> This will provide sched_clock interface to implement individual
> read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
> sched_clock() directly (not using the sched_clock_register interface).
>
> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
> ---
> arch/mips/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 068592a..09405dc 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -43,6 +43,7 @@ config MIPS
> select GENERIC_SMP_IDLE_THREAD
> select BUILDTIME_EXTABLE_SORT
> select GENERIC_CLOCKEVENTS
> + select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
> select GENERIC_CMOS_UPDATE
> select HAVE_MOD_ARCH_SPECIFIC
> select VIRT_TO_BUS
Why does this change add this question:
ARM Versatile (Express) reference platforms clock source (CLKSRC_VERSATILE) [N/y/?] (NEW) ?
This option enables clock source based on free running
counter available in the "System Registers" block of
ARM Versatile, RealView and Versatile Express reference
platforms.
Symbol: CLKSRC_VERSATILE [=n]
Type : boolean
Prompt: ARM Versatile (Express) reference platforms clock source
Location:
-> Device Drivers
-> Clock Source drivers
Defined at drivers/clocksource/Kconfig:216
Depends on: GENERIC_SCHED_CLOCK [=y] && !ARCH_USES_GETTIMEOFFSET [=n]
Selects: CLKSRC_OF [=n]
to a MIPS configuration? I find it silly, this appears a platform
device to me (use reverse dependencies?).
Maciej
^ permalink raw reply [flat|nested] 42+ messages in thread* Re: [PATCH 04/15] MIPS: Add sched_clock support
@ 2015-03-06 23:23 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-06 23:23 UTC (permalink / raw)
To: Maciej W. Rozycki, Russell King
Cc: linux-mips, Ralf Baechle, linux-kernel, linux-arm-kernel
On 03/06/2015 03:58 AM, Maciej W. Rozycki wrote:
> On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
>
>> This will provide sched_clock interface to implement individual
>> read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
>> sched_clock() directly (not using the sched_clock_register interface).
>>
>> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
>> ---
>> arch/mips/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 068592a..09405dc 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -43,6 +43,7 @@ config MIPS
>> select GENERIC_SMP_IDLE_THREAD
>> select BUILDTIME_EXTABLE_SORT
>> select GENERIC_CLOCKEVENTS
>> + select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
>> select GENERIC_CMOS_UPDATE
>> select HAVE_MOD_ARCH_SPECIFIC
>> select VIRT_TO_BUS
> Why does this change add this question:
>
> ARM Versatile (Express) reference platforms clock source (CLKSRC_VERSATILE) [N/y/?] (NEW) ?
Good catch.
>
> This option enables clock source based on free running
> counter available in the "System Registers" block of
> ARM Versatile, RealView and Versatile Express reference
> platforms.
>
> Symbol: CLKSRC_VERSATILE [=n]
> Type : boolean
> Prompt: ARM Versatile (Express) reference platforms clock source
> Location:
> -> Device Drivers
> -> Clock Source drivers
> Defined at drivers/clocksource/Kconfig:216
> Depends on: GENERIC_SCHED_CLOCK [=y] && !ARCH_USES_GETTIMEOFFSET [=n]
> Selects: CLKSRC_OF [=n]
>
> to a MIPS configuration? I find it silly, this appears a platform
> device to me (use reverse dependencies?).
GENERIC_SCHED_CLOCK is generic, by default it uses jiffy_sched_clock_read()
for read_sched_clock(). Instead of using reverse dependencies, I suggest
the following:
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f..22e0ee1 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -225,7 +225,7 @@ config CLKSRC_QCOM
config CLKSRC_VERSATILE
bool "ARM Versatile (Express) reference platforms clock source"
- depends on GENERIC_SCHED_CLOCK && !ARCH_USES_GETTIMEOFFSET
+ depends on PLAT_VERSATILE && GENERIC_SCHED_CLOCK &&
!ARCH_USES_GETTIMEOFFSET
select CLKSRC_OF
default y if MFD_VEXPRESS_SYSREG
help
Deng-Cheng
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 04/15] MIPS: Add sched_clock support
@ 2015-03-06 23:23 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-06 23:23 UTC (permalink / raw)
To: linux-arm-kernel
On 03/06/2015 03:58 AM, Maciej W. Rozycki wrote:
> On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
>
>> This will provide sched_clock interface to implement individual
>> read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
>> sched_clock() directly (not using the sched_clock_register interface).
>>
>> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
>> ---
>> arch/mips/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 068592a..09405dc 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -43,6 +43,7 @@ config MIPS
>> select GENERIC_SMP_IDLE_THREAD
>> select BUILDTIME_EXTABLE_SORT
>> select GENERIC_CLOCKEVENTS
>> + select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
>> select GENERIC_CMOS_UPDATE
>> select HAVE_MOD_ARCH_SPECIFIC
>> select VIRT_TO_BUS
> Why does this change add this question:
>
> ARM Versatile (Express) reference platforms clock source (CLKSRC_VERSATILE) [N/y/?] (NEW) ?
Good catch.
>
> This option enables clock source based on free running
> counter available in the "System Registers" block of
> ARM Versatile, RealView and Versatile Express reference
> platforms.
>
> Symbol: CLKSRC_VERSATILE [=n]
> Type : boolean
> Prompt: ARM Versatile (Express) reference platforms clock source
> Location:
> -> Device Drivers
> -> Clock Source drivers
> Defined at drivers/clocksource/Kconfig:216
> Depends on: GENERIC_SCHED_CLOCK [=y] && !ARCH_USES_GETTIMEOFFSET [=n]
> Selects: CLKSRC_OF [=n]
>
> to a MIPS configuration? I find it silly, this appears a platform
> device to me (use reverse dependencies?).
GENERIC_SCHED_CLOCK is generic, by default it uses jiffy_sched_clock_read()
for read_sched_clock(). Instead of using reverse dependencies, I suggest
the following:
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f..22e0ee1 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -225,7 +225,7 @@ config CLKSRC_QCOM
config CLKSRC_VERSATILE
bool "ARM Versatile (Express) reference platforms clock source"
- depends on GENERIC_SCHED_CLOCK && !ARCH_USES_GETTIMEOFFSET
+ depends on PLAT_VERSATILE && GENERIC_SCHED_CLOCK &&
!ARCH_USES_GETTIMEOFFSET
select CLKSRC_OF
default y if MFD_VEXPRESS_SYSREG
help
Deng-Cheng
^ permalink raw reply related [flat|nested] 42+ messages in thread* Re: [PATCH 04/15] MIPS: Add sched_clock support
@ 2015-03-06 23:23 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-06 23:23 UTC (permalink / raw)
To: Maciej W. Rozycki, Russell King
Cc: linux-mips, Ralf Baechle, linux-kernel, linux-arm-kernel
On 03/06/2015 03:58 AM, Maciej W. Rozycki wrote:
> On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
>
>> This will provide sched_clock interface to implement individual
>> read_sched_clock(). Not for CAVIUM_OCTEON_SOC as it defines its own
>> sched_clock() directly (not using the sched_clock_register interface).
>>
>> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
>> ---
>> arch/mips/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 068592a..09405dc 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -43,6 +43,7 @@ config MIPS
>> select GENERIC_SMP_IDLE_THREAD
>> select BUILDTIME_EXTABLE_SORT
>> select GENERIC_CLOCKEVENTS
>> + select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC
>> select GENERIC_CMOS_UPDATE
>> select HAVE_MOD_ARCH_SPECIFIC
>> select VIRT_TO_BUS
> Why does this change add this question:
>
> ARM Versatile (Express) reference platforms clock source (CLKSRC_VERSATILE) [N/y/?] (NEW) ?
Good catch.
>
> This option enables clock source based on free running
> counter available in the "System Registers" block of
> ARM Versatile, RealView and Versatile Express reference
> platforms.
>
> Symbol: CLKSRC_VERSATILE [=n]
> Type : boolean
> Prompt: ARM Versatile (Express) reference platforms clock source
> Location:
> -> Device Drivers
> -> Clock Source drivers
> Defined at drivers/clocksource/Kconfig:216
> Depends on: GENERIC_SCHED_CLOCK [=y] && !ARCH_USES_GETTIMEOFFSET [=n]
> Selects: CLKSRC_OF [=n]
>
> to a MIPS configuration? I find it silly, this appears a platform
> device to me (use reverse dependencies?).
GENERIC_SCHED_CLOCK is generic, by default it uses jiffy_sched_clock_read()
for read_sched_clock(). Instead of using reverse dependencies, I suggest
the following:
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f..22e0ee1 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -225,7 +225,7 @@ config CLKSRC_QCOM
config CLKSRC_VERSATILE
bool "ARM Versatile (Express) reference platforms clock source"
- depends on GENERIC_SCHED_CLOCK && !ARCH_USES_GETTIMEOFFSET
+ depends on PLAT_VERSATILE && GENERIC_SCHED_CLOCK &&
!ARCH_USES_GETTIMEOFFSET
select CLKSRC_OF
default y if MFD_VEXPRESS_SYSREG
help
Deng-Cheng
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 05/15] MIPS: csrc-r4k: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use c0 count register 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-r4k.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index decd1fa..e5ed7ad 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -7,6 +7,7 @@
*/
#include <linux/clocksource.h>
#include <linux/init.h>
+#include <linux/sched_clock.h>
#include <asm/time.h>
@@ -22,6 +23,11 @@ static struct clocksource clocksource_mips = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace r4k_read_sched_clock(void)
+{
+ return read_c0_count();
+}
+
int __init init_r4k_clocksource(void)
{
if (!cpu_has_counter || !mips_hpt_frequency)
@@ -32,5 +38,7 @@ int __init init_r4k_clocksource(void)
clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
+ sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency);
+
return 0;
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 05/15] MIPS: csrc-r4k: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use c0 count register 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-r4k.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index decd1fa..e5ed7ad 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -7,6 +7,7 @@
*/
#include <linux/clocksource.h>
#include <linux/init.h>
+#include <linux/sched_clock.h>
#include <asm/time.h>
@@ -22,6 +23,11 @@ static struct clocksource clocksource_mips = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace r4k_read_sched_clock(void)
+{
+ return read_c0_count();
+}
+
int __init init_r4k_clocksource(void)
{
if (!cpu_has_counter || !mips_hpt_frequency)
@@ -32,5 +38,7 @@ int __init init_r4k_clocksource(void)
clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
+ sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency);
+
return 0;
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 06/15] MIPS: csrc-bcm1480: Remove FSF mail address from GPL notice
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is to make checkpatch.pl happy for the next patch. It would otherwise
say --
ERROR: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/kernel/csrc-bcm1480.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c
index 468f3eb..0a20a0f 100644
--- a/arch/mips/kernel/csrc-bcm1480.c
+++ b/arch/mips/kernel/csrc-bcm1480.c
@@ -10,10 +10,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/clocksource.h>
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 06/15] MIPS: csrc-bcm1480: Remove FSF mail address from GPL notice
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is to make checkpatch.pl happy for the next patch. It would otherwise
say --
ERROR: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/kernel/csrc-bcm1480.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c
index 468f3eb..0a20a0f 100644
--- a/arch/mips/kernel/csrc-bcm1480.c
+++ b/arch/mips/kernel/csrc-bcm1480.c
@@ -10,10 +10,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/clocksource.h>
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 07/15] MIPS: csrc-bcm1480: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use the ZBbus cycle counter 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-bcm1480.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c
index 0a20a0f..7f65b53 100644
--- a/arch/mips/kernel/csrc-bcm1480.c
+++ b/arch/mips/kernel/csrc-bcm1480.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>
@@ -37,6 +38,11 @@ struct clocksource bcm1480_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace sb1480_read_sched_clock(void)
+{
+ return __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
+}
+
void __init sb1480_clocksource_init(void)
{
struct clocksource *cs = &bcm1480_clocksource;
@@ -46,4 +52,6 @@ void __init sb1480_clocksource_init(void)
plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000);
clocksource_register_hz(cs, zbbus);
+
+ sched_clock_register(sb1480_read_sched_clock, 64, zbbus);
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 07/15] MIPS: csrc-bcm1480: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use the ZBbus cycle counter 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-bcm1480.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c
index 0a20a0f..7f65b53 100644
--- a/arch/mips/kernel/csrc-bcm1480.c
+++ b/arch/mips/kernel/csrc-bcm1480.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>
@@ -37,6 +38,11 @@ struct clocksource bcm1480_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace sb1480_read_sched_clock(void)
+{
+ return __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
+}
+
void __init sb1480_clocksource_init(void)
{
struct clocksource *cs = &bcm1480_clocksource;
@@ -46,4 +52,6 @@ void __init sb1480_clocksource_init(void)
plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000);
clocksource_register_hz(cs, zbbus);
+
+ sched_clock_register(sb1480_read_sched_clock, 64, zbbus);
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 08/15] MIPS: csrc-ioasic: Remove FSF mail address from GPL notice
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is to make checkpatch.pl happy for the next patch. It would otherwise
say --
ERROR: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/kernel/csrc-ioasic.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c
index 6cbbf6e..54e394d 100644
--- a/arch/mips/kernel/csrc-ioasic.c
+++ b/arch/mips/kernel/csrc-ioasic.c
@@ -12,10 +12,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/clocksource.h>
#include <linux/init.h>
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 08/15] MIPS: csrc-ioasic: Remove FSF mail address from GPL notice
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is to make checkpatch.pl happy for the next patch. It would otherwise
say --
ERROR: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/kernel/csrc-ioasic.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c
index 6cbbf6e..54e394d 100644
--- a/arch/mips/kernel/csrc-ioasic.c
+++ b/arch/mips/kernel/csrc-ioasic.c
@@ -12,10 +12,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/clocksource.h>
#include <linux/init.h>
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 08/15] MIPS: csrc-ioasic: Remove FSF mail address from GPL notice
2015-03-05 0:58 ` Deng-Cheng Zhu
(?)
@ 2015-03-06 11:23 ` Maciej W. Rozycki
-1 siblings, 0 replies; 42+ messages in thread
From: Maciej W. Rozycki @ 2015-03-06 11:23 UTC (permalink / raw)
To: Deng-Cheng Zhu; +Cc: linux-mips, Ralf Baechle
On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
> This is to make checkpatch.pl happy for the next patch. It would otherwise
> say --
>
> ERROR: Do not include the paragraph about writing to the Free Software
> Foundation's mailing address from the sample GPL notice. The FSF has
> changed addresses in the past, and may do so again. Linux already includes
> a copy of the GPL.
>
> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
> ---
Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
Maciej
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 09/15] MIPS: csrc-ioasic: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use DEC I/O ASIC's free-running counter 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-ioasic.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c
index 54e394d..722f558 100644
--- a/arch/mips/kernel/csrc-ioasic.c
+++ b/arch/mips/kernel/csrc-ioasic.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
#include <linux/clocksource.h>
+#include <linux/sched_clock.h>
#include <linux/init.h>
#include <asm/ds1287.h>
@@ -33,6 +34,11 @@ static struct clocksource clocksource_dec = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace dec_ioasic_read_sched_clock(void)
+{
+ return ioasic_read(IO_REG_FCTR);
+}
+
int __init dec_ioasic_clocksource_init(void)
{
unsigned int freq;
@@ -61,5 +67,8 @@ int __init dec_ioasic_clocksource_init(void)
clocksource_dec.rating = 200 + freq / 10000000;
clocksource_register_hz(&clocksource_dec, freq);
+
+ sched_clock_register(dec_ioasic_read_sched_clock, 32, freq);
+
return 0;
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 09/15] MIPS: csrc-ioasic: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use DEC I/O ASIC's free-running counter 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-ioasic.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/mips/kernel/csrc-ioasic.c b/arch/mips/kernel/csrc-ioasic.c
index 54e394d..722f558 100644
--- a/arch/mips/kernel/csrc-ioasic.c
+++ b/arch/mips/kernel/csrc-ioasic.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
#include <linux/clocksource.h>
+#include <linux/sched_clock.h>
#include <linux/init.h>
#include <asm/ds1287.h>
@@ -33,6 +34,11 @@ static struct clocksource clocksource_dec = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace dec_ioasic_read_sched_clock(void)
+{
+ return ioasic_read(IO_REG_FCTR);
+}
+
int __init dec_ioasic_clocksource_init(void)
{
unsigned int freq;
@@ -61,5 +67,8 @@ int __init dec_ioasic_clocksource_init(void)
clocksource_dec.rating = 200 + freq / 10000000;
clocksource_register_hz(&clocksource_dec, freq);
+
+ sched_clock_register(dec_ioasic_read_sched_clock, 32, freq);
+
return 0;
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* Re: [PATCH 09/15] MIPS: csrc-ioasic: Implement read_sched_clock
2015-03-05 0:58 ` Deng-Cheng Zhu
(?)
@ 2015-03-06 12:07 ` Maciej W. Rozycki
-1 siblings, 0 replies; 42+ messages in thread
From: Maciej W. Rozycki @ 2015-03-06 12:07 UTC (permalink / raw)
To: Deng-Cheng Zhu; +Cc: linux-mips, ralf
On Wed, 4 Mar 2015, Deng-Cheng Zhu wrote:
> Use DEC I/O ASIC's free-running counter for sched_clock source. This
> implementation will give high resolution cputime accounting.
>
> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
> ---
Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
Maciej
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 10/15] MIPS: sgi-ip27: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use ip27 hub real time counter for sched_clock source. This implementation
will give high resolution cputime accounting.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/sgi-ip27/ip27-timer.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 1d97eab..a6d10f6 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -7,6 +7,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
+#include <linux/sched_clock.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/param.h>
@@ -159,11 +160,18 @@ struct clocksource hub_rt_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace hub_rt_read_sched_clock(void)
+{
+ return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
+}
+
static void __init hub_rt_clocksource_init(void)
{
struct clocksource *cs = &hub_rt_clocksource;
clocksource_register_hz(cs, CYCLES_PER_SEC);
+
+ sched_clock_register(hub_rt_read_sched_clock, 52, CYCLES_PER_SEC);
}
void __init plat_time_init(void)
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 10/15] MIPS: sgi-ip27: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use ip27 hub real time counter for sched_clock source. This implementation
will give high resolution cputime accounting.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/sgi-ip27/ip27-timer.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 1d97eab..a6d10f6 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -7,6 +7,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
+#include <linux/sched_clock.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/param.h>
@@ -159,11 +160,18 @@ struct clocksource hub_rt_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace hub_rt_read_sched_clock(void)
+{
+ return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
+}
+
static void __init hub_rt_clocksource_init(void)
{
struct clocksource *cs = &hub_rt_clocksource;
clocksource_register_hz(cs, CYCLES_PER_SEC);
+
+ sched_clock_register(hub_rt_read_sched_clock, 52, CYCLES_PER_SEC);
}
void __init plat_time_init(void)
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 11/15] MIPS: cevt-txx9: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use txx9 up-counter 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/cevt-txx9.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index 2ae0846..7239324 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
+#include <linux/sched_clock.h>
#include <asm/time.h>
#include <asm/txx9tmr.h>
@@ -46,6 +47,11 @@ static struct txx9_clocksource txx9_clocksource = {
},
};
+static u64 notrace txx9_read_sched_clock(void)
+{
+ return __raw_readl(&txx9_clocksource.tmrptr->trr);
+}
+
void __init txx9_clocksource_init(unsigned long baseaddr,
unsigned int imbusclk)
{
@@ -61,6 +67,9 @@ void __init txx9_clocksource_init(unsigned long baseaddr,
__raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra);
__raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr);
txx9_clocksource.tmrptr = tmrptr;
+
+ sched_clock_register(txx9_read_sched_clock, TXX9_CLOCKSOURCE_BITS,
+ TIMER_CLK(imbusclk));
}
struct txx9_clock_event_device {
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 11/15] MIPS: cevt-txx9: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use txx9 up-counter 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/cevt-txx9.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index 2ae0846..7239324 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
+#include <linux/sched_clock.h>
#include <asm/time.h>
#include <asm/txx9tmr.h>
@@ -46,6 +47,11 @@ static struct txx9_clocksource txx9_clocksource = {
},
};
+static u64 notrace txx9_read_sched_clock(void)
+{
+ return __raw_readl(&txx9_clocksource.tmrptr->trr);
+}
+
void __init txx9_clocksource_init(unsigned long baseaddr,
unsigned int imbusclk)
{
@@ -61,6 +67,9 @@ void __init txx9_clocksource_init(unsigned long baseaddr,
__raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra);
__raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr);
txx9_clocksource.tmrptr = tmrptr;
+
+ sched_clock_register(txx9_read_sched_clock, TXX9_CLOCKSOURCE_BITS,
+ TIMER_CLK(imbusclk));
}
struct txx9_clock_event_device {
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 12/15] MIPS: jz4740: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use jz4740 timer counter for sched_clock source. This implementation will
give high resolution cputime accounting.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/jz4740/time.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index 5e430ce..72b0cecb 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -18,6 +18,7 @@
#include <linux/time.h>
#include <linux/clockchips.h>
+#include <linux/sched_clock.h>
#include <asm/mach-jz4740/irq.h>
#include <asm/mach-jz4740/timer.h>
@@ -43,6 +44,11 @@ static struct clocksource jz4740_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace jz4740_read_sched_clock(void)
+{
+ return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
+}
+
static irqreturn_t jz4740_clockevent_irq(int irq, void *devid)
{
struct clock_event_device *cd = devid;
@@ -126,6 +132,8 @@ void __init plat_time_init(void)
if (ret)
printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
+ sched_clock_register(jz4740_read_sched_clock, 16, clk_rate);
+
setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction);
ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT;
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 12/15] MIPS: jz4740: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
Use jz4740 timer counter for sched_clock source. This implementation will
give high resolution cputime accounting.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/jz4740/time.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index 5e430ce..72b0cecb 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -18,6 +18,7 @@
#include <linux/time.h>
#include <linux/clockchips.h>
+#include <linux/sched_clock.h>
#include <asm/mach-jz4740/irq.h>
#include <asm/mach-jz4740/timer.h>
@@ -43,6 +44,11 @@ static struct clocksource jz4740_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static u64 notrace jz4740_read_sched_clock(void)
+{
+ return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
+}
+
static irqreturn_t jz4740_clockevent_irq(int irq, void *devid)
{
struct clock_event_device *cd = devid;
@@ -126,6 +132,8 @@ void __init plat_time_init(void)
if (ret)
printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
+ sched_clock_register(jz4740_read_sched_clock, 16, clk_rate);
+
setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction);
ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT;
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 13/15] MIPS: csrc-sb1250: Remove FSF mail address from GPL notice
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is to make checkpatch.pl happy for the next patch. It would otherwise
say --
ERROR: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/kernel/csrc-sb1250.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
index 6ecb77d..df84836 100644
--- a/arch/mips/kernel/csrc-sb1250.c
+++ b/arch/mips/kernel/csrc-sb1250.c
@@ -10,10 +10,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/clocksource.h>
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 13/15] MIPS: csrc-sb1250: Remove FSF mail address from GPL notice
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
This is to make checkpatch.pl happy for the next patch. It would otherwise
say --
ERROR: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/kernel/csrc-sb1250.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
index 6ecb77d..df84836 100644
--- a/arch/mips/kernel/csrc-sb1250.c
+++ b/arch/mips/kernel/csrc-sb1250.c
@@ -10,10 +10,6 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/clocksource.h>
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
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);
+}
+
void __init sb1250_clocksource_init(void)
{
struct clocksource *cs = &bcm1250_clocksource;
@@ -62,4 +68,6 @@ void __init sb1250_clocksource_init(void)
R_SCD_TIMER_CFG)));
clocksource_register_hz(cs, V_SCD_TIMER_FREQ);
+
+ sched_clock_register(sb1250_read_sched_clock, 23, V_SCD_TIMER_FREQ);
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
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);
+}
+
void __init sb1250_clocksource_init(void)
{
struct clocksource *cs = &bcm1250_clocksource;
@@ -62,4 +68,6 @@ void __init sb1250_clocksource_init(void)
R_SCD_TIMER_CFG)));
clocksource_register_hz(cs, V_SCD_TIMER_FREQ);
+
+ sched_clock_register(sb1250_read_sched_clock, 23, V_SCD_TIMER_FREQ);
}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread* Re: [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
2015-03-05 0:58 ` Deng-Cheng Zhu
(?)
@ 2015-03-06 12:47 ` Maciej W. Rozycki
2015-03-06 21:52 ` Deng-Cheng Zhu
-1 siblings, 1 reply; 42+ messages in thread
From: Maciej W. Rozycki @ 2015-03-06 12:47 UTC (permalink / raw)
To: Deng-Cheng Zhu; +Cc: linux-mips, Ralf Baechle
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
^ permalink raw reply [flat|nested] 42+ messages in thread* Re: [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
@ 2015-03-06 21:52 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-06 21:52 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: linux-mips, Ralf Baechle
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
^ permalink raw reply [flat|nested] 42+ messages in thread* Re: [PATCH 14/15] MIPS: csrc-sb1250: Implement read_sched_clock
@ 2015-03-06 21:52 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-06 21:52 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: linux-mips, Ralf Baechle
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
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 15/15] MIPS: Add support for fine granularity task level IRQ time accounting
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
With sched_clock being ready, it makes sense to add the option of IRQ time
accounting -- When we have a fast enough sched_clock, IRQ time accounting
will be enabled (see sched_clock_register).
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 09405dc..4748b8f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -57,6 +57,7 @@ config MIPS
select ARCH_BINFMT_ELF_STATE
select SYSCTL_EXCEPTION_TRACE
select HAVE_VIRT_CPU_ACCOUNTING_GEN
+ select HAVE_IRQ_TIME_ACCOUNTING
menu "Machine selection"
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 15/15] MIPS: Add support for fine granularity task level IRQ time accounting
@ 2015-03-05 0:58 ` Deng-Cheng Zhu
0 siblings, 0 replies; 42+ messages in thread
From: Deng-Cheng Zhu @ 2015-03-05 0:58 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: Deng-Cheng Zhu
With sched_clock being ready, it makes sense to add the option of IRQ time
accounting -- When we have a fast enough sched_clock, IRQ time accounting
will be enabled (see sched_clock_register).
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 09405dc..4748b8f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -57,6 +57,7 @@ config MIPS
select ARCH_BINFMT_ELF_STATE
select SYSCTL_EXCEPTION_TRACE
select HAVE_VIRT_CPU_ACCOUNTING_GEN
+ select HAVE_IRQ_TIME_ACCOUNTING
menu "Machine selection"
--
1.8.5.3
^ permalink raw reply related [flat|nested] 42+ messages in thread