From owner-svn-src-all@FreeBSD.ORG Tue Nov 4 17:50:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58B17AB2; Tue, 4 Nov 2014 17:50:32 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B4C33FE; Tue, 4 Nov 2014 17:50:32 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XliFS-0000gS-9t; Tue, 04 Nov 2014 17:50:30 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sA4HoT7W002623; Tue, 4 Nov 2014 10:50:29 -0700 (MST) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19ci0eIT/eZH635goIk4hFw X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r274088 - head/sys/kern From: Ian Lepore To: Bruce Evans In-Reply-To: <20141105023323.O1105@besplex.bde.org> References: <201411041129.sA4BTnwX030600@svn.freebsd.org> <20141104114041.GA21297@dft-labs.eu> <20141105023323.O1105@besplex.bde.org> Content-Type: text/plain; charset="us-ascii" Date: Tue, 04 Nov 2014 10:50:29 -0700 Message-ID: <1415123429.1200.75.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2014 17:50:32 -0000 On Wed, 2014-11-05 at 03:19 +1100, Bruce Evans wrote: > [...] > Another unsuitable alignment is by the MD ALIGNBYTES macro. This is > (sizeof(register_t) - 1) on all arches except mips 32-bit where it is 7 > sparc64 where it is 15. On arm, it is 3, but arm also has > STACKALIGNBYTES = 7. The register size is really too small to use for > malloc() on 32-bit arches. Its technical correctness depends on no > C objects having more than 32-bit alignment. On i386, int64_t and > double should have 64-bit alignment, but this is not required unless > CFLAGS includes -malign-double which breaks the ABI in userland and > is irrelevant for the kernel. > In arm/include/_align.h we have: /* * Round p (pointer or byte index) up to a correctly-aligned value * for all data types (int, long, ...). [more words snipped] */ #define _ALIGNBYTES (sizeof(int) - 1) So that's clearly wrong, because int64_t and double types require 8-byte alignment. When it comes to fixing it, I could: * include _types.h and use sizeof(__int64_t) * use sizeof(long long) * use sizeof(double) * just hardcode '7' with a comment that says why What are the pros and cons of the various options? Is one of them preferable? Is there something even better I overlooked? -- Ian