The patch titled
Provide better printk() support for SMP machines
has been added to the -mm tree. Its filename is
provide-better-printk-support-for-smp-machines.patch
Patches currently in -mm which might be from [EMAIL PROTECTED] are
provide-better-printk-support-for-smp-machines.patch
export-file_ra_state_init-again.patch
cachefs-filesystem.patch
cachefs-documentation.patch
add-page-becoming-writable-notification.patch
provide-a-filesystem-specific-syncable-page-bit.patch
make-afs-use-cachefs.patch
split-general-cache-manager-from-cachefs.patch
turn-cachefs-into-a-cache-backend.patch
rework-the-cachefs-documentation-to-reflect-fs-cache-split.patch
update-afs-client-to-reflect-cachefs-split.patch
make-page-becoming-writable-notification-a-vma-op-only-kafs-fix.patch
files-break-up-files-struct-warning-fix.patch
From: David Howells <[EMAIL PROTECTED]>
The attached patch prevents oopses interleaving ] with characters from other
printks on other CPUs by only breaking the lock if the oops is happening on
the machine holding the lock.
It might be better if the oops generator got the] lock and then called an inner
vprintk routine that assumed the caller holds the lock, thus making oops
reports "atomic".
Signed-Off-By: David Howells <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---
kernel/printk.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff -puN kernel/printk.c~provide-better-printk-support-for-smp-machines
kernel/printk.c
--- 25/kernel/printk.c~provide-better-printk-support-for-smp-machines Fri Jul
8 16:27:17 2005
+++ 25-akpm/kernel/printk.c Fri Jul 8 16:27:17 2005
@@ -514,6 +514,9 @@ asmlinkage int printk(const char *fmt, .
return r;
}
+/* cpu currently holding logbuf_lock */
+static volatile unsigned int printk_cpu = UINT_MAX;
+
asmlinkage int vprintk(const char *fmt, va_list args)
{
unsigned long flags;
@@ -522,11 +525,15 @@ asmlinkage int vprintk(const char *fmt,
static char printk_buf[1024];
static int log_level_unknown = 1;
- if (unlikely(oops_in_progress))
+ preempt_disable();
+ if (unlikely(oops_in_progress) && printk_cpu == raw_smp_processor_id())
+ /* If a crash is occurring during printk() on this CPU,
+ * make sure we can't deadlock */
zap_locks();
/* This stops the holder of console_sem just where we want him */
spin_lock_irqsave(&logbuf_lock, flags);
+ printk_cpu = raw_smp_processor_id();
/* Emit the output into the temporary buffer */
printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args);
@@ -588,13 +595,14 @@ asmlinkage int vprintk(const char *fmt,
log_level_unknown = 1;
}
- if (!cpu_online(smp_processor_id())) {
+ if (!cpu_online(raw_smp_processor_id())) {
/*
* Some console drivers may assume that per-cpu resources have
* been allocated. So don't allow them to be called by this
* CPU until it is officially up. We shouldn't be calling into
* random console drivers on a CPU which doesn't exist yet..
*/
+ printk_cpu = UINT_MAX;
spin_unlock_irqrestore(&logbuf_lock, flags);
goto out;
}
@@ -604,6 +612,7 @@ asmlinkage int vprintk(const char *fmt,
* We own the drivers. We can drop the spinlock and let
* release_console_sem() print the text
*/
+ printk_cpu = UINT_MAX;
spin_unlock_irqrestore(&logbuf_lock, flags);
console_may_schedule = 0;
release_console_sem();
@@ -613,9 +622,11 @@ asmlinkage int vprintk(const char *fmt,
* allows the semaphore holder to proceed and to call the
* console drivers with the output which we just produced.
*/
+ printk_cpu = UINT_MAX;
spin_unlock_irqrestore(&logbuf_lock, flags);
}
out:
+ preempt_enable();
return printed_len;
}
EXPORT_SYMBOL(printk);
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html