From: Mike Travis <travis@sgi.com>
To: Ingo Molnar <mingo@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
"H. Peter Anvin" <hpa@zytor.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Thomas Gleixner <tglx@linutronix.de>,
Jack Steiner <steiner@sgi.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 08/16] x86: fixup_irqs() doesnt need an argument.
Date: Mon, 15 Dec 2008 18:24:17 -0800 [thread overview]
Message-ID: <20081216022410.932065000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: <20081216022409.679598000@polaris-admin.engr.sgi.com>
[-- Attachment #1: 0012-x86-fixup_irqs-doesn-t-need-an-argument.patch --]
[-- Type: text/plain, Size: 3630 bytes --]
Impact: cleanup, remove on-stack cpumask.
The "map" arg is always cpu_online_mask. Importantly, set_affinity
always ands the argument with cpu_online_mask anyway, so we don't need
to do it in fixup_irqs(), avoiding a temporary.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
---
arch/x86/include/asm/irq.h | 2 +-
arch/x86/kernel/irq_32.c | 13 +++++++------
arch/x86/kernel/irq_64.c | 15 ++++++++-------
arch/x86/kernel/smpboot.c | 2 +-
4 files changed, 17 insertions(+), 15 deletions(-)
--- linux-2.6-for-ingo.orig/arch/x86/include/asm/irq.h
+++ linux-2.6-for-ingo/arch/x86/include/asm/irq.h
@@ -37,7 +37,7 @@ extern int irqbalance_disable(char *str)
#ifdef CONFIG_HOTPLUG_CPU
#include <linux/cpumask.h>
-extern void fixup_irqs(cpumask_t map);
+extern void fixup_irqs(void);
#endif
extern unsigned int do_IRQ(struct pt_regs *regs);
--- linux-2.6-for-ingo.orig/arch/x86/kernel/irq_32.c
+++ linux-2.6-for-ingo/arch/x86/kernel/irq_32.c
@@ -233,27 +233,28 @@ unsigned int do_IRQ(struct pt_regs *regs
#ifdef CONFIG_HOTPLUG_CPU
#include <mach_apic.h>
-void fixup_irqs(cpumask_t map)
+/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
+void fixup_irqs(void)
{
unsigned int irq;
static int warned;
struct irq_desc *desc;
for_each_irq_desc(irq, desc) {
- cpumask_t mask;
+ const struct cpumask *affinity;
if (!desc)
continue;
if (irq == 2)
continue;
- cpus_and(mask, desc->affinity, map);
- if (any_online_cpu(mask) == NR_CPUS) {
+ affinity = &desc->affinity;
+ if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
printk("Breaking affinity for irq %i\n", irq);
- mask = map;
+ affinity = cpu_all_mask;
}
if (desc->chip->set_affinity)
- desc->chip->set_affinity(irq, &mask);
+ desc->chip->set_affinity(irq, affinity);
else if (desc->action && !(warned++))
printk("Cannot set affinity for irq %i\n", irq);
}
--- linux-2.6-for-ingo.orig/arch/x86/kernel/irq_64.c
+++ linux-2.6-for-ingo/arch/x86/kernel/irq_64.c
@@ -83,16 +83,17 @@ asmlinkage unsigned int do_IRQ(struct pt
}
#ifdef CONFIG_HOTPLUG_CPU
-void fixup_irqs(cpumask_t map)
+/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
+void fixup_irqs(void)
{
unsigned int irq;
static int warned;
struct irq_desc *desc;
for_each_irq_desc(irq, desc) {
- cpumask_t mask;
int break_affinity = 0;
int set_affinity = 1;
+ const struct cpumask *affinity;
if (!desc)
continue;
@@ -102,23 +103,23 @@ void fixup_irqs(cpumask_t map)
/* interrupt's are disabled at this point */
spin_lock(&desc->lock);
+ affinity = &desc->affinity;
if (!irq_has_action(irq) ||
- cpus_equal(desc->affinity, map)) {
+ cpumask_equal(affinity, cpu_online_mask)) {
spin_unlock(&desc->lock);
continue;
}
- cpus_and(mask, desc->affinity, map);
- if (cpus_empty(mask)) {
+ if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
break_affinity = 1;
- mask = map;
+ affinity = cpu_all_mask;
}
if (desc->chip->mask)
desc->chip->mask(irq);
if (desc->chip->set_affinity)
- desc->chip->set_affinity(irq, &mask);
+ desc->chip->set_affinity(irq, affinity);
else if (!(warned++))
set_affinity = 0;
--- linux-2.6-for-ingo.orig/arch/x86/kernel/smpboot.c
+++ linux-2.6-for-ingo/arch/x86/kernel/smpboot.c
@@ -1346,7 +1346,7 @@ void cpu_disable_common(void)
lock_vector_lock();
remove_cpu_from_maps(cpu);
unlock_vector_lock();
- fixup_irqs(cpu_online_map);
+ fixup_irqs();
}
int native_cpu_disable(void)
--
next prev parent reply other threads:[~2008-12-16 2:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-16 2:24 [PATCH 00/16] cpumask: consolidate and apply x86 cpumask changes Mike Travis
2008-12-16 2:24 ` [PATCH 01/16] x86 smp: modify send_IPI_mask interface to accept cpumask_t pointers Mike Travis
2008-12-16 2:24 ` [PATCH 02/16] x86: enable MAXSMP Mike Travis
2008-12-16 2:24 ` [PATCH 03/16] x86: move and enhance debug printk for nr_cpu_ids etc Mike Travis
2008-12-16 2:24 ` [PATCH 04/16] x86: Add cpu_mask_to_apicid_and Mike Travis
2008-12-16 2:24 ` [PATCH 05/16] x86: update add-cpu_mask_to_apicid_and to use struct cpumask* Mike Travis
2008-12-16 2:24 ` [PATCH 06/16] x86: Update io_apic.c to use new cpumask API Mike Travis
2008-12-16 2:24 ` [PATCH 07/16] xen: convert to cpumask_var_t and new cpumask primitives Mike Travis
2008-12-16 2:24 ` Mike Travis [this message]
2008-12-16 2:24 ` [PATCH 09/16] x86: cosmetic changes apic-related files Mike Travis
2008-12-16 2:24 ` [PATCH 10/16] x86: Set CONFIG_NR_CPUS even on UP Mike Travis
2008-12-16 2:24 ` [PATCH 11/16] x86: prepare for cpumask iterators to only go to nr_cpu_ids Mike Travis
2008-12-16 2:24 ` [PATCH 12/16] x86: Use cpumask accessors code for possible/present maps Mike Travis
2008-12-16 2:24 ` [PATCH 13/16] x86: Remove cpumask games in x86/kernel/cpu/intel_cacheinfo.c Mike Travis
2008-12-16 2:24 ` [PATCH 14/16] x86: use work_on_cpu in x86/kernel/cpu/mcheck/mce_amd_64.c Mike Travis
2008-12-16 2:24 ` [PATCH 15/16] x86: xen: use smp_call_function_many() Mike Travis
2008-12-16 2:24 ` [PATCH 16/16] x86: Introduce topology_core_cpumask()/topology_thread_cpumask() Mike Travis
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=20081216022410.932065000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=sfr@canb.auug.org.au \
--cc=steiner@sgi.com \
--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
all inboxes | Powered by JetHome®