* [PATCH 0/3] ARM: context tracking support prerequisites @ 2013-03-20 23:34 Kevin Hilman 2013-03-20 23:34 ` [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers Kevin Hilman ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Kevin Hilman @ 2013-03-20 23:34 UTC (permalink / raw) To: linux-arm-kernel This series is a set of prerequistes for getting the new context tracking subsystem, and adaptive tickless support working on ARM. Kevin Hilman (3): cputime_nsecs: use math64.h for nsec resolution conversion helpers init/Kconfig: virt CPU accounting: drop 64-bit requirment ARM: Kconfig: allow virt CPU accounting arch/arm/Kconfig | 1 + include/asm-generic/cputime_nsecs.h | 28 +++++++++++++++++++--------- init/Kconfig | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) -- 1.8.2 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers 2013-03-20 23:34 [PATCH 0/3] ARM: context tracking support prerequisites Kevin Hilman @ 2013-03-20 23:34 ` Kevin Hilman 2013-04-11 17:10 ` Frederic Weisbecker 2013-03-20 23:34 ` [PATCH 2/3] init/Kconfig: virt CPU accounting: drop 64-bit requirment Kevin Hilman 2013-03-20 23:34 ` [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting Kevin Hilman 2 siblings, 1 reply; 10+ messages in thread From: Kevin Hilman @ 2013-03-20 23:34 UTC (permalink / raw) To: linux-arm-kernel For the nsec resolution conversions to be useable on non 64-bit architectures, the helpers in <linux/math64.h> need to be used so the right arch-specific 64-bit math helpers can be used (e.g. do_div()) Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Kevin Hilman <khilman@linaro.org> --- include/asm-generic/cputime_nsecs.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h index a8ece9a..2c9e62c 100644 --- a/include/asm-generic/cputime_nsecs.h +++ b/include/asm-generic/cputime_nsecs.h @@ -16,21 +16,27 @@ #ifndef _ASM_GENERIC_CPUTIME_NSECS_H #define _ASM_GENERIC_CPUTIME_NSECS_H +#include <linux/math64.h> + typedef u64 __nocast cputime_t; typedef u64 __nocast cputime64_t; #define cputime_one_jiffy jiffies_to_cputime(1) +#define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor) +#define cputime_div_rem(__ct, divisor, remainder) \ + div_u64_rem((__force u64)__ct, divisor, remainder); + /* * Convert cputime <-> jiffies (HZ) */ #define cputime_to_jiffies(__ct) \ - ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) + cputime_div(__ct, NSEC_PER_SEC / HZ) #define cputime_to_scaled(__ct) (__ct) #define jiffies_to_cputime(__jif) \ (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) #define cputime64_to_jiffies64(__ct) \ - ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) + cputime_div(__ct, NSEC_PER_SEC / HZ) #define jiffies64_to_cputime64(__jif) \ (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ)) @@ -45,7 +51,7 @@ typedef u64 __nocast cputime64_t; * Convert cputime <-> microseconds */ #define cputime_to_usecs(__ct) \ - ((__force u64)(__ct) / NSEC_PER_USEC) + cputime_div(__ct, NSEC_PER_USEC) #define usecs_to_cputime(__usecs) \ (__force cputime_t)((__usecs) * NSEC_PER_USEC) #define usecs_to_cputime64(__usecs) \ @@ -55,7 +61,7 @@ typedef u64 __nocast cputime64_t; * Convert cputime <-> seconds */ #define cputime_to_secs(__ct) \ - ((__force u64)(__ct) / NSEC_PER_SEC) + cputime_div(__ct, NSEC_PER_SEC) #define secs_to_cputime(__secs) \ (__force cputime_t)((__secs) * NSEC_PER_SEC) @@ -69,8 +75,10 @@ static inline cputime_t timespec_to_cputime(const struct timespec *val) } static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) { - val->tv_sec = (__force u64) ct / NSEC_PER_SEC; - val->tv_nsec = (__force u64) ct % NSEC_PER_SEC; + u32 rem; + + val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem); + val->tv_nsec = rem; } /* @@ -83,15 +91,17 @@ static inline cputime_t timeval_to_cputime(const struct timeval *val) } static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) { - val->tv_sec = (__force u64) ct / NSEC_PER_SEC; - val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC; + u32 rem; + + val->tv_sec = cputime_div_rem(ct, NSEC_PER_SEC, &rem); + val->tv_usec = rem / NSEC_PER_USEC; } /* * Convert cputime <-> clock (USER_HZ) */ #define cputime_to_clock_t(__ct) \ - ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ)) + cputime_div(__ct, (NSEC_PER_SEC / USER_HZ)) #define clock_t_to_cputime(__x) \ (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ)) -- 1.8.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers 2013-03-20 23:34 ` [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers Kevin Hilman @ 2013-04-11 17:10 ` Frederic Weisbecker 2013-04-15 14:02 ` Kevin Hilman 0 siblings, 1 reply; 10+ messages in thread From: Frederic Weisbecker @ 2013-04-11 17:10 UTC (permalink / raw) To: linux-arm-kernel On Wed, Mar 20, 2013 at 04:34:25PM -0700, Kevin Hilman wrote: > For the nsec resolution conversions to be useable on non 64-bit > architectures, the helpers in <linux/math64.h> need to be used so the > right arch-specific 64-bit math helpers can be used (e.g. do_div()) > > Cc: Frederic Weisbecker <fweisbec@gmail.com> > Signed-off-by: Kevin Hilman <khilman@linaro.org> Ok the patch is nice! I'm queuing it. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers 2013-04-11 17:10 ` Frederic Weisbecker @ 2013-04-15 14:02 ` Kevin Hilman 2013-04-15 14:08 ` Frederic Weisbecker 0 siblings, 1 reply; 10+ messages in thread From: Kevin Hilman @ 2013-04-15 14:02 UTC (permalink / raw) To: linux-arm-kernel Frederic Weisbecker <fweisbec@gmail.com> writes: > On Wed, Mar 20, 2013 at 04:34:25PM -0700, Kevin Hilman wrote: >> For the nsec resolution conversions to be useable on non 64-bit >> architectures, the helpers in <linux/math64.h> need to be used so the >> right arch-specific 64-bit math helpers can be used (e.g. do_div()) >> >> Cc: Frederic Weisbecker <fweisbec@gmail.com> >> Signed-off-by: Kevin Hilman <khilman@linaro.org> > > Ok the patch is nice! > > I'm queuing it. Thanks, did you queue PATCH 3/3 also to remove the 64-bit limitation from VIRT_CPU_ACCOUNTING_GEN: https://lkml.org/lkml/2013/3/20/656 Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers 2013-04-15 14:02 ` Kevin Hilman @ 2013-04-15 14:08 ` Frederic Weisbecker 0 siblings, 0 replies; 10+ messages in thread From: Frederic Weisbecker @ 2013-04-15 14:08 UTC (permalink / raw) To: linux-arm-kernel 2013/4/15 Kevin Hilman <khilman@linaro.org>: > Frederic Weisbecker <fweisbec@gmail.com> writes: > >> On Wed, Mar 20, 2013 at 04:34:25PM -0700, Kevin Hilman wrote: >>> For the nsec resolution conversions to be useable on non 64-bit >>> architectures, the helpers in <linux/math64.h> need to be used so the >>> right arch-specific 64-bit math helpers can be used (e.g. do_div()) >>> >>> Cc: Frederic Weisbecker <fweisbec@gmail.com> >>> Signed-off-by: Kevin Hilman <khilman@linaro.org> >> >> Ok the patch is nice! >> >> I'm queuing it. > > Thanks, did you queue PATCH 3/3 also to remove the 64-bit limitation > from VIRT_CPU_ACCOUNTING_GEN: https://lkml.org/lkml/2013/3/20/656 Not yet, for this one I need to deeply check we haven't forgotten anything concerning cputime_t operations in 32 bits archs. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/3] init/Kconfig: virt CPU accounting: drop 64-bit requirment 2013-03-20 23:34 [PATCH 0/3] ARM: context tracking support prerequisites Kevin Hilman 2013-03-20 23:34 ` [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers Kevin Hilman @ 2013-03-20 23:34 ` Kevin Hilman 2013-03-20 23:34 ` [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting Kevin Hilman 2 siblings, 0 replies; 10+ messages in thread From: Kevin Hilman @ 2013-03-20 23:34 UTC (permalink / raw) To: linux-arm-kernel The 64-bit requirement can be removed after the conversion of the conversion of the nsec granularity cputime to work on !64_BIT Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Kevin Hilman <khilman@linaro.org> --- init/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/Kconfig b/init/Kconfig index 8a1dac2..1f1a328 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -329,7 +329,7 @@ config VIRT_CPU_ACCOUNTING_NATIVE config VIRT_CPU_ACCOUNTING_GEN bool "Full dynticks CPU time accounting" - depends on HAVE_CONTEXT_TRACKING && 64BIT + depends on HAVE_CONTEXT_TRACKING select VIRT_CPU_ACCOUNTING select CONTEXT_TRACKING help -- 1.8.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting 2013-03-20 23:34 [PATCH 0/3] ARM: context tracking support prerequisites Kevin Hilman 2013-03-20 23:34 ` [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers Kevin Hilman 2013-03-20 23:34 ` [PATCH 2/3] init/Kconfig: virt CPU accounting: drop 64-bit requirment Kevin Hilman @ 2013-03-20 23:34 ` Kevin Hilman 2 siblings, 0 replies; 10+ messages in thread From: Kevin Hilman @ 2013-03-20 23:34 UTC (permalink / raw) To: linux-arm-kernel With the 64-bit requirement removed from virt CPU accounting, allow ARM platforms to enable it. Signed-off-by: Kevin Hilman <khilman@linaro.org> --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5b71469..9473d55 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -59,6 +59,7 @@ config ARM select CLONE_BACKWARDS select OLD_SIGSUSPEND3 select OLD_SIGACTION + select HAVE_VIRT_CPU_ACCOUNTING help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and -- 1.8.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 0/3] nohz/full: final Kconfig bits for ARM support @ 2013-07-03 18:36 Kevin Hilman 2013-07-03 18:36 ` [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting Kevin Hilman 0 siblings, 1 reply; 10+ messages in thread From: Kevin Hilman @ 2013-07-03 18:36 UTC (permalink / raw) To: linux-arm-kernel As of v3.10, the core ARM support is in mainline for NO_HZ_FULL. The only remaining part is the removal of the hard-coded Kconfig requirement on 64-bit platforms, which I believe can now be removed after the nsec granularity cputime was made to work on non 64_BIT (c.f. commit 8c23b80e, cputime_nsecs: use math64.h for nsec resolution conversion helpers.) This series makes the final Kconfig changes to bring NO_HZ_FULL support to ARM. Series applies to v3.10. I will queue up the arch/arm patch for Russell separately once the generic changes are accepted. Kevin arch/arm/Kconfig | 1 + init/Kconfig | 2 +- kernel/time/Kconfig | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) -- 1.8.3 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting 2013-07-03 18:36 [PATCH 0/3] nohz/full: final Kconfig bits for ARM support Kevin Hilman @ 2013-07-03 18:36 ` Kevin Hilman 2013-07-19 16:17 ` Frederic Weisbecker 0 siblings, 1 reply; 10+ messages in thread From: Kevin Hilman @ 2013-07-03 18:36 UTC (permalink / raw) To: linux-arm-kernel With the 64-bit requirement removed from virt CPU accounting, allow ARM platforms to enable it. Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Kevin Hilman <khilman@linaro.org> --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 136f263..7850612 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -61,6 +61,7 @@ config ARM select OLD_SIGSUSPEND3 select OLD_SIGACTION select HAVE_CONTEXT_TRACKING + select HAVE_VIRT_CPU_ACCOUNTING help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and -- 1.8.3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting 2013-07-03 18:36 ` [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting Kevin Hilman @ 2013-07-19 16:17 ` Frederic Weisbecker 2013-08-02 0:29 ` Kevin Hilman 0 siblings, 1 reply; 10+ messages in thread From: Frederic Weisbecker @ 2013-07-19 16:17 UTC (permalink / raw) To: linux-arm-kernel On Wed, Jul 03, 2013 at 11:36:41AM -0700, Kevin Hilman wrote: > With the 64-bit requirement removed from virt CPU accounting, > allow ARM platforms to enable it. > > Cc: Russell King <rmk+kernel@arm.linux.org.uk> > Signed-off-by: Kevin Hilman <khilman@linaro.org> > --- > arch/arm/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index 136f263..7850612 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -61,6 +61,7 @@ config ARM > select OLD_SIGSUSPEND3 > select OLD_SIGACTION > select HAVE_CONTEXT_TRACKING > + select HAVE_VIRT_CPU_ACCOUNTING I think you got confused here. HAVE_VIRT_CPU_ACCOUNTING is the arch capability for VIRT_CPU_ACCOUNTING_NATIVE, not for VIRT_CPU_ACCOUNTING_GEN that only requires support for context tracking. That's my bad, all those names start to be confusing now. The VIRT based Kconfig naming is a bit weird, that doesn't really reflect what the feature is doing. "Virtual cputime accounting" just doesn't give any clue, except perhaps suggesting the stuff deals with virtualization while it actually has nothing to do with. I don't even know what virtual refers to here. Same goes for vtime based APIs. In fact I just based my work on the legacy that was there and expanded further the non-sense ;-) I'll need to do a big renaming one day. But to begin with I should rename s/HAVE_VIRT_CPU_ACCOUNTING/HAVE_VIRT_CPU_ACCOUNTING_NATIVE. > help > The ARM series is a line of low-power-consumption RISC chip designs > licensed by ARM Ltd and targeted at embedded applications and > -- > 1.8.3 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting 2013-07-19 16:17 ` Frederic Weisbecker @ 2013-08-02 0:29 ` Kevin Hilman 0 siblings, 0 replies; 10+ messages in thread From: Kevin Hilman @ 2013-08-02 0:29 UTC (permalink / raw) To: linux-arm-kernel Frederic Weisbecker <fweisbec@gmail.com> writes: > On Wed, Jul 03, 2013 at 11:36:41AM -0700, Kevin Hilman wrote: >> With the 64-bit requirement removed from virt CPU accounting, >> allow ARM platforms to enable it. >> >> Cc: Russell King <rmk+kernel@arm.linux.org.uk> >> Signed-off-by: Kevin Hilman <khilman@linaro.org> >> --- >> arch/arm/Kconfig | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig >> index 136f263..7850612 100644 >> --- a/arch/arm/Kconfig >> +++ b/arch/arm/Kconfig >> @@ -61,6 +61,7 @@ config ARM >> select OLD_SIGSUSPEND3 >> select OLD_SIGACTION >> select HAVE_CONTEXT_TRACKING >> + select HAVE_VIRT_CPU_ACCOUNTING > > I think you got confused here. HAVE_VIRT_CPU_ACCOUNTING is the arch capability > for VIRT_CPU_ACCOUNTING_NATIVE, not for VIRT_CPU_ACCOUNTING_GEN that only requires > support for context tracking. Yes, I am confused. :/ > That's my bad, all those names start to be confusing now. > The VIRT based Kconfig naming is a bit weird, that doesn't really reflect what the feature > is doing. "Virtual cputime accounting" just doesn't give any clue, except perhaps suggesting > the stuff deals with virtualization while it actually has nothing to do with. > I don't even know what virtual refers to here. > > Same goes for vtime based APIs. In fact I just based my work on the legacy that was > there and expanded further the non-sense ;-) > > I'll need to do a big renaming one day. > > But to begin with I should rename s/HAVE_VIRT_CPU_ACCOUNTING/HAVE_VIRT_CPU_ACCOUNTING_NATIVE. OK, I just tested and I can indeed drop this patch. Thanks for clarifying, Kevin ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-08-02 0:29 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-03-20 23:34 [PATCH 0/3] ARM: context tracking support prerequisites Kevin Hilman 2013-03-20 23:34 ` [PATCH 1/3] cputime_nsecs: use math64.h for nsec resolution conversion helpers Kevin Hilman 2013-04-11 17:10 ` Frederic Weisbecker 2013-04-15 14:02 ` Kevin Hilman 2013-04-15 14:08 ` Frederic Weisbecker 2013-03-20 23:34 ` [PATCH 2/3] init/Kconfig: virt CPU accounting: drop 64-bit requirment Kevin Hilman 2013-03-20 23:34 ` [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting Kevin Hilman 2013-07-03 18:36 [PATCH 0/3] nohz/full: final Kconfig bits for ARM support Kevin Hilman 2013-07-03 18:36 ` [PATCH 3/3] ARM: Kconfig: allow virt CPU accounting Kevin Hilman 2013-07-19 16:17 ` Frederic Weisbecker 2013-08-02 0:29 ` Kevin Hilman
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).