[PATCH] ppc64: ratelimit some rtas errors
Anton Blanchard
anton at samba.org
Sun Nov 14 10:37:02 EST 2004
Use printk_ratelimit() in rtc code to avoid flooding the kernel log
buffer with errors. Also use rtas_get_error_log_max() instead of
duplicating it in __fetch_rtas_last_error.
Signed-off-by: Anton Blanchard <anton at samba.org>
===== rtas.c 1.45 vs edited =====
--- 1.45/arch/ppc64/kernel/rtas.c 2004-10-26 02:20:03 +10:00
+++ edited/rtas.c 2004-11-14 10:12:54 +11:00
@@ -102,6 +102,27 @@
return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
}
+/*
+ * Return the firmware-specified size of the error log buffer
+ * for all rtas calls that require an error buffer argument.
+ * This includes 'check-exception' and 'rtas-last-error'.
+ */
+int rtas_get_error_log_max(void)
+{
+ static int rtas_error_log_max;
+ if (rtas_error_log_max)
+ return rtas_error_log_max;
+
+ rtas_error_log_max = rtas_token ("rtas-error-log-max");
+ if ((rtas_error_log_max == RTAS_UNKNOWN_SERVICE) ||
+ (rtas_error_log_max > RTAS_ERROR_LOG_MAX)) {
+ printk (KERN_WARNING "RTAS: bad log buffer size %d\n", rtas_error_log_max);
+ rtas_error_log_max = RTAS_ERROR_LOG_MAX;
+ }
+ return rtas_error_log_max;
+}
+
+
/** Return a copy of the detailed error text associated with the
* most recent failed call to rtas. Because the error text
* might go stale if there are any other intervening rtas calls,
@@ -114,12 +135,7 @@
struct rtas_args err_args, save_args;
u32 bufsz;
- bufsz = rtas_token ("rtas-error-log-max");
- if ((bufsz == RTAS_UNKNOWN_SERVICE) ||
- (bufsz > RTAS_ERROR_LOG_MAX)) {
- printk (KERN_WARNING "RTAS: bad log buffer size %d\n", bufsz);
- bufsz = RTAS_ERROR_LOG_MAX;
- }
+ bufsz = rtas_get_error_log_max();
err_args.token = rtas_token("rtas-last-error");
err_args.nargs = 2;
@@ -539,26 +555,6 @@
enter_rtas(__pa(rtas_args));
panic("Alas, I survived.\n");
-}
-
-/*
- * Return the firmware-specified size of the error log buffer
- * for all rtas calls that require an error buffer argument.
- * This includes 'check-exception' and 'rtas-last-error'.
- */
-int rtas_get_error_log_max(void)
-{
- static int rtas_error_log_max;
- if (rtas_error_log_max)
- return rtas_error_log_max;
-
- rtas_error_log_max = rtas_token ("rtas-error-log-max");
- if ((rtas_error_log_max == RTAS_UNKNOWN_SERVICE) ||
- (rtas_error_log_max > RTAS_ERROR_LOG_MAX)) {
- printk (KERN_WARNING "RTAS: bad log buffer size %d\n", rtas_error_log_max);
- rtas_error_log_max = RTAS_ERROR_LOG_MAX;
- }
- return rtas_error_log_max;
}
/*
===== rtc.c 1.15 vs edited =====
--- 1.15/arch/ppc64/kernel/rtc.c 2004-09-08 16:32:57 +10:00
+++ edited/rtc.c 2004-11-14 10:05:36 +11:00
@@ -356,7 +356,7 @@
}
} while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
- if (error != 0) {
+ if (error != 0 && printk_ratelimit()) {
printk(KERN_WARNING "error: reading the clock failed (%d)\n",
error);
return;
@@ -384,7 +384,7 @@
do {
error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
if (error == RTAS_CLOCK_BUSY || rtas_is_extended_busy(error)) {
- if (in_interrupt()) {
+ if (in_interrupt() && printk_ratelimit()) {
printk(KERN_WARNING "error: reading clock would delay interrupt\n");
return; /* delay not allowed */
}
@@ -395,7 +395,7 @@
}
} while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
- if (error != 0) {
+ if (error != 0 && printk_ratelimit()) {
printk(KERN_WARNING "error: reading the clock failed (%d)\n",
error);
return;
@@ -430,7 +430,7 @@
}
} while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
- if (error != 0)
+ if (error != 0 && printk_ratelimit())
printk(KERN_WARNING "error: setting the clock failed (%d)\n",
error);
More information about the Linuxppc64-dev
mailing list