[PATCH] ppc64: Move EPOW log buffer to BSS
Olof Johansson
olof at austin.ibm.com
Sat Apr 10 09:25:06 EST 2004
Hi,
RTAS on IBM pSeries runs in real mode, so all pointers being passed in
to it need to be in low memory. There's two places in the RAS code that
passes in pointers to items on the stack, which might end up being above
the limit.
Below patch resolves this by creating a buffer in BSS + a lock for
serialization. There's no reason to worry about contention on the lock,
since rtas_call() also serializes on a single spinlock and this is an
infrequent code path in the first place.
Patch has been reviewed on linuxppc64-dev. Andrew, please apply.
Thanks,
Olof
Olof Johansson Office: 4F005/905
Linux on Power Development IBM Systems Group
Email: olof at austin.ibm.com Phone: 512-838-9858
All opinions are my own and not those of IBM
===== ras.c 1.17 vs edited =====
--- 1.17/arch/ppc64/kernel/ras.c Tue Mar 16 18:46:45 2004
+++ edited/ras.c Tue Apr 6 15:59:18 2004
@@ -109,6 +109,9 @@
}
__initcall(init_ras_IRQ);
+static struct rtas_error_log log_buf;
+static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
+
/*
* Handle power subsystem events (EPOW).
*
@@ -123,11 +126,17 @@
unsigned int size = sizeof(log_entry);
long status = 0xdeadbeef;
+ spin_lock(&log_lock);
+
status = rtas_call(rtas_token("check-exception"), 6, 1, NULL,
0x500, irq,
RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS,
1, /* Time Critical */
- __pa(&log_entry), size);
+ __pa(&log_buf), size);
+
+ log_entry = log_buf;
+
+ spin_unlock(&log_lock);
udbg_printf("EPOW <0x%lx 0x%lx>\n",
*((unsigned long *)&log_entry), status);
@@ -156,11 +165,17 @@
long status = 0xdeadbeef;
int fatal;
+ spin_lock(&log_lock);
+
status = rtas_call(rtas_token("check-exception"), 6, 1, NULL,
0x500, irq,
RTAS_INTERNAL_ERROR,
1, /* Time Critical */
- __pa(&log_entry), size);
+ __pa(&log_buf), size);
+
+ log_entry = log_buf;
+
+ spin_unlock(&log_lock);
if ((status == 0) && (log_entry.severity >= SEVERITY_ERROR_SYNC))
fatal = 1;
** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc64-dev
mailing list