Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] Fix panic in RTAS code

Some older pSeries machines were panicking in pSeries_log_error
because it was getting called before it was ready. This is a result
of commit "[POWERPC] pseries: Fix jumbled no_logging flag."
(79c0108d1b9db4864ab77b2a95dfa04f2dcf264c).

This fixes it by explicitly enabling RTAS error logging when it has
been initialized, and also makes the code clearer by renaming the
"no_more_logging" variable to "logging_enabled".

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by

Tony Breeds and committed by
Paul Mackerras
a0c7ce9c 2d5f5659

+9 -6
+9 -6
arch/powerpc/platforms/pseries/rtasd.c
··· 54 54 static int full_rtas_msgs = 0; 55 55 56 56 /* Stop logging to nvram after first fatal error */ 57 - static int no_more_logging; 58 - 57 + static int logging_enabled; /* Until we initialize everything, 58 + * make sure we don't try logging 59 + * anything */ 59 60 static int error_log_cnt; 60 61 61 62 /* ··· 218 217 } 219 218 220 219 /* Write error to NVRAM */ 221 - if (!no_more_logging && !(err_type & ERR_FLAG_BOOT)) 220 + if (logging_enabled && !(err_type & ERR_FLAG_BOOT)) 222 221 nvram_write_error_log(buf, len, err_type, error_log_cnt); 223 222 224 223 /* ··· 230 229 printk_log_rtas(buf, len); 231 230 232 231 /* Check to see if we need to or have stopped logging */ 233 - if (fatal || no_more_logging) { 234 - no_more_logging = 1; 232 + if (fatal || !logging_enabled) { 233 + logging_enabled = 0; 235 234 spin_unlock_irqrestore(&rtasd_log_lock, s); 236 235 return; 237 236 } ··· 303 302 304 303 spin_lock_irqsave(&rtasd_log_lock, s); 305 304 /* if it's 0, then we know we got the last one (the one in NVRAM) */ 306 - if (rtas_log_size == 0 && !no_more_logging) 305 + if (rtas_log_size == 0 && logging_enabled) 307 306 nvram_clear_error_log(); 308 307 spin_unlock_irqrestore(&rtasd_log_lock, s); 309 308 ··· 415 414 memset(logdata, 0, rtas_error_log_max); 416 415 rc = nvram_read_error_log(logdata, rtas_error_log_max, 417 416 &err_type, &error_log_cnt); 417 + /* We can use rtas_log_buf now */ 418 + logging_enabled = 1; 418 419 419 420 if (!rc) { 420 421 if (err_type != ERR_FLAG_ALREADY_LOGGED) {