From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 634 invoked from network); 8 Aug 1998 21:42:19 -0000 Received: from news.mtu.edu (root@141.219.70.11) by mail2.redhat.com with SMTP; 8 Aug 1998 21:42:19 -0000 Received: from mtu.edu (root@mtu.edu [141.219.70.1]) by news.mtu.edu (8.8.8/8.8.8) with ESMTP id RAA10495 for ; Sat, 8 Aug 1998 17:42:18 -0400 (EDT) Received: from wiley.sas.it.mtu.edu (wiley.sas.it.mtu.edu [141.219.36.70]) by mtu.edu (8.8.8/8.8.8) with ESMTP id RAA21350 for ; Sat, 8 Aug 1998 17:42:17 -0400 (EDT) Received: (from adisaacs@localhost) by wiley.sas.it.mtu.edu (8.8.7/8.8.7/mturelay-1.2) id RAA07031 for axp-list@redhat.com; Sat, 8 Aug 1998 17:42:15 -0400 (EDT) Message-ID: <19980808174215.C6807@mtu.edu> Date: Sat, 8 Aug 1998 17:42:15 -0400 From: Andrew Isaacson To: axp-list@redhat.com Subject: patch: configurable logging of unaligned accesses Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.1 X-PGP-Fingerprint: 48 01 21 E2 D4 E4 68 D1 B8 DF 39 B2 AF A3 16 B9 X-PGP-Key-URL: http://www.csl.mtu.edu/~adisaacs/pgp.txt 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/