From owner-freebsd-arch@FreeBSD.ORG Wed Feb 5 20:07:19 2014 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D56E336E; Wed, 5 Feb 2014 20:07:19 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A77711346; Wed, 5 Feb 2014 20:07:19 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1WB8kb-000PKe-0J; Wed, 05 Feb 2014 20:07:13 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s15K7928066286; Wed, 5 Feb 2014 13:07:09 -0700 (MST) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/XgrM3KQlgFaYgSGKBbufn Subject: Re: Malloc alignment in libstand / loader(8) From: Ian Lepore To: John Baldwin In-Reply-To: <2882663.sRzekugaiD@ralph.baldwin.cx> References: <1391576134.1196.21.camel@revolution.hippie.lan> <2882663.sRzekugaiD@ralph.baldwin.cx> Content-Type: text/plain; charset="us-ascii" Date: Wed, 05 Feb 2014 13:07:09 -0700 Message-ID: <1391630829.1196.31.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-arch@FreeBSD.org 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 20:07:19 -0000 On Wed, 2014-02-05 at 08:29 -0500, John Baldwin wrote: > 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) > I wasn't sure if it's a good idea to #include in the libstand environment, since it has declarations for a lot of stuff. I looked at what's in systm.h and then hand-replicated what seemed like the most generic of the choices. -- Ian