lp-driver doesn't schedule when using interrupts (with patch)

Martin Buck (martin-2.buck@student.uni-ulm.de)
Thu, 3 Apr 97 16:06 MET DST


I just noticed that the lp-driver doesn't call the scheduler if you print
with interrupts and have a fast printer (like a LaserJet 6P). This is
bad[tm], because it locks up the machine if you print large amounts of
data. It can be demonstrated easily with the following command (if you used
tunelp to enable interrupts and have a printer that accepts the data fast
enough):

$ dd if=/dev/zero of=/dev/lp1 bs=1024k count=1

This locks up the machine for about 10 seconds (console switching works,
though). The appended patch fixes the problem -- it checks whether it's
necessary to call the scheduler every time before printing a character just
like the polling version of the lp-driver does. The patch was made against
2.0.29 with Carsten Gross' IEEE1284-readback-support, but it works with
plain 2.0.29 and 2.1.x as well (with a little offset).

BTW, it would be really nice to have IEEE1284 ECP support for Linux,
because modern printers are definitely capable of accepting more than
100kB/s (and they also shouldn't suck up your whole CPU :-). Anybody
working on this?

Martin

--- drivers/char/lp.c.notfixed Thu Apr 3 15:38:03 1997
+++ drivers/char/lp.c Thu Apr 3 15:44:15 1997
@@ -117,6 +117,8 @@
struct lp_stats *stats;

do {
+ if(need_resched)
+ schedule();
if ((status = LP_S(minor)) & LP_PBUSY) {
if (!LP_CAREFUL_READY(minor, status))
return 0;

-- 
/* Martin Buck                      E-Mail: martin-2.buck@student.uni-ulm.de */
/* Student of electrical engineering   WWW: http://www.uni-ulm.de/~s_mbuck1/ */
/* University of Ulm, Germany  Snail-Mail: Paukengasse 2, 89077 Ulm, Germany */
#include <disclaimer.h>            /* PGP Key available    MIME-Mail welcome */