Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108164
b: refs/heads/master
c: d388e5f
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman authored and Ingo Molnar committed Aug 11, 2008
1 parent e620d70 commit 76b6806
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31343d8a5079cda57ffd539fcf4f00cea344fe98
refs/heads/master: d388e5fdc461344d04307a3fa83862b9ed429647
6 changes: 1 addition & 5 deletions trunk/arch/x86/kernel/io_apic_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ atomic_t irq_mis_count;
static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };

static DEFINE_SPINLOCK(ioapic_lock);
static DEFINE_SPINLOCK(vector_lock);
DEFINE_SPINLOCK(vector_lock);

int timer_through_8259 __initdata;

Expand Down Expand Up @@ -1209,10 +1209,6 @@ static int assign_irq_vector(int irq)
return vector;
}

void setup_vector_irq(int cpu)
{
}

static struct irq_chip ioapic_chip;

#define IOAPIC_AUTO -1
Expand Down
25 changes: 15 additions & 10 deletions trunk/arch/x86/kernel/io_apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int timer_through_8259 __initdata;
static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };

static DEFINE_SPINLOCK(ioapic_lock);
DEFINE_SPINLOCK(vector_lock);
static DEFINE_SPINLOCK(vector_lock);

/*
* # of IRQ routing registers
Expand Down Expand Up @@ -697,6 +697,19 @@ static int pin_2_irq(int idx, int apic, int pin)
return irq;
}

void lock_vector_lock(void)
{
/* Used to the online set of cpus does not change
* during assign_irq_vector.
*/
spin_lock(&vector_lock);
}

void unlock_vector_lock(void)
{
spin_unlock(&vector_lock);
}

static int __assign_irq_vector(int irq, cpumask_t mask)
{
/*
Expand Down Expand Up @@ -802,7 +815,7 @@ static void __clear_irq_vector(int irq)
cpus_clear(cfg->domain);
}

static void __setup_vector_irq(int cpu)
void __setup_vector_irq(int cpu)
{
/* Initialize vector_irq on a new cpu */
/* This function must be called with vector_lock held */
Expand All @@ -825,14 +838,6 @@ static void __setup_vector_irq(int cpu)
}
}

void setup_vector_irq(int cpu)
{
spin_lock(&vector_lock);
__setup_vector_irq(smp_processor_id());
spin_unlock(&vector_lock);
}


static struct irq_chip ioapic_chip;

static void ioapic_register_intr(int irq, unsigned long trigger)
Expand Down
12 changes: 9 additions & 3 deletions trunk/arch/x86/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,16 @@ static void __cpuinit start_secondary(void *unused)
* for which cpus receive the IPI. Holding this
* lock helps us to not include this cpu in a currently in progress
* smp_call_function().
*
* We need to hold vector_lock so there the set of online cpus
* does not change while we are assigning vectors to cpus. Holding
* this lock ensures we don't half assign or remove an irq from a cpu.
*/
ipi_call_lock_irq();
#ifdef CONFIG_X86_IO_APIC
setup_vector_irq(smp_processor_id());
#endif
lock_vector_lock();
__setup_vector_irq(smp_processor_id());
cpu_set(smp_processor_id(), cpu_online_map);
unlock_vector_lock();
ipi_call_unlock_irq();
per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;

Expand Down Expand Up @@ -1336,7 +1340,9 @@ int __cpu_disable(void)
remove_siblinginfo(cpu);

/* It's now safe to remove this processor from the online map */
lock_vector_lock();
remove_cpu_from_maps(cpu);
unlock_vector_lock();
fixup_irqs(cpu_online_map);
return 0;
}
Expand Down
12 changes: 10 additions & 2 deletions trunk/include/asm-x86/hw_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ extern void (*const interrupt[NR_IRQS])(void);
#else
typedef int vector_irq_t[NR_VECTORS];
DECLARE_PER_CPU(vector_irq_t, vector_irq);
extern spinlock_t vector_lock;
#endif
extern void setup_vector_irq(int cpu);

#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_X86_64)
extern void lock_vector_lock(void);
extern void unlock_vector_lock(void);
extern void __setup_vector_irq(int cpu);
#else
static inline void lock_vector_lock(void) {}
static inline void unlock_vector_lock(void) {}
static inline void __setup_vector_irq(int cpu) {}
#endif

#endif /* !ASSEMBLY_ */

Expand Down

0 comments on commit 76b6806

Please sign in to comment.