From owner-svn-src-all@freebsd.org Fri Nov 13 14:10:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FD2AA2E996; Fri, 13 Nov 2015 14:10:30 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D181511DB; Fri, 13 Nov 2015 14:10:29 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from c124.sec.cl.cam.ac.uk (c124.sec.cl.cam.ac.uk [128.232.18.124]) (authenticated bits=0) by theravensnest.org (8.15.2/8.15.2) with ESMTPSA id tADEAK5j077058 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Nov 2015 14:10:21 GMT (envelope-from theraven@FreeBSD.org) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: svn commit: r290711 - head/sys/ofed/drivers/infiniband/core From: David Chisnall In-Reply-To: <20151113083543.GV2257@kib.kiev.ua> Date: Fri, 13 Nov 2015 14:10:20 +0000 Cc: Hans Petter Selasky , cem@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0330812D-2FB6-4490-BFB3-67F9E66975A7@FreeBSD.org> References: <201511121012.tACACKTI075143@repo.freebsd.org> <56459CEE.4090007@selasky.org> <20151113083543.GV2257@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Fri, 13 Nov 2015 14:10:30 -0000 On 13 Nov 2015, at 08:35, Konstantin Belousov = wrote: >=20 > On Fri, Nov 13, 2015 at 09:18:54AM +0100, Hans Petter Selasky wrote: >> Hi, >>=20 >> On 11/12/15 18:17, Conrad Meyer wrote: >>> These should cast through (u)intptr_t rather than unsigned long. >>>=20 >>=20 >> This is Linux code, and they use "unsigned long" for pointer casts=20 >> everywhere, trying to not break their style. >>=20 >> BTW: I added to linux_compat.c: >>=20 >> CTASSERT(sizeof(unsigned long) =3D=3D sizeof(uintptr_t)); >>=20 >> And it survived my "tinderbox" build and I was surprised! >=20 > FreeBSD (at least currently) runs on two kinds of ABIs: ILP32 and = LP64. > ILP32 means that sizeof(int) =3D=3D sizeof(long) =3D=3D sizeof(void *) = =3D=3D 4. > For LP64, sizeof(long) =3D=3D sizeof(void *) =3D=3D 8, while = sizeof(int) =3D=3D 4. > We do not support anything else. Note that this is not true of all downstreams. We currently have 128 = and 256-bit void*s with 64-bit longs on CHERI, and I believe that = bde=E2=80=99s version has 32-bit longs on all platforms. This kind of = code *is* broken for us and we=E2=80=99d greatly appreciate people not = writing new code that intentionally relies on undefined behaviour (round = tripping a pointer via any integer type other than intptr_t is undefined = in C), when a well-defined mechanism exists, just because Linux decides = to do the wrong thing. David