Commit 4a5ae525 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: ratelimit some rtas errors

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: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9cc70163
......@@ -102,6 +102,27 @@ rtas_token(const char *service)
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 @@ __fetch_rtas_last_error(void)
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;
......@@ -541,26 +557,6 @@ void rtas_stop_self(void)
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;
}
/*
* Call early during boot, before mem init or bootmem, to retreive the RTAS
* informations from the device-tree and allocate the RMO buffer for userland
......
......@@ -356,7 +356,7 @@ void pSeries_get_boot_time(struct rtc_time *rtc_tm)
}
} 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 @@ void pSeries_get_rtc_time(struct rtc_time *rtc_tm)
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 @@ void pSeries_get_rtc_time(struct rtc_time *rtc_tm)
}
} 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 @@ int pSeries_set_rtc_time(struct rtc_time *tm)
}
} 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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment