lkml.org 
[lkml]   [2021]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 09/12] x86/irq: Use unsigned long for IRQ counter sum
Date
Now that all individual counters consistently use unsigned long, use the
same type for their sum. This ensures correct handling of wrap-around
(which is more important for i386 at this point).

Signed-off-by: Alexei Lozovsky <me@ilammy.net>
---
arch/x86/include/asm/hardirq.h | 4 ++--
arch/x86/kernel/irq.c | 9 ++++-----
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 2dc9c076f611..c05b42c4d8cb 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -54,10 +54,10 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);

extern void ack_bad_irq(unsigned int irq);

-extern u64 arch_irq_stat_cpu(unsigned int cpu);
+extern unsigned long arch_irq_stat_cpu(unsigned int cpu);
#define arch_irq_stat_cpu arch_irq_stat_cpu

-extern u64 arch_irq_stat(void);
+extern unsigned long arch_irq_stat(void);
#define arch_irq_stat arch_irq_stat


diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 6e7c6b4cebc1..2d889e26ae68 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -189,9 +189,9 @@ int arch_show_interrupts(struct seq_file *p, int prec)
/*
* /proc/stat helpers
*/
-u64 arch_irq_stat_cpu(unsigned int cpu)
+unsigned long arch_irq_stat_cpu(unsigned int cpu)
{
- u64 sum = READ_ONCE(irq_stats(cpu)->__nmi_count);
+ unsigned long sum = READ_ONCE(irq_stats(cpu)->__nmi_count);

#ifdef CONFIG_X86_LOCAL_APIC
sum += READ_ONCE(irq_stats(cpu)->apic_timer_irqs);
@@ -219,10 +219,9 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
return sum;
}

-u64 arch_irq_stat(void)
+unsigned long arch_irq_stat(void)
{
- u64 sum = atomic_long_read(&irq_err_count);
- return sum;
+ return atomic_long_read(&irq_err_count);
}

static __always_inline void handle_irq(struct irq_desc *desc,
--
2.25.1
\
 
 \ /
  Last update: 2021-09-15 19:59    [W:0.161 / U:5.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site