Ingo Molnar <[email protected]> wrote:
>
> free_irq() should not be executed from softirq context.
>
> ...
>
> the fix is to push fd_free_irq() into keventd. The code validates fine
> with this patch applied.
>
> --- linux.orig/drivers/block/floppy.c
> +++ linux/drivers/block/floppy.c
You know this makes you the floppy maintainer?
> @@ -251,6 +251,18 @@ static int irqdma_allocated;
> #include <linux/cdrom.h> /* for the compatibility eject ioctl */
> #include <linux/completion.h>
>
> +/*
> + * Interrupt freeing also means /proc VFS work - dont do it
> + * from interrupt context. We push this work into keventd:
> + */
> +static void fd_free_irq_fn(void *data)
> +{
> + fd_free_irq();
> +}
> +
> +static DECLARE_WORK(fd_free_irq_work, fd_free_irq_fn, NULL);
> +
> +
> static struct request *current_req;
> static struct request_queue *floppy_queue;
> static void do_fd_request(request_queue_t * q);
> @@ -4434,6 +4446,13 @@ static int floppy_grab_irq_and_dma(void)
> return 0;
> }
> spin_unlock_irqrestore(&floppy_usage_lock, flags);
> +
> + /*
> + * We might have scheduled a free_irq(), wait it to
> + * drain first:
> + */
> + flush_scheduled_work();
> +
yup.
> if (fd_request_irq()) {
> DPRINT("Unable to grab IRQ%d for the floppy driver\n",
> FLOPPY_IRQ);
> @@ -4523,7 +4542,7 @@ static void floppy_release_irq_and_dma(v
> if (irqdma_allocated) {
> fd_disable_dma();
> fd_free_dma();
> - fd_free_irq();
> + schedule_work(&fd_free_irq_work);
> irqdma_allocated = 0;
> }
> set_dor(0, ~0, 8);
I think we need a flush_scheduled_work() in cleanup_module() too. Because
floppy_release_irq_and_dma() might have taken usage_count to zero, but the
workqueue is still pending.
This patch doesn't do anything to improve the floppy driver :(
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]