* [PATCH] powerpc: Add accounting for Doorbell interrupts
@ 2013-03-20 7:42 Ian Munsie
2013-03-21 0:28 ` Michael Neuling
2013-03-22 4:18 ` Michael Ellerman
0 siblings, 2 replies; 5+ messages in thread
From: Ian Munsie @ 2013-03-20 7:42 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie
From: Ian Munsie <imunsie@au1.ibm.com>
This patch adds a new line to /proc/interrupts to account for the
doorbell interrupts that each hardware thread has received. The total
interrupt count in /proc/stat will now also include doorbells.
# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
16: 551 1267 281 175 XICS Level IPI
LOC: 2037 1503 1688 1625 Local timer interrupts
SPU: 0 0 0 0 Spurious interrupts
CNT: 0 0 0 0 Performance monitoring interrupts
MCE: 0 0 0 0 Machine check exceptions
DBL: 42 550 20 91 Doorbell interrupts
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
arch/powerpc/include/asm/hardirq.h | 1 +
arch/powerpc/kernel/dbell.c | 2 ++
arch/powerpc/kernel/irq.c | 8 ++++++++
3 files changed, 11 insertions(+)
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 3147a29..e88c5f2 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -10,6 +10,7 @@ typedef struct {
unsigned int pmu_irqs;
unsigned int mce_exceptions;
unsigned int spurious_irqs;
+ unsigned int doorbell_irqs;
} ____cacheline_aligned irq_cpustat_t;
DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index 9ebbc24..d55c76c 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -41,6 +41,8 @@ void doorbell_exception(struct pt_regs *regs)
may_hard_irq_enable();
+ __get_cpu_var(irq_stat).doorbell_irqs++;
+
smp_ipi_demux();
irq_exit();
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 4f97fe3..3a3c3b9 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -374,6 +374,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
seq_printf(p, " Machine check exceptions\n");
+ if (cpu_has_feature(CPU_FTR_DBELL)) {
+ seq_printf(p, "%*s: ", prec, "DBL");
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", per_cpu(irq_stat, j).doorbell_irqs);
+ seq_printf(p, " Doorbell interrupts\n");
+ }
+
return 0;
}
@@ -387,6 +394,7 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
sum += per_cpu(irq_stat, cpu).pmu_irqs;
sum += per_cpu(irq_stat, cpu).mce_exceptions;
sum += per_cpu(irq_stat, cpu).spurious_irqs;
+ sum += per_cpu(irq_stat, cpu).doorbell_irqs;
return sum;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: Add accounting for Doorbell interrupts
2013-03-20 7:42 [PATCH] powerpc: Add accounting for Doorbell interrupts Ian Munsie
@ 2013-03-21 0:28 ` Michael Neuling
2013-03-22 4:18 ` Michael Ellerman
1 sibling, 0 replies; 5+ messages in thread
From: Michael Neuling @ 2013-03-21 0:28 UTC (permalink / raw)
To: Ian Munsie; +Cc: linuxppc-dev
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> This patch adds a new line to /proc/interrupts to account for the
> doorbell interrupts that each hardware thread has received. The total
> interrupt count in /proc/stat will now also include doorbells.
It's probably worth noting in the comment that these are not being
accounted at all currently, even in the existing IPI line in
/proc/interrupts.
Mikey
> # cat /proc/interrupts
> CPU0 CPU1 CPU2 CPU3
> 16: 551 1267 281 175 XICS Level IPI
> LOC: 2037 1503 1688 1625 Local timer interrupts
> SPU: 0 0 0 0 Spurious interrupts
> CNT: 0 0 0 0 Performance monitoring interrupts
> MCE: 0 0 0 0 Machine check exceptions
> DBL: 42 550 20 91 Doorbell interrupts
>
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> ---
> arch/powerpc/include/asm/hardirq.h | 1 +
> arch/powerpc/kernel/dbell.c | 2 ++
> arch/powerpc/kernel/irq.c | 8 ++++++++
> 3 files changed, 11 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
> index 3147a29..e88c5f2 100644
> --- a/arch/powerpc/include/asm/hardirq.h
> +++ b/arch/powerpc/include/asm/hardirq.h
> @@ -10,6 +10,7 @@ typedef struct {
> unsigned int pmu_irqs;
> unsigned int mce_exceptions;
> unsigned int spurious_irqs;
> + unsigned int doorbell_irqs;
> } ____cacheline_aligned irq_cpustat_t;
>
> DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
> diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
> index 9ebbc24..d55c76c 100644
> --- a/arch/powerpc/kernel/dbell.c
> +++ b/arch/powerpc/kernel/dbell.c
> @@ -41,6 +41,8 @@ void doorbell_exception(struct pt_regs *regs)
>
> may_hard_irq_enable();
>
> + __get_cpu_var(irq_stat).doorbell_irqs++;
> +
> smp_ipi_demux();
>
> irq_exit();
> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index 4f97fe3..3a3c3b9 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -374,6 +374,13 @@ int arch_show_interrupts(struct seq_file *p, int prec)
> seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
> seq_printf(p, " Machine check exceptions\n");
>
> + if (cpu_has_feature(CPU_FTR_DBELL)) {
> + seq_printf(p, "%*s: ", prec, "DBL");
> + for_each_online_cpu(j)
> + seq_printf(p, "%10u ", per_cpu(irq_stat, j).doorbell_irqs);
> + seq_printf(p, " Doorbell interrupts\n");
> + }
> +
> return 0;
> }
>
> @@ -387,6 +394,7 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
> sum += per_cpu(irq_stat, cpu).pmu_irqs;
> sum += per_cpu(irq_stat, cpu).mce_exceptions;
> sum += per_cpu(irq_stat, cpu).spurious_irqs;
> + sum += per_cpu(irq_stat, cpu).doorbell_irqs;
>
> return sum;
> }
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: Add accounting for Doorbell interrupts
2013-03-20 7:42 [PATCH] powerpc: Add accounting for Doorbell interrupts Ian Munsie
2013-03-21 0:28 ` Michael Neuling
@ 2013-03-22 4:18 ` Michael Ellerman
2013-03-22 5:13 ` Ian Munsie
1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2013-03-22 4:18 UTC (permalink / raw)
To: Ian Munsie; +Cc: Michael Neuling, linuxppc-dev
On Wed, Mar 20, 2013 at 06:42:12PM +1100, Ian Munsie wrote:
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> This patch adds a new line to /proc/interrupts to account for the
> doorbell interrupts that each hardware thread has received. The total
> interrupt count in /proc/stat will now also include doorbells.
Should it be inside CONFIG_PPC_DOORBELL ?
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc: Add accounting for Doorbell interrupts
2013-03-22 4:18 ` Michael Ellerman
@ 2013-03-22 5:13 ` Ian Munsie
2013-03-22 5:22 ` [PATCH v2] " Ian Munsie
0 siblings, 1 reply; 5+ messages in thread
From: Ian Munsie @ 2013-03-22 5:13 UTC (permalink / raw)
To: Michael Ellerman; +Cc: Michael Neuling, linuxppc-dev
Excerpts from Michael Ellerman's message of 2013-03-22 15:18:03 +1100:
> On Wed, Mar 20, 2013 at 06:42:12PM +1100, Ian Munsie wrote:
> > From: Ian Munsie <imunsie@au1.ibm.com>
> >
> > This patch adds a new line to /proc/interrupts to account for the
> > doorbell interrupts that each hardware thread has received. The total
> > interrupt count in /proc/stat will now also include doorbells.
>
> Should it be inside CONFIG_PPC_DOORBELL ?
The doorbell line will only show up in /proc/interrupt if CPU_FTR_DBELL
is set and the total interrupt count in /proc/stat will be unaffected
if we don't have doorbells (+ 0 doorbells). It still builds fine without
CONFIG_PPC_DOORBELL.
Adding #ifdefs would save one per cpu integer in irq_stat. I can throw
together a v2 patch with them in place.
Cheers,
-Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] powerpc: Add accounting for Doorbell interrupts
2013-03-22 5:13 ` Ian Munsie
@ 2013-03-22 5:22 ` Ian Munsie
0 siblings, 0 replies; 5+ messages in thread
From: Ian Munsie @ 2013-03-22 5:22 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie
From: Ian Munsie <imunsie@au1.ibm.com>
This patch adds a new line to /proc/interrupts to account for the
doorbell interrupts that each hardware thread has received. The total
interrupt count in /proc/stat will now also include doorbells.
# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
16: 551 1267 281 175 XICS Level IPI
LOC: 2037 1503 1688 1625 Local timer interrupts
SPU: 0 0 0 0 Spurious interrupts
CNT: 0 0 0 0 Performance monitoring interrupts
MCE: 0 0 0 0 Machine check exceptions
DBL: 42 550 20 91 Doorbell interrupts
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
Changes from v1:
- Added #ifdef CONFIG_PPC_DOORBELL as requested by Michael Ellerman to avoid
the extra per cpu variable in irq_stat when building for a system that does
not support doorbells.
arch/powerpc/include/asm/hardirq.h | 3 +++
arch/powerpc/kernel/dbell.c | 2 ++
arch/powerpc/kernel/irq.c | 12 ++++++++++++
3 files changed, 17 insertions(+)
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 3147a29..3bdcfce 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -10,6 +10,9 @@ typedef struct {
unsigned int pmu_irqs;
unsigned int mce_exceptions;
unsigned int spurious_irqs;
+#ifdef CONFIG_PPC_DOORBELL
+ unsigned int doorbell_irqs;
+#endif
} ____cacheline_aligned irq_cpustat_t;
DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index 9ebbc24..d55c76c 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -41,6 +41,8 @@ void doorbell_exception(struct pt_regs *regs)
may_hard_irq_enable();
+ __get_cpu_var(irq_stat).doorbell_irqs++;
+
smp_ipi_demux();
irq_exit();
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 4f97fe3..5cbcf4d 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -374,6 +374,15 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
seq_printf(p, " Machine check exceptions\n");
+#ifdef CONFIG_PPC_DOORBELL
+ if (cpu_has_feature(CPU_FTR_DBELL)) {
+ seq_printf(p, "%*s: ", prec, "DBL");
+ for_each_online_cpu(j)
+ seq_printf(p, "%10u ", per_cpu(irq_stat, j).doorbell_irqs);
+ seq_printf(p, " Doorbell interrupts\n");
+ }
+#endif
+
return 0;
}
@@ -387,6 +396,9 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
sum += per_cpu(irq_stat, cpu).pmu_irqs;
sum += per_cpu(irq_stat, cpu).mce_exceptions;
sum += per_cpu(irq_stat, cpu).spurious_irqs;
+#ifdef CONFIG_PPC_DOORBELL
+ sum += per_cpu(irq_stat, cpu).doorbell_irqs;
+#endif
return sum;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-03-22 5:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20 7:42 [PATCH] powerpc: Add accounting for Doorbell interrupts Ian Munsie
2013-03-21 0:28 ` Michael Neuling
2013-03-22 4:18 ` Michael Ellerman
2013-03-22 5:13 ` Ian Munsie
2013-03-22 5:22 ` [PATCH v2] " Ian Munsie
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).