From: Linas Vepstas <linas@austin.ibm.com>
To: akpm@osdl.org, linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: [PATCH] kernel/printk.c lockless access
Date: Thu, 6 Jan 2005 13:58:12 -0600 [thread overview]
Message-ID: <20050106195812.GL22274@austin.ibm.com> (raw)
[-- 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
*/
next reply other threads:[~2005-01-06 20:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-06 19:58 Linas Vepstas [this message]
2005-01-06 20:50 ` [PATCH] kernel/printk.c lockless access 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050106195812.GL22274@austin.ibm.com \
--to=linas@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.