From: Stephen Hemminger on
It seems it isn't related to initial jiffies.
Initializing the values (though a good idea), doesn't solve the
problem. Still failed. So dazed and confused, went back and reran
kernel with jiffies=0 showed same problem, just took multiple boots
to reproduce.

> for (dr = 0; dr < N_DRIVE; dr++) {
> @@ -4267,6 +4269,9 @@ static int __init floppy_init(void)
> set_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
> set_bit(FD_VERIFY_BIT, &UDRS->flags);
> UDRS->fd_device = -1;
> + UDRS->last_checked = jiffies;
> + UDRS->select_date = jiffies;
> + UDRS->spinup_date = jiffies;
> floppy_track_buffer = NULL;
> max_buffer_sectors = 0;
> }

So still a race that shows up with KVM (fast floppy?) and manifests
as floppy_ready or reset_interrupt OOPS.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Linus Torvalds on


On Thu, 3 Jun 2010, Stephen Hemminger wrote:
>
> It seems it isn't related to initial jiffies.
> Initializing the values (though a good idea), doesn't solve the
> problem. Still failed. So dazed and confused, went back and reran
> kernel with jiffies=0 showed same problem, just took multiple boots
> to reproduce.

Ahh, ok. That really ends up limiting us. At least having a "it's related
to jiffy wraparound" was a big clue.

> 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.

Don't get me wrong - I'm sure it could be fixed. I'm just not sure that
anybody is going to spend the effort.

I'd love to be proven wrong. Anybody?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Linus Torvalds on


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Andreas Mohr on
> I do wonder a bit why you even care. You can't even buy non-USB floppy
> drives any more (and even the USB ones are really really hard to find),
> and judging by my experiences, they don't last long enough for there to
> be much of a legacy base.

http://such001.reichelt.de/?SID=31BKCyV6wQAR8AAHJNE7U6761b7ea498b06ffe19b1e0abcdc120b;ACTION=444
http://www.kmelektronik.de/shop/index.php?show=subgroup&group=53&subgroup=117&Sort=2
http://www.arlt.com/index.php?cl=search&searchparam=floppy

Up to 10 items each, beige, black, USB, silver, which would you want?
And those are not some shops selling shady rotten scrap hardware...
(rather, these are 3 tests I launched, with a hit rate of 3 out of 3).

OK, a cheap shot certainly, but that's just to show that one's opinion
of what hardware to make use of pretty much never is universal.

Plus I'm certain that some (forensics) folks would appreciate a floppy
driver that remains in semi-working state even in newer (i.e., current)
kernel versions in some decades, since that widens the narrow window
of often conflicting version compatibility and software
that those people will probably encounter
(with their 3 to 5 system environment emulators stacked on top of each other ;)
in their rather progressed times...

</rant>,

Andreas Mohr
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Linus Torvalds on


On Fri, 4 Jun 2010, Andreas Mohr wrote:
>
> http://such001.reichelt.de/?SID=31BKCyV6wQAR8AAHJNE7U6761b7ea498b06ffe19b1e0abcdc120b;ACTION=444
> http://www.kmelektronik.de/shop/index.php?show=subgroup&group=53&subgroup=117&Sort=2
> http://www.arlt.com/index.php?cl=search&searchparam=floppy

Ok, ok. I admit it. I was being a bit facetious. You can still buy them
online. In fact, according to newegg, you can get them really cheap (the
USB floppy drives cost $20, but you can get a _genuine_ floppy drive for
$7.99.

Although one comment says it all:

Cons: I ordered 5. After 45 days 3 of them have failed. Too late to return.

so apparently you do need to order a lot of them to keep them going ;)

So here's a one-time offer: if you want to really fix that driver, I'm
willing to pay the $7.99 to buy the hardware for you. I won't touch it
myself with a 10-foot pole, though ;)

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/