From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] irq: clear kstat_irqs
Date: Fri, 06 Feb 2009 13:50:47 -0800 [thread overview]
Message-ID: <498CB0B7.8030009@kernel.org> (raw)
Impact: get correct kstat_irqs for msi etc
need to call clear_kstat_irqs(), so when reuse that irq_desc, could get correct
kstat in /proc/interrupts
also could make /proc/interrupts don't have none-<NULL> entries
don't need to worry about arch that doesn't support genirq, because they
will not call dynamic_irq_cleanup().
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
kernel/irq/chip.c | 1 +
kernel/irq/handle.c | 11 +++++++++++
kernel/irq/internals.h | 1 +
3 files changed, 13 insertions(+)
Index: linux-2.6/kernel/irq/chip.c
===================================================================
--- linux-2.6.orig/kernel/irq/chip.c
+++ linux-2.6/kernel/irq/chip.c
@@ -81,6 +81,7 @@ void dynamic_irq_cleanup(unsigned int ir
desc->handle_irq = handle_bad_irq;
desc->chip = &no_irq_chip;
desc->name = NULL;
+ clear_kstat_irqs(desc);
spin_unlock_irqrestore(&desc->lock, flags);
}
Index: linux-2.6/kernel/irq/handle.c
===================================================================
--- linux-2.6.orig/kernel/irq/handle.c
+++ linux-2.6/kernel/irq/handle.c
@@ -270,6 +270,17 @@ struct irq_desc *irq_to_desc_alloc_cpu(u
}
#endif /* !CONFIG_SPARSE_IRQ */
+void clear_kstat_irqs(struct irq_desc *desc)
+{
+ unsigned long bytes;
+ char *ptr;
+
+ ptr = (char *)desc->kstat_irqs;
+ /* Compute how many bytes we need to clear */
+ bytes = nr_cpu_ids * sizeof(unsigned int);
+ memset(ptr, 0, bytes);
+}
+
/*
* What should we do if we get a hw irq event on an illegal vector?
* Each architecture has to answer this themself.
Index: linux-2.6/kernel/irq/internals.h
===================================================================
--- linux-2.6.orig/kernel/irq/internals.h
+++ linux-2.6/kernel/irq/internals.h
@@ -15,6 +15,7 @@ extern int __irq_set_trigger(struct irq_
extern struct lock_class_key irq_desc_lock_class;
extern void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr);
+extern void clear_kstat_irqs(struct irq_desc *desc);
extern spinlock_t sparse_irq_lock;
#ifdef CONFIG_SPARSE_IRQ
next reply other threads:[~2009-02-06 21:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-06 21:50 Yinghai Lu [this message]
2009-02-06 22:00 ` [PATCH] irq: clear kstat_irqs Andrew Morton
2009-02-06 22:08 ` [PATCH] irq: clear kstat_irqs v2 Yinghai Lu
2009-02-07 7:49 ` [PATCH] irq: optimize init_kstat_irqs/init_copy_kstat_irqs Yinghai Lu
2009-02-07 8:26 ` Andrew Morton
2009-02-07 9:01 ` Yinghai Lu
2009-02-07 9:06 ` Andrew Morton
2009-02-09 8:11 ` Ingo Molnar
2009-02-09 8:19 ` Andrew Morton
2009-02-09 8:37 ` Ingo Molnar
2009-02-09 8:43 ` Andrew Morton
2009-02-09 11:34 ` Ingo Molnar
2009-02-09 8:44 ` Yinghai Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=498CB0B7.8030009@kernel.org \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox