mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, arjan@infradead.org
Subject: Re: [patch] drivers/block/floppy.c: dont free_irq() from irq context
Date: Fri, 27 Jan 2006 14:32:15 -0800	[thread overview]
Message-ID: <20060127143215.5e349aeb.akpm@osdl.org> (raw)
In-Reply-To: <20060126162922.GA5135@elte.hu>

Ingo Molnar <mingo@elte.hu> 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 :(

      reply	other threads:[~2006-01-27 22:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-26 16:29 Ingo Molnar
2006-01-27 22:32 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060127143215.5e349aeb.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®