Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116463
b: refs/heads/master
c: e89eb43
h: refs/heads/master
i:
  116461: c83b910
  116459: a82eb53
  116455: d28a934
  116447: 6fb2ca3
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Oct 16, 2008
1 parent 94a790c commit b05d846
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 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: 7ddfb650c7ef7a33a5ef11c0fdf5b3d837a47dba
refs/heads/master: e89eb43863c2d9f11a3bbe766766fe646e6c50d9
13 changes: 12 additions & 1 deletion trunk/arch/x86/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ static void init_one_irq_cfg(struct irq_cfg *cfg)
}

static struct irq_cfg *irq_cfgx;

/*
* Protect the irq_cfgx_free freelist:
*/
static DEFINE_SPINLOCK(irq_cfg_lock);

#ifdef CONFIG_HAVE_SPARSE_IRQ
static struct irq_cfg *irq_cfgx_free;
#endif
Expand Down Expand Up @@ -213,8 +219,9 @@ static struct irq_cfg *irq_cfg(unsigned int irq)
static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
{
struct irq_cfg *cfg, *cfg_pri;
int i;
unsigned long flags;
int count = 0;
int i;

cfg_pri = cfg = irq_cfgx;
while (cfg) {
Expand All @@ -226,6 +233,7 @@ static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
count++;
}

spin_lock_irqsave(&irq_cfg_lock, flags);
if (!irq_cfgx_free) {
unsigned long phys;
unsigned long total_bytes;
Expand Down Expand Up @@ -263,6 +271,9 @@ static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
else
irq_cfgx = cfg;
cfg->irq = irq;

spin_unlock_irqrestore(&irq_cfg_lock, flags);

printk(KERN_DEBUG "found new irq_cfg for irq %d\n", cfg->irq);
#ifdef CONFIG_HAVE_SPARSE_IRQ_DEBUG
{
Expand Down
13 changes: 12 additions & 1 deletion trunk/kernel/irq/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ static void init_kstat_irqs(struct irq_desc *desc, int nr_desc, int nr)
}
}

/*
* Protect the sparse_irqs_free freelist:
*/
static DEFINE_SPINLOCK(sparse_irq_lock);

#ifdef CONFIG_HAVE_SPARSE_IRQ
static struct irq_desc *sparse_irqs_free;
struct irq_desc *sparse_irqs;
Expand Down Expand Up @@ -166,11 +171,13 @@ struct irq_desc *irq_to_desc(unsigned int irq)
}
return NULL;
}

struct irq_desc *irq_to_desc_alloc(unsigned int irq)
{
struct irq_desc *desc, *desc_pri;
int i;
unsigned long flags;
int count = 0;
int i;

desc_pri = desc = sparse_irqs;
while (desc) {
Expand All @@ -182,6 +189,7 @@ struct irq_desc *irq_to_desc_alloc(unsigned int irq)
count++;
}

spin_lock_irqsave(&sparse_irq_lock, flags);
/*
* we run out of pre-allocate ones, allocate more
*/
Expand Down Expand Up @@ -223,6 +231,9 @@ struct irq_desc *irq_to_desc_alloc(unsigned int irq)
else
sparse_irqs = desc;
desc->irq = irq;

spin_unlock_irqrestore(&sparse_irq_lock, flags);

printk(KERN_DEBUG "found new irq_desc for irq %d\n", desc->irq);
#ifdef CONFIG_HAVE_SPARSE_IRQ_DEBUG
{
Expand Down

0 comments on commit b05d846

Please sign in to comment.