From: Andrew Isaacson <adisaacs@mtu.edu>
To: axp-list@redhat.com
Subject: patch: configurable logging of unaligned accesses
Date: Sat, 8 Aug 1998 17:42:15 -0400 [thread overview]
Message-ID: <19980808174215.C6807@mtu.edu> (raw)
I got annoyed about netstat and XF86_SVGA filling my logs files with
'unaligned access' messages, so I decided to do something about it.
This patch adds /proc/sys/kernel/log-unaligned, which by default
contains 0 (no logging). 'echo 1 > /proc/sys/kernel/log-unaligned' to
re-enable logging.
I'm not on axp-list, so please CC me on any discussion (I will check
the archives, though).
Question for the experts: Is it OK to use __alpha__ like I did in
kernel/sysctl.c? Or should this be abstracted?
-andy
diff -ur linux/arch/alpha/kernel/traps.c v2.0.35-ap-unaligned-fix/arch/alpha/kernel/traps.c
--- linux/arch/alpha/kernel/traps.c Wed Jun 3 17:17:46 1998
+++ v2.0.35-ap-unaligned-fix/arch/alpha/kernel/traps.c Sat Aug 8 15:10:28 1998
@@ -276,6 +276,8 @@
* uses them as temporary storage for integer memory to memory copies.
* However, we need to deal with stt/ldt and sts/lds only.
*/
+int kern_log_unaligned = 0;
+
asmlinkage void do_entUnaUser(void * va, unsigned long opcode, unsigned long reg,
unsigned long * frame)
{
@@ -288,15 +290,17 @@
pc_addr = frame + 7 + 20 + 3 /* em86 */ + 1; /* pc in PAL frame */
- if (cnt >= 5 && jiffies - last_time > 5*HZ) {
- cnt = 0;
- }
- if (++cnt < 5) {
- printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
- current->comm, current->pid,
- *pc_addr - 4, va, opcode, reg);
+ if (kern_log_unaligned) {
+ if (cnt >= 5 && jiffies - last_time > 5*HZ) {
+ cnt = 0;
+ }
+ if (++cnt < 5) {
+ printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
+ current->comm, current->pid,
+ *pc_addr - 4, va, opcode, reg);
+ }
+ last_time = jiffies;
}
- last_time = jiffies;
++unaligned[1].count;
unaligned[1].va = (unsigned long) va - 4;
diff -ur linux/kernel/sysctl.c v2.0.35-ap-unaligned-fix/kernel/sysctl.c
--- linux/kernel/sysctl.c Sat Aug 8 15:26:41 1998
+++ v2.0.35-ap-unaligned-fix/kernel/sysctl.c Sat Aug 8 15:07:13 1998
@@ -25,6 +25,9 @@
/* External variables not in a header file. */
extern int panic_timeout;
+#ifdef __alpha__
+extern int kern_log_unaligned;
+#endif
#ifdef CONFIG_ROOT_NFS
@@ -147,6 +150,10 @@
64, 0644, NULL, &proc_dostring, &sysctl_string },
{KERN_JAVA_APPLETVIEWER, "java-appletviewer", binfmt_java_appletviewer,
64, 0644, NULL, &proc_dostring, &sysctl_string },
+#endif
+#ifdef __alpha__
+ {KERN_LOG_UNALIGNED, "log-unaligned", &kern_log_unaligned,
+ sizeof(kern_log_unaligned), 0644, NULL, &proc_dointvec},
#endif
{0}
};
--
Andy Isaacson adisaacs@mtu.edu adi@acm.org Fight Spam, join CAUCE:
http://www.csl.mtu.edu/~adisaacs/ http://www.cauce.org/
reply other threads:[~1998-08-08 21:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox