Unaligned accesses (was Re: debian on ruffian)
On Mon, Sep 14, 1998 at 09:47:49AM -0400, Christopher C Chimelis wrote:
> On Mon, 14 Sep 1998, David Monro wrote:
> > The machine is now working (and I even got OSF/1 netscape running). A few
> > things are still kooky:
> >
> > The X server generates unaligned accesses when running netscape.
>
> Normal. I wouldn't worry too much about unaligned accesses (just a sign
> of poor coding and non-portability). You can even comment out the lines
> in the kernel source that report that stuff if you REALLY don't want to be
> bothered.
The X server unaligned accesses are apparently fixable, and there
might be a fix in the next X release. I'll see about getting a patch
if anyone is interested.
In the meantime, I've got a kernel patch that allows a bit more
control over how the kernel logs unaligned accesses. This patch
creates a new /proc file, /proc/sys/kernel/log-unaligned. If this
file contains '0', unaligned accesses are not logged. If this file
contains '1', unaligned accesses are logged.
I'd appreciate knowing if anybody finds this useful.
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
--
Andy Isaacson adisaacs@mtu.edu adi@acm.org Fight Spam, join CAUCE:
http://www.csl.mtu.edu/~adisaacs/ http://www.cauce.org/
Reply to: