From owner-freebsd-arch@FreeBSD.ORG Wed Feb 5 19:28:31 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B46FE4AD; Wed, 5 Feb 2014 19:28:31 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8C2511E2C; Wed, 5 Feb 2014 19:28:31 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 941F2B9C6; Wed, 5 Feb 2014 14:28:30 -0500 (EST) From: John Baldwin To: freebsd-arch@freebsd.org Subject: Re: Malloc alignment in libstand / loader(8) Date: Wed, 05 Feb 2014 08:29:19 -0500 Message-ID: <2882663.sRzekugaiD@ralph.baldwin.cx> User-Agent: KMail/4.10.5 (FreeBSD/10.0-STABLE; KDE/4.10.5; amd64; ; ) In-Reply-To: <1391576134.1196.21.camel@revolution.hippie.lan> References: <1391576134.1196.21.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 05 Feb 2014 14:28:30 -0500 (EST) Cc: Ian Lepore X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Feb 2014 19:28:31 -0000 On Tuesday, February 04, 2014 09:55:34 PM Ian Lepore wrote: > On newer ARM chips, the device drivers used by loader(8) require that > I/O buffers be aligned on cache line sized boundaries. The drivers are > part of u-boot which serves as a sort of load-time bios. > > Attached is a patch that sets the malloc alignment in libstand to 64 > bytes when compiled on ARM, and leaves it at 16 bytes for all other > platforms. If there are no objections I'd like to commit this soon. > > I've tested this on ARM, but have no way to test it on other platforms. > The changes should be a no-op on other platforms. I think this looks fine, but perhaps use CTASSERT() instead of rolling your own? (I would say to use _Static_assert(), but I don't think that works with our old GCC) -- John Baldwin