[XENOPROFILE] Fix incorrect use of on_each_cpu() which could lead

to sleep with interrupts disabled. on_each_cpu() disables interrupts.
proc_create() calls passes GFP_KERNEL to kmalloc().

The patch converts from on_each_cpu() to for_each_cpu(), and then
simplifies things.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-05-16 09:08:06 +01:00
1 parent 395112e684
commit 28978ff92a
1 file changed
+24 -40
@@ -141,56 +141,40 @@ xenoprof_ovf_interrupt(int irq, void * dev_id, struct pt_regs * regs)
}
static void unbind_virq_cpu(void * info)
{
int cpu = smp_processor_id();
if (ovf_irq[cpu] >= 0) {
unbind_from_irqhandler(ovf_irq[cpu], NULL);
ovf_irq[cpu] = -1;
}
}
static void unbind_virq(void)
{
on_each_cpu(unbind_virq_cpu, NULL, 0, 1);
}
int i;
int bind_virq_error;
static void bind_virq_cpu(void * info)
{
int result;
int cpu = smp_processor_id();
result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
cpu,
xenoprof_ovf_interrupt,
SA_INTERRUPT,
"xenoprof",
NULL);
if (result<0) {
bind_virq_error = result;
printk("xenoprof.c: binding VIRQ_XENOPROF to IRQ failed on CPU "
"%d\n", cpu);
} else {
ovf_irq[cpu] = result;
for_each_cpu(i) {
if (ovf_irq[i] >= 0) {
unbind_from_irqhandler(ovf_irq[i], NULL);
ovf_irq[i] = -1;
}
}
}
static int bind_virq(void)
{
bind_virq_error = 0;
on_each_cpu(bind_virq_cpu, NULL, 0, 1);
if (bind_virq_error) {
unbind_virq();
return bind_virq_error;
} else {
return 0;
int i, result;
for_each_cpu(i) {
result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
i,
xenoprof_ovf_interrupt,
SA_INTERRUPT,
"xenoprof",
NULL);
if (result < 0) {
unbind_virq();
return result;
}
ovf_irq[i] = result;
}
return 0;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.