linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernel/printk.c  lockless access
@ 2005-01-06 19:58 Linas Vepstas
  2005-01-06 20:50 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Linas Vepstas @ 2005-01-06 19:58 UTC (permalink / raw)
  To: akpm, linux-kernel, torvalds

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]


Hi Linus, Andrew,

I was wondering if you could see your way to accepting the attached
patch, which provides access to the syslog buffer pointers.

The basic idea is that if a system has crashed, it can be handy to
be able to view the contents of the syslog buffer.  Unfortunately,
this is currently hard to do.

 --  char __log_buf[] is declared static in printk.c, so it cannot
     be found in the ksyms table.

 -- do_syslog() uses spinlocks to protect the data structure, and
    so will typically deadlock if called.

The 'fix' is to provide a routine that simply returns the pointers
to the log buffer.  

I'd be thrilled to have this patch accepted ... 

--linas

Signed-off-by: Linas Vepstas <linas@linas.org>



[-- Attachment #2: printk.patch --]
[-- Type: text/plain, Size: 940 bytes --]

===== kernel/printk.c 1.47 vs edited =====
--- 1.47/kernel/printk.c	2004-11-19 01:03:10 -06:00
+++ edited/kernel/printk.c	2005-01-06 13:44:36 -06:00
@@ -380,6 +380,23 @@ asmlinkage long sys_syslog(int type, cha
 	return do_syslog(type, buf, len);
 }
 
+#ifdef   CONFIG_DEBUG_KERNEL
+/**
+ * Its very handy to be able to view the syslog buffer during debug.
+ * But do_syslog() uses locks and so it will deadlock if called during 
+ * a debugging session. The routine provides the start and end of the 
+ * physical and logical logs, and is equivalent to do_syslog(3).
+ */
+
+void debugger_syslog_data(char *syslog_data[4])
+{
+	syslog_data[0] = log_buf;
+	syslog_data[1] = log_buf + __LOG_BUF_LEN;
+	syslog_data[2] = log_buf + log_end - (logged_chars < __LOG_BUF_LEN ? logged_chars : __LOG_BUF_LEN);
+	syslog_data[3] = log_buf + log_end;
+}
+#endif   /* CONFIG_DEBUG_KERNEL */
+
 /*
  * Call the console drivers on a range of log_buf
  */

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-01-10 20:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-06 19:58 [PATCH] kernel/printk.c lockless access Linas Vepstas
2005-01-06 20:50 ` Andi Kleen
2005-01-07  0:12 ` Andrew Morton
2005-01-07  0:26   ` Anton Blanchard
2005-01-07  0:25     ` Randy.Dunlap
2005-01-07  1:54       ` Alan Cox
2005-01-09 10:44         ` Frank van Maarseveen
2005-01-09 22:31           ` David Wagner
2005-01-09 23:00           ` Alan Cox
2005-01-10 20:43             ` Matt Mackall
2005-01-08  2:37 ` Keith Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).