From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 5412 invoked from network); 31 Aug 1998 19:10:57 -0000 Received: from mail.redhat.com (199.183.24.239) by mail2.redhat.com with SMTP; 31 Aug 1998 19:10:57 -0000 Received: from cygnus.com (runyon.cygnus.com [205.180.230.5]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id PAA13396 for ; Mon, 31 Aug 1998 15:11:39 -0400 Received: from dot.cygnus.com (dot.cygnus.com [205.180.230.224]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id MAA29785; Mon, 31 Aug 1998 12:10:49 -0700 (PDT) Received: (rth@localhost) by dot.cygnus.com (8.8.7/8.6.4) id MAA11659; Mon, 31 Aug 1998 12:10:49 -0700 Message-ID: <19980831121049.D9512@dot.cygnus.com> Date: Mon, 31 Aug 1998 12:10:49 -0700 From: Richard Henderson To: axp-list@redhat.com, torvalds@transmeta.com Subject: Re: Unaligned traps on kernel startup Reply-To: Richard Henderson References: <199808310601.AAA10916@ellpspace.math.ualberta.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1 In-Reply-To: <199808310601.AAA10916@ellpspace.math.ualberta.ca>; from Michal Jaegermann on Mon, Aug 31, 1998 at 12:01:06AM -0600 On Mon, Aug 31, 1998 at 12:01:06AM -0600, Michal Jaegermann wrote: > If on Alpha CONFIG_BLK_DEV_IDE is defined then with current kernels > (2.0.3x) one see the following on a startup: > > kernel: unaligned trap at fffffc00003a3278: fffffc00000061be 28 1 > kernel: unaligned trap at fffffc00003a328c: fffffc00000061c2 28 2 > kernel: unaligned trap at fffffc00003a3278: fffffc00000061ce 28 1 > kernel: unaligned trap at fffffc00003a328c: fffffc00000061d2 28 2 > > Here is the corresponding kernel code: > > 0xfffffc00003a3278 : ldl t0,0(t2) > 0xfffffc00003a327c : extbl t0,0x2,t0 > 0xfffffc00003a3280 : and t0,0x3f,t0 > 0xfffffc00003a3284 : cmpeq t0,0x1,t0 > 0xfffffc00003a3288 : > beq t0,0xfffffc00003a32ec > 0xfffffc00003a328c : ldl t1,4(t2) > 0xfffffc00003a3290 : extbl t1,0x2,t0 > 0xfffffc00003a3294 : and t0,0x3f,t0 > 0xfffffc00003a3298 : cmpeq t0,0x3f,t0 > 0xfffffc00003a329c : > > It is from linux/drivers/block/genhd.c and traps happen on lines > marked with '---->': > > 329 for (i = 0; i < 4 ; i++) { > 330 struct partition *q = &p[i]; > 331 if (NR_SECTS(q) > 332 -----> && (q->sector & 63) == 1 > 333 -----> && (q->end_sector & 63) == 63) { Linus, the compiler has gotten smart. It sees that those two character loads are contained in a structure with known alignment, and optimizes. I don't see a solution at the moment less gross than just marking the structure as packed. Alternately, I suppose we could turn off the unaligned access message in the kernel for the 2.2 release. r~ --- include/linux/genhd.h.orig Mon Aug 31 12:04:52 1998 +++ include/linux/genhd.h Mon Aug 31 12:05:09 1998 @@ -49,7 +49,7 @@ struct partition { unsigned char end_cyl; /* end cylinder */ unsigned int start_sect; /* starting sector counting from 0 */ unsigned int nr_sects; /* nr of sectors in partition */ -}; +} __attribute__((packed)); struct hd_struct { long start_sect;