Re: TARGET_CPUS in assign_irq_vector

From: Yinghai Lu
Date: Tue Sep 09 2008 - 21:24:18 EST


On Tue, Sep 9, 2008 at 5:50 PM, Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
> Yinghai Lu wrote:
>> On Tue, Sep 9, 2008 at 4:46 PM, Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
>>
>>> Yinghai Lu wrote:
>>>
>>>> target_cpus is the cpus that could be possible to used to take vector
>>>> and process that irq. so at least it should be online.
>>>>
>>>>
>>> Would it be wrong to make it possible_cpu_mask?
>>>
>>>
>> it is wrong
>
> What happens if you online a new cpu and migrate the irq to it? Does it
> get allocated a new vector?

for phys_flat mode: it will get new vector for on new cpu.

>
> I'm using create_irq() as a general irq and vector allocation mechanism
> for Xen interrupts. I'd like to be able to allocate a vector across all
> possible cpus so I can bind Xen event channels to vectors. Should I: 1)
> add a create_irq_cpus() which takes a cpu mask rather than defaulting to
> TARGET_CPUS, 2) modify struct genapic to insert by own target_cpus(),
> 3) give up because the idea is fundamentally ill-conceived, or 4)
> something else?

seems need to rework __assign_irq_vector a little bit.

to
cpumask_t (*vector_allocation_domain_t)(int cpu)
static int __assign_irq_vector(int irq, cpumask_t mask,
vector_allocation_domain_t p)

...

and you could have your own

static cpumask_t vec_domain_alloc(int cpu)
{
cpumask_t domain = cpu_possible_map;
return domain;
}


static int assign_irq_vector_all(int irq)
{
int err;
unsigned long flags;
cpumask_t mask = cpu_possible_map;

spin_lock_irqsave(&vector_lock, flags);
err = __assign_irq_vector(irq, mask, vec_domain_alloc);
spin_unlock_irqrestore(&vector_lock, flags);
return err;
}

YH
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/