mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.cz>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RFC] ataflop: remove buggy IRQ disable from do_fd_request()
Date: Fri, 9 Oct 2009 12:08:07 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.00.0910091207460.19284@wotan.suse.de> (raw)
In-Reply-To: <20091009095808.GU9228@kernel.dk>

On Fri, 9 Oct 2009, Jens Axboe wrote:

> On Fri, Oct 09 2009, Jiri Kosina wrote:
> > There is a nice gem in drivers/block/ataflop.c::do_fd_request()
> > 
> > 	void do_fd_request(struct request_queue * q)
> > 	{
> > 		unsigned long flags;
> > 
> > 		DPRINT(("do_fd_request for pid %d\n",current->pid));
> > 		while( fdc_busy ) sleep_on( &fdc_wait );
> > 		fdc_busy = 1;
> > 		stdma_lock(floppy_irq, NULL);
> > 
> > 		atari_disable_irq( IRQ_MFP_FDC );
> > 		local_save_flags(flags);        /* The request function is called with ints
> > 		local_irq_disable();             * disabled... so must save the IPL for later */
> > 		redo_fd_request();
> > 		local_irq_restore(flags);
> > 		atari_enable_irq( IRQ_MFP_FDC );
> > 	}
> > 
> > If you look at the code long enough, you will notioce that the 
> > local_irq_disable() call is actually commented out. This has been 
> > introduced back in 2002 in [1], but as you can see, the same bug has been 
> > there even before, with the sti() call being commented out in the very 
> > same way :)
> > 
> > I am not familiar with the code myself at all, but I guess that the whole 
> > stuff can just be removed. Why do we need save_flags/restore_flags at all, 
> > without actually disabling the local IRQs afterwards? The 
> > redo_fd_request() doesn't seem to do anything that would mess with flags 
> > inconsistently.
> > 
> > But I'd rather anyone who has touched the surrounding code in past years 
> > Ack it. I can then take it through trivial tree or submit to akpm.
> 
> That does look odd. The comment is correct that the function is entered
> with interrupts disabled (and the queue lock held). So I'd say your
> patch looks fine, the whole save/restore business looks meaningless.
> 
> Acked-by: Jens Axboe <jens.axboe@oracle.com>

Thanks for confirming. I have queued it up in trivial tree.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

  reply	other threads:[~2009-10-09 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09  9:53 Jiri Kosina
2009-10-09  9:58 ` Jens Axboe
2009-10-09 10:08   ` Jiri Kosina [this message]
     [not found] ` <10f740e80910100201n30367714uc57ec3c9c39b92af@mail.gmail.com>
     [not found]   ` <alpine.DEB.2.00.0910110846420.20140@zirkon.biophys.uni-duesseldorf.de>
2009-10-12  9:19     ` Fwd: " Jiri Kosina
2009-10-18 21:14       ` Michael Schmitz
2009-10-19  7:35         ` Jiri Kosina
2009-10-20  6:51           ` Michael Schmitz
2009-10-20  9:24             ` Andreas Schwab
2009-10-31  3:58               ` Michael Schmitz

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=alpine.LSU.2.00.0910091207460.19284@wotan.suse.de \
    --to=jkosina@suse.cz \
    --cc=geert@linux-m68k.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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®