Date: Wed, 18 Feb 2009 15:44:14 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: bms@incunabulum.net Cc: xcllnt@mac.com, mips@FreeBSD.org, tinderbox@FreeBSD.org, current@FreeBSD.org Subject: Re: [head tinderbox] failure on mips/mips Message-ID: <20090218.154414.-1283372409.imp@bsdimp.com> In-Reply-To: <499C8396.2020000@incunabulum.net> References: <BE046876-F8EF-4269-9CD6-743483EC1869@mac.com> <20090218.120514.831271136.imp@bsdimp.com> <499C8396.2020000@incunabulum.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <499C8396.2020000@incunabulum.net> Bruce Simpson <bms@incunabulum.net> writes: : M. Warner Losh wrote: : > ... : > : The point being that programmers *do* code with certain : > : assumptions and as soon as those assumptions don't hold on : > : a platform, you end up worse off. My thoughts for MIPS n32 : > : are to make it behave like any "normal" 32-bit strong- : > : alignment platform to avoid 1) a large number of runtime : > : alignment faults -- which are a bigger performance bottleneck : > : than forcing 64-bit integrals to be accessed with 2 32-bit : > : accesses : > : : FWIW, Linux use a type-length-value protocol for the netlink routing : socket, so alignment issues of this kind are shifted around (forgive the : pun). FreeBSD does too for the most part, but it is only at the inter-message level, not intra-message. : > It also turns out that in this case, a simple (void *) is safe and : > causes no issues because that time_t isn't accessed... It does give : > one time to pause and think about it. : > : : Yes, the void * cast works around the issue for now, but doesn't offer : any guarantees that we are doing the right thing on strict alignment : architectures. : If the alignment *is* invalid, then we take the hit. Right. The compiler doesn't check it, but I just did and things are fine given the fields accessed. But its that last bit that's the problem... I also have changed the offending line in my tree to be u_long instead of time_t since that is a better match to the protocol, and also gives us 168 years of uptime before there's an issue. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090218.154414.-1283372409.imp>