Re: [PATCH 3/5] cputime: allow irq time accounting to be selected as an option
Hi, [auto build test WARNING on tip/sched/core] [also build test WARNING on next-20160624] [cannot apply to v4.7-rc4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/riel-redhat-com/sched-time-fix-irq-time-accounting-with-nohz_idle/20160623-102923 config: x86_64-randconfig-a0-06260951 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from include/linux/sched.h:17:0, from kernel/sched/cputime.c:2: kernel/sched/cputime.c: In function 'irqtime_account_hi_update': include/linux/kernel.h:742:17: warning: comparison of distinct pointer types lacks a cast (void) (&_min1 == &_min2); \ ^ >> kernel/sched/cputime.c:92:17: note: in expansion of macro 'min' irq_jiffies = min(max_jiffies, cputime_to_jiffies(irq)); ^~~ kernel/sched/cputime.c: In function 'irqtime_account_si_update': include/linux/kernel.h:742:17: warning: comparison of distinct pointer types lacks a cast (void) (&_min1 == &_min2); \ ^ kernel/sched/cputime.c:109:16: note: in expansion of macro 'min' si_jiffies = min(max_jiffies, cputime_to_jiffies(softirq)); ^~~ vim +/min +92 kernel/sched/cputime.c 73fbec604 Frederic Weisbecker 2012-06-16 1 #include 73fbec604 Frederic Weisbecker 2012-06-16 @2 #include 73fbec604 Frederic Weisbecker 2012-06-16 3 #include 73fbec604 Frederic Weisbecker 2012-06-16 4 #include 73fbec604 Frederic Weisbecker 2012-06-16 5 #include abf917cd9 Frederic Weisbecker 2012-07-25 6 #include 73fbec604 Frederic Weisbecker 2012-06-16 7 #include "sched.h" 1fe7c4ef8 Stefano Stabellini 2015-11-10 8 #ifdef CONFIG_PARAVIRT 1fe7c4ef8 Stefano Stabellini 2015-11-10 9 #include 1fe7c4ef8 Stefano Stabellini 2015-11-10 10 #endif 73fbec604 Frederic Weisbecker 2012-06-16 11 73fbec604 Frederic Weisbecker 2012-06-16 12 73fbec604 Frederic Weisbecker 2012-06-16 13 #ifdef CONFIG_IRQ_TIME_ACCOUNTING 73fbec604 Frederic Weisbecker 2012-06-16 14 73fbec604 Frederic Weisbecker 2012-06-16 15 /* 73fbec604 Frederic Weisbecker 2012-06-16 16 * There are no locks covering percpu hardirq/softirq time. bf9fae9f5 Frederic Weisbecker 2012-09-08 17 * They are only modified in vtime_account, on corresponding CPU 73fbec604 Frederic Weisbecker 2012-06-16 18 * with interrupts disabled. So, writes are safe. 73fbec604 Frederic Weisbecker 2012-06-16 19 * They are read and saved off onto struct rq in update_rq_clock(). 73fbec604 Frederic Weisbecker 2012-06-16 20 * This may result in other CPU reading this CPU's irq time and can bf9fae9f5 Frederic Weisbecker 2012-09-08 21 * race with irq/vtime_account on this CPU. We would either get old 73fbec604 Frederic Weisbecker 2012-06-16 22 * or new value with a side effect of accounting a slice of irq time to wrong 73fbec604 Frederic Weisbecker 2012-06-16 23 * task when irq is in progress while we read rq->clock. That is a worthy 73fbec604 Frederic Weisbecker 2012-06-16 24 * compromise in place of having locks on each irq in account_system_time. 73fbec604 Frederic Weisbecker 2012-06-16 25 */ 73fbec604 Frederic Weisbecker 2012-06-16 26 DEFINE_PER_CPU(u64, cpu_hardirq_time); 73fbec604 Frederic Weisbecker 2012-06-16 27 DEFINE_PER_CPU(u64, cpu_softirq_time); 73fbec604 Frederic Weisbecker 2012-06-16 28 73fbec604 Frederic Weisbecker 2012-06-16 29 static DEFINE_PER_CPU(u64, irq_start_time); 73fbec604 Frederic Weisbecker 2012-06-16 30 static int sched_clock_irqtime; 73fbec604 Frederic Weisbecker 2012-06-16 31 73fbec604 Frederic Weisbecker 2012-06-16 32 void enable_sched_clock_irqtime(void) 73fbec604 Frederic Weisbecker 2012-06-16 33 { 73fbec604 Frederic Weisbecker 2012-06-16 34sched_clock_irqtime = 1; 73fbec604 Frederic Weisbecker 2012-06-16 35 } 73fbec604 Frederic Weisbecker 2012-06-16 36 73fbec604 Frederic Weisbecker 2012-06-16 37 void disable_sched_clock_irqtime(void) 73fbec604 Frederic Weisbecker 2012-06-16 38 { 73fbec604 Frederic Weisbecker 2012-06-16 39sched_clock_irqtime = 0; 73fbec604 Frederic Weisbecker 2012-06-16 40 } 73fbec604 Frederic Weisbecker 2012-06-16 41 73fbec604 Frederic Weisbecker 2012-06-16 42 #ifndef CONFIG_64BIT 73fbec604 Frederic Weisbecker 2012-06-16 43 DEFINE_PER_CPU(seqcount_t, irq_time_seq); 73fbec604 Frederic Weisbecker 2012-06-16 44 #endif /* CONFIG_64BIT */ 73fbec604 Frederic Weisbecker 2012-06-16 45 73fbec604 Frederic Weisbecker 2012-06-16 46 /* 73fbec604 Frederic Weisbecker 2012-06-16 47 * Called before incrementing preempt_count on {soft,}irq_enter 73fbec604 Frederic Weisbecker 2012-06-16 48 * and before decrementing preempt_count on {soft,}irq_exit.
Re: [PATCH 3/5] cputime: allow irq time accounting to be selected as an option
Hi, [auto build test WARNING on tip/sched/core] [also build test WARNING on next-20160624] [cannot apply to v4.7-rc4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/riel-redhat-com/sched-time-fix-irq-time-accounting-with-nohz_idle/20160623-102923 config: x86_64-randconfig-a0-06260951 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from include/linux/sched.h:17:0, from kernel/sched/cputime.c:2: kernel/sched/cputime.c: In function 'irqtime_account_hi_update': include/linux/kernel.h:742:17: warning: comparison of distinct pointer types lacks a cast (void) (&_min1 == &_min2); \ ^ >> kernel/sched/cputime.c:92:17: note: in expansion of macro 'min' irq_jiffies = min(max_jiffies, cputime_to_jiffies(irq)); ^~~ kernel/sched/cputime.c: In function 'irqtime_account_si_update': include/linux/kernel.h:742:17: warning: comparison of distinct pointer types lacks a cast (void) (&_min1 == &_min2); \ ^ kernel/sched/cputime.c:109:16: note: in expansion of macro 'min' si_jiffies = min(max_jiffies, cputime_to_jiffies(softirq)); ^~~ vim +/min +92 kernel/sched/cputime.c 73fbec604 Frederic Weisbecker 2012-06-16 1 #include 73fbec604 Frederic Weisbecker 2012-06-16 @2 #include 73fbec604 Frederic Weisbecker 2012-06-16 3 #include 73fbec604 Frederic Weisbecker 2012-06-16 4 #include 73fbec604 Frederic Weisbecker 2012-06-16 5 #include abf917cd9 Frederic Weisbecker 2012-07-25 6 #include 73fbec604 Frederic Weisbecker 2012-06-16 7 #include "sched.h" 1fe7c4ef8 Stefano Stabellini 2015-11-10 8 #ifdef CONFIG_PARAVIRT 1fe7c4ef8 Stefano Stabellini 2015-11-10 9 #include 1fe7c4ef8 Stefano Stabellini 2015-11-10 10 #endif 73fbec604 Frederic Weisbecker 2012-06-16 11 73fbec604 Frederic Weisbecker 2012-06-16 12 73fbec604 Frederic Weisbecker 2012-06-16 13 #ifdef CONFIG_IRQ_TIME_ACCOUNTING 73fbec604 Frederic Weisbecker 2012-06-16 14 73fbec604 Frederic Weisbecker 2012-06-16 15 /* 73fbec604 Frederic Weisbecker 2012-06-16 16 * There are no locks covering percpu hardirq/softirq time. bf9fae9f5 Frederic Weisbecker 2012-09-08 17 * They are only modified in vtime_account, on corresponding CPU 73fbec604 Frederic Weisbecker 2012-06-16 18 * with interrupts disabled. So, writes are safe. 73fbec604 Frederic Weisbecker 2012-06-16 19 * They are read and saved off onto struct rq in update_rq_clock(). 73fbec604 Frederic Weisbecker 2012-06-16 20 * This may result in other CPU reading this CPU's irq time and can bf9fae9f5 Frederic Weisbecker 2012-09-08 21 * race with irq/vtime_account on this CPU. We would either get old 73fbec604 Frederic Weisbecker 2012-06-16 22 * or new value with a side effect of accounting a slice of irq time to wrong 73fbec604 Frederic Weisbecker 2012-06-16 23 * task when irq is in progress while we read rq->clock. That is a worthy 73fbec604 Frederic Weisbecker 2012-06-16 24 * compromise in place of having locks on each irq in account_system_time. 73fbec604 Frederic Weisbecker 2012-06-16 25 */ 73fbec604 Frederic Weisbecker 2012-06-16 26 DEFINE_PER_CPU(u64, cpu_hardirq_time); 73fbec604 Frederic Weisbecker 2012-06-16 27 DEFINE_PER_CPU(u64, cpu_softirq_time); 73fbec604 Frederic Weisbecker 2012-06-16 28 73fbec604 Frederic Weisbecker 2012-06-16 29 static DEFINE_PER_CPU(u64, irq_start_time); 73fbec604 Frederic Weisbecker 2012-06-16 30 static int sched_clock_irqtime; 73fbec604 Frederic Weisbecker 2012-06-16 31 73fbec604 Frederic Weisbecker 2012-06-16 32 void enable_sched_clock_irqtime(void) 73fbec604 Frederic Weisbecker 2012-06-16 33 { 73fbec604 Frederic Weisbecker 2012-06-16 34sched_clock_irqtime = 1; 73fbec604 Frederic Weisbecker 2012-06-16 35 } 73fbec604 Frederic Weisbecker 2012-06-16 36 73fbec604 Frederic Weisbecker 2012-06-16 37 void disable_sched_clock_irqtime(void) 73fbec604 Frederic Weisbecker 2012-06-16 38 { 73fbec604 Frederic Weisbecker 2012-06-16 39sched_clock_irqtime = 0; 73fbec604 Frederic Weisbecker 2012-06-16 40 } 73fbec604 Frederic Weisbecker 2012-06-16 41 73fbec604 Frederic Weisbecker 2012-06-16 42 #ifndef CONFIG_64BIT 73fbec604 Frederic Weisbecker 2012-06-16 43 DEFINE_PER_CPU(seqcount_t, irq_time_seq); 73fbec604 Frederic Weisbecker 2012-06-16 44 #endif /* CONFIG_64BIT */ 73fbec604 Frederic Weisbecker 2012-06-16 45 73fbec604 Frederic Weisbecker 2012-06-16 46 /* 73fbec604 Frederic Weisbecker 2012-06-16 47 * Called before incrementing preempt_count on {soft,}irq_enter 73fbec604 Frederic Weisbecker 2012-06-16 48 * and before decrementing preempt_count on {soft,}irq_exit.
[PATCH 3/5] cputime: allow irq time accounting to be selected as an option
From: Rik van RielAllow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?). This allows for the irq time accounting code to be used with nohz_idle CPUs, which is how several distributions ship their kernels. Using the same code for several timer modes also allows us to drop duplicate code. Signed-off-by: Rik van Riel --- init/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 0dfd09d54c65..4c7ee4f136cf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN If unsure, say N. +endchoice + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL + depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. -endchoice - config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER -- 2.5.5
[PATCH 3/5] cputime: allow irq time accounting to be selected as an option
From: Rik van Riel Allow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?). This allows for the irq time accounting code to be used with nohz_idle CPUs, which is how several distributions ship their kernels. Using the same code for several timer modes also allows us to drop duplicate code. Signed-off-by: Rik van Riel --- init/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 0dfd09d54c65..4c7ee4f136cf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN If unsure, say N. +endchoice + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL + depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. -endchoice - config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER -- 2.5.5
[PATCH 3/5] cputime: allow irq time accounting to be selected as an option
From: Rik van RielAllow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?). This allows for the irq time accounting code to be used with nohz_idle CPUs, which is how several distributions ship their kernels. Using the same code for several timer modes also allows us to drop duplicate code. Signed-off-by: Rik van Riel --- init/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 0dfd09d54c65..4c7ee4f136cf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN If unsure, say N. +endchoice + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL + depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. -endchoice - config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER -- 2.5.5
[PATCH 3/5] cputime: allow irq time accounting to be selected as an option
From: Rik van Riel Allow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?). This allows for the irq time accounting code to be used with nohz_idle CPUs, which is how several distributions ship their kernels. Using the same code for several timer modes also allows us to drop duplicate code. Signed-off-by: Rik van Riel --- init/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 0dfd09d54c65..4c7ee4f136cf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN If unsure, say N. +endchoice + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL + depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. -endchoice - config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER -- 2.5.5
[PATCH 3/5] cputime: allow irq time accounting to be selected as an option
From: Rik van RielAllow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?). This allows for the irq time accounting code to be used with nohz_idle CPUs, which is how several distributions ship their kernels. Using the same code for several timer modes also allows us to drop duplicate code. Signed-off-by: Rik van Riel --- init/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 0dfd09d54c65..4c7ee4f136cf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN If unsure, say N. +endchoice + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL + depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. -endchoice - config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER -- 2.5.5
[PATCH 3/5] cputime: allow irq time accounting to be selected as an option
From: Rik van Riel Allow CONFIG_IRQ_TIME_ACCOUNTING to be selected as an option, on top of CONFIG_VIRT_CPU_ACCOUNTING_GEN (and potentially others?). This allows for the irq time accounting code to be used with nohz_idle CPUs, which is how several distributions ship their kernels. Using the same code for several timer modes also allows us to drop duplicate code. Signed-off-by: Rik van Riel --- init/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 0dfd09d54c65..4c7ee4f136cf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -375,9 +375,11 @@ config VIRT_CPU_ACCOUNTING_GEN If unsure, say N. +endchoice + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL + depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -386,8 +388,6 @@ config IRQ_TIME_ACCOUNTING If in doubt, say N here. -endchoice - config BSD_PROCESS_ACCT bool "BSD Process Accounting" depends on MULTIUSER -- 2.5.5