x86: Distinguish TLB shootdown interrupts from other functions call interrupts
Hi Alex,
Quoted 13 lines · Alex Shi
Quoted 11 lines · Alex Shi
Quoted 5 lines · Tomoki Sekiyama
unsigned int irq_resched_count; unsigned int irq_call_count;(quoted diff) +2
-0+ /* irq_tlb_count is double-counted in irq_call_count, so it must be + subtracted from irq_call_count when displaying irq_call_count */unsigned int irq_tlb_count;Review again this patch, above comments is not kernel compatible format. Could you change it like standard comment format:
Quoted 8 lines
Quoted 5 lines
/*
* xxxxxxx
* xxxx
*/the 3.6 kernel will closed soon. it will be great to has this patch in. So, could you like to refresh your patch with popular comments format? :)
Fixed patch is below.
Thank you for the review again.
--
As TLB shootdown requests to other CPU cores are now using function call interrupts, TLB shootdowns entry in /proc/interrupts is always shown as 0.
This behavior change was introduced by commit 52aec3308db8 ("x86/tlb:
replace INVALIDATE_TLB_VECTOR by CALL_FUNCTION_VECTOR").
This patch reverts TLB shootdowns entry in /proc/interrupts to count TLB shootdowns separately from the other function call interrupts.
--- arch/x86/include/asm/hardirq.h | 4 ++++ arch/x86/kernel/irq.c | 4 ++-- arch/x86/mm/tlb.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-)
arch/x86/include/asm/hardirq.h +4 -0
@@ -18,6 +18,10 @@ typedef struct {#ifdef CONFIG_SMP unsigned int irq_resched_count;unsigned int irq_call_count; +/* +* irq_tlb_count is double-counted in irq_call_count, so it must be +* subtracted from irq_call_count when displaying irq_call_count +*/ unsigned int irq_tlb_count;#endif #ifdef CONFIG_X86_THERMAL_VECTOR
arch/x86/kernel/irq.c +2 -2
@@ -92,7 +92,8 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p," Rescheduling interrupts\n" );seq_printf (p,"%*s: " , prec,"CAL" );for_each_online_cpu (j) -seq_printf (p,"%10u " ,irq_stats (j)->irq_call_count); +seq_printf (p,"%10u " ,irq_stats (j)->irq_call_count - +irq_stats (j)->irq_tlb_count);seq_printf (p," Function call interrupts\n" );seq_printf (p,"%*s: " , prec,"TLB" );for_each_online_cpu (j)
@@ -147,7 +148,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)#ifdef CONFIG_SMP sum +=irq_stats (cpu)->irq_resched_count; sum +=irq_stats (cpu)->irq_call_count; - sum +=irq_stats (cpu)->irq_tlb_count;#endif #ifdef CONFIG_X86_THERMAL_VECTOR sum +=irq_stats (cpu)->irq_thermal_count;
arch/x86/mm/tlb.c +2 -0
@@ -98,6 +98,8 @@ static void flush_tlb_func(void *info) {struct flush_tlb_info *f = info; +inc_irq_stat (irq_tlb_count); +if (f->flush_mm !=this_cpu_read (cpu_tlbstate.active_mm))return ;
Alex Shi
Acked-byQuoted 22 lines · Tomoki Sekiyama
Hi Alex,
Quoted 19 lines · Alex Shi
Quoted 16 lines · Alex Shi
Quoted 5 lines · Tomoki Sekiyama
unsigned int irq_resched_count; unsigned int irq_call_count;(quoted diff) +2
-0+ /* irq_tlb_count is double-counted in irq_call_count, so it must be + subtracted from irq_call_count when displaying irq_call_count */unsigned int irq_tlb_count;Review again this patch, above comments is not kernel compatible format. Could you change it like standard comment format:
/*
* xxxxxxx
* xxxx
*/
Quoted 6 lines
Quoted 2 lines
the 3.6 kernel will closed soon. it will be great to has this patch in. So, could you like to refresh your patch with popular comments format? :)
Fixed patch is below.
Thank you for the review again.
Quoted 72 lines
--
As TLB shootdown requests to other CPU cores are now using function call interrupts, TLB shootdowns entry in/proc/interruptsis always shown as 0.This behavior change was introduced by commit
52aec3308db8("x86/tlb:
replaceINVALIDATE_TLB_VECTORbyCALL_FUNCTION_VECTOR").This patch reverts TLB shootdowns entry in
/proc/interruptsto count TLB shootdowns separately from the other function call interrupts.Signed-off-by Tomoki Sekiyama <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Alex Shi <[email protected]>--- arch/x86/include/asm/hardirq.h | 4 ++++ arch/x86/kernel/irq.c | 4 ++-- arch/x86/mm/tlb.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-)arch/x86/include/asm/hardirq.h +4
-0@@ -18,6 +18,10 @@ typedef struct {#ifdef CONFIG_SMP unsigned int irq_resched_count;unsigned int irq_call_count; +/* +* irq_tlb_count is double-counted in irq_call_count, so it must be +* subtracted from irq_call_count when displaying irq_call_count +*/ unsigned int irq_tlb_count;#endif #ifdef CONFIG_X86_THERMAL_VECTOR arch/x86/kernel/irq.c +2
-2@@ -92,7 +92,8 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p," Rescheduling interrupts\n" );seq_printf (p,"%*s: " , prec,"CAL" );for_each_online_cpu (j) -seq_printf (p,"%10u " ,irq_stats (j)->irq_call_count); +seq_printf (p,"%10u " ,irq_stats (j)->irq_call_count - +irq_stats (j)->irq_tlb_count);seq_printf (p," Function call interrupts\n" );seq_printf (p,"%*s: " , prec,"TLB" );for_each_online_cpu (j)@@ -147,7 +148,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)#ifdef CONFIG_SMP sum +=irq_stats (cpu)->irq_resched_count; sum +=irq_stats (cpu)->irq_call_count; - sum +=irq_stats (cpu)->irq_tlb_count;#endif #ifdef CONFIG_X86_THERMAL_VECTOR sum +=irq_stats (cpu)->irq_thermal_count;arch/x86/mm/tlb.c +2
-0@@ -98,6 +98,8 @@ static void flush_tlb_func(void *info) {struct flush_tlb_info *f = info; +inc_irq_stat (irq_tlb_count); +if (f->flush_mm !=this_cpu_read (cpu_tlbstate.active_mm))return ;
Signature · 2 lines
Thanks
AlexQuoted 8 lines
Quoted 4 lines
the 3.6 kernel will closed soon. it will be great to has this patch in. So, could you like to refresh your patch with popular comments format? :)
Fixed patch is below.
Thank you for the review again.
Peter:
Maybe the patch doesn't looks perfect for this issue.
So I am wondering if the following patch is better, if we don't care the irq_tlb was counted again in irq_call?
===
arch/x86/mm/tlb.c +2 -0
@@ -98,6 +98,8 @@ static void flush_tlb_func(void *info) {struct flush_tlb_info *f = info; +inc_irq_stat (irq_tlb_count); +if (f->flush_mm !=this_cpu_read (cpu_tlbstate.active_mm))return ;
===
Or another solution is also reducing double counted irq_tlb_count from irq_call_count What's your comments of this?
===
arch/x86/include/asm/hardirq.h +1 -0
@@ -36,6 +36,7 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);#define __ARCH_IRQ_STAT#define inc_irq_stat (member) this_cpu_inc(irq_stat.member) +#define dec_irq_stat (member) this_cpu_dec(irq_stat.member)#define local_softirq_pending () this_cpu_read(irq_stat.__softirq_pending)
arch/x86/mm/tlb.c +4 -0
@@ -98,6 +98,10 @@ static void flush_tlb_func(void *info) {struct flush_tlb_info *f = info; +/* remove double counted irq_tlb_count from irq_call_count */ +dec_irq_stat (irq_call_count); +inc_irq_stat (irq_tlb_count); +if (f->flush_mm !=this_cpu_read (cpu_tlbstate.active_mm))return ;
===
Thanks
Alex
H. Peter Anvin
reviewerQuoted 7 lines · Alex Shi
Peter:
Maybe the patch doesn't looks perfect for this issue.
So I am wondering if the following patch is better, if we don't care theirq_tlbwas counted again inirq_call?
Tomoki-san's patch looked sane to me, I should just apply it.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Alex Shi
Peter:
Maybe the patch doesn't looks perfect for this issue.
So I am wondering if the following patch is better, if we don't care theirq_tlb
was counted again inirq_call?
Quoted 4 lines
Tomoki-san's patch looked sane to me, I should just apply it.
-hpa
Glad to see this! :)
Signature · 2 lines
Thanks
AlexCommit-ID: fd0f5869724ff6195c6e7f12f8287c66a132e0ba Gitweb: http://git.kernel.org/tip/fd0f5869724ff6195c6e7f12f8287c66a132e0ba Author: Tomoki Sekiyama <[email protected]> AuthorDate: Wed, 26 Sep 2012 11:11:28 +0900 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 27 Sep 2012 22:52:34 -0700
x86: Distinguish TLB shootdown interrupts from other functions call interrupts
As TLB shootdown requests to other CPU cores are now using function call interrupts, TLB shootdowns entry in /proc/interrupts is always shown as 0.
This behavior change was introduced by commit 52aec3308db8 ("x86/tlb:
replace INVALIDATE_TLB_VECTOR by CALL_FUNCTION_VECTOR").
This patch reverts TLB shootdowns entry in /proc/interrupts to count TLB shootdowns separately from the other function call interrupts.
--- arch/x86/include/asm/hardirq.h | 4 ++++ arch/x86/kernel/irq.c | 4 ++-- arch/x86/mm/tlb.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-)
arch/x86/include/asm/hardirq.h +4 -0
@@ -18,6 +18,10 @@ typedef struct {#ifdef CONFIG_SMP unsigned int irq_resched_count;unsigned int irq_call_count; +/* +* irq_tlb_count is double-counted in irq_call_count, so it must be +* subtracted from irq_call_count when displaying irq_call_count +*/ unsigned int irq_tlb_count;#endif #ifdef CONFIG_X86_THERMAL_VECTOR
arch/x86/kernel/irq.c +2 -2
@@ -92,7 +92,8 @@ int arch_show_interrupts(struct seq_file *p, int prec)seq_printf (p," Rescheduling interrupts\n" );seq_printf (p,"%*s: " , prec,"CAL" );for_each_online_cpu (j) -seq_printf (p,"%10u " ,irq_stats (j)->irq_call_count); +seq_printf (p,"%10u " ,irq_stats (j)->irq_call_count - +irq_stats (j)->irq_tlb_count);seq_printf (p," Function call interrupts\n" );seq_printf (p,"%*s: " , prec,"TLB" );for_each_online_cpu (j)
@@ -147,7 +148,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)#ifdef CONFIG_SMP sum +=irq_stats (cpu)->irq_resched_count; sum +=irq_stats (cpu)->irq_call_count; - sum +=irq_stats (cpu)->irq_tlb_count;#endif #ifdef CONFIG_X86_THERMAL_VECTOR sum +=irq_stats (cpu)->irq_thermal_count;
arch/x86/mm/tlb.c +2 -0
@@ -98,6 +98,8 @@ static void flush_tlb_func(void *info) {struct flush_tlb_info *f = info; +inc_irq_stat (irq_tlb_count); +if (f->flush_mm !=this_cpu_read (cpu_tlbstate.active_mm))return ;