Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd3ecad1 authored by Daniel Drake's avatar Daniel Drake Committed by Greg Kroah-Hartman
Browse files

serial8250: ratelimit "too much work" error



Running a serial console, if too many kernel messages are generated within
a short time causing a lot of serial I/O, the 8250 driver will generate
another kernel message reporting this, which just adds to the I/O. It has
a cascading effect and quickly results the system being brought to its knees
by a flood of "too much work" messages.

Ratelimit the error message to avoid this.

[akpm@linux-foundation.org: use the superior printk_ratelimited()]
[akpm@linux-foundation.org: printk_ratelimited() needs ratelimit.h]
Signed-off-by: default avatarDaniel Drake <dsd@laptop.org>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0dd25df1
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/tty.h>
#include <linux/tty.h>
#include <linux/ratelimit.h>
#include <linux/tty_flip.h>
#include <linux/tty_flip.h>
#include <linux/serial_reg.h>
#include <linux/serial_reg.h>
#include <linux/serial_core.h>
#include <linux/serial_core.h>
@@ -1600,8 +1601,8 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)


		if (l == i->head && pass_counter++ > PASS_LIMIT) {
		if (l == i->head && pass_counter++ > PASS_LIMIT) {
			/* If we hit this, we're dead. */
			/* If we hit this, we're dead. */
			printk(KERN_ERR "serial8250: too much work for "
			printk_ratelimited(KERN_ERR
				"irq%d\n", irq);
				"serial8250: too much work for irq%d\n", irq);
			break;
			break;
		}
		}
	} while (l != end);
	} while (l != end);