From: Stephen Hemminger <shemminger@vyatta.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: floppy driver assumes INITIAL_JIFFIES == 0
Date: Thu, 3 Jun 2010 16:15:13 -0700 [thread overview]
Message-ID: <20100603161513.60370e98@nehalam> (raw)
In-Reply-To: <alpine.LFD.2.00.1006031515030.8175@i5.linux-foundation.org>
On Thu, 3 Jun 2010 15:33:23 -0700 (PDT)
Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
>
> On Thu, 3 Jun 2010, Linus Torvalds wrote:
> >
> > > So still a race that shows up with KVM (fast floppy?) and manifests
> > > as floppy_ready or reset_interrupt OOPS.
> >
> > Yes, it's quite possible that the Linux floppy driver is simply broken by
> > any floppy device that basically responds immediately to a command with an
> > interrupt. And considering how few people use floppies, I do expect that
> > driver to get _worse_ rather than better in the future.
>
> Having looked at that driver some more, I can inf act pretty much
> guarantee it. The locking is rather baroque. It has a "floppy_lock", but
> that only protects certain small parts. In particular, it looks like the
> irq handler and the timers do _not_ take it, and that's where most of the
> real work is done.
>
> And in fact, that does look broken. The interrupt handler really does a
> "schedule_work()" to schedule the actual handler outside of irq context,
> and I don't see any serialization between the timers that file and the
> handler running.
>
> That driver used to be this state machine that ran entirely from interrupt
> context, where one interrupt handler would set the state for the next one
> (that's what the "do_floppy" thing is for). But then it became bottom
> halves, and now it's using schedule_work() instead - and at the same time,
> the _timers_ haven't really changed. Those run in timer context, and can
> thus interrupt the work thing.
>
> It always was a disgusting driver. Now it's just even more so. And yes,
> I'm sure it's full of races that are largely hidden by the fact that real
> floppy hardware is so slow that you can never hit them.
>
> Looking too much at that driver will cause PTSD. I have to look away.
>
> Linus
Maybe putting all back together in a threaded_irq would be safest.
next prev parent reply other threads:[~2010-06-03 23:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-03 17:15 floppy driver assumes INITIAL_JIFFIES == 0 Stephen Hemminger
2010-06-03 17:28 ` Linus Torvalds
2010-06-03 19:03 ` Stephen Hemminger
2010-06-03 19:56 ` Linus Torvalds
2010-06-03 20:59 ` Linus Torvalds
2010-06-03 21:49 ` Stephen Hemminger
2010-06-03 21:58 ` Linus Torvalds
2010-06-03 22:33 ` Linus Torvalds
2010-06-03 22:54 ` Stephen Hemminger
2010-06-03 23:09 ` Linus Torvalds
2010-06-03 23:15 ` Stephen Hemminger [this message]
2010-06-03 23:21 ` Linus Torvalds
2010-06-09 5:32 ` Stephen Hemminger
2010-06-03 22:32 ` Andreas Mohr
2010-06-03 22:40 ` Linus Torvalds
2010-06-04 15:12 ` Nick Bowler
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=20100603161513.60370e98@nehalam \
--to=shemminger@vyatta.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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