On Mon, Sep 17, 2001 at 04:44:56PM -0700, Matt D. Robinson wrote:
> Just an FYI for folks following this, the setup_IO_APIC_irqs()
> mechanism doesn't work (it fails miserably, actually). I'm going
> to try something similar to the following:
>
> int __dump_cpu_disable(unsigned int dumping_cpu)
> {
> int i;
> unsigned long val, cpu = smp_processor_id();
> if ((cpu == 0) || (cpu == dumping_cpu)) return -EINVAL;
> clear_bit(cpu, &cpu_online_map);
> mb();
> /* first, move everyone to the dumping CPU */
> for (i = 0; i < NR_IRQS; i++) {
> if (irq_desc[i].handler == NULL) continue;
> val = irq_affinity[i];
> if (val & (1 << cpu)) {
> if (!(val & cpu_online_map))
> val = (1 << dumping_cpu);
> else
> val = val & ~(1 << cpu);
> irq_affinity[i] = val;
> if (irq_desc[i].handler->set_affinity != NULL)
> irq_desc[i].handler->set_affinity(i, val);
> }
> }
>
> cli();
> sti();
> return 0;
> }
Will this fuction be called for each cpu ? If so won't you be going through
the loop of NR_IRQS for all cpus ? Can't the affinities of all irqs be changed
to that of dumping cpu at one go ? Something like this,
{
.
.
int cpu = smp_processor_id();
for (i = 0; i < NR_IRQS; i++) {
if (irq_desc[i].handler == NULL)
continue;
irq_affinity[i] = 1UL << cpu;
if (irq_desc[i].handler->set_affinity != NULL)
irq_desc[i].handler->set_affinity(i, irq_affinity[i]);
}
}
>
> That last wierd cli()/sti() is supposed to catch a case where
> IRQs may be running with interrupts disabled, and they haven't
> quite flushed out yet.
>
> Note that this doesn't take care of spinning the CPUs.
> Something else has to be added for that case. Most of this
> comes from Rusty's __cpu_disable(), but changed so that it
> doesn't randomly pass irqs to any CPU, and takes a dumping
> CPU argument.
>
> --Matt
Regards,
Bharata.
--
Bharata B Rao,
IBM Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: 91-80-5262355 Ex: 3962
Mail: bharata@xxxxxxxxxx
|