From owner-freebsd-arm@freebsd.org Tue May 24 22:55:50 2016 Return-Path: Delivered-To: freebsd-arm@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 F2AFFB49F71 for ; Tue, 24 May 2016 22:55:50 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D94B21482 for ; Tue, 24 May 2016 22:55:50 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: ba7a09ef-2202-11e6-9de8-1b78d5a2543b X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Tue, 24 May 2016 22:56:19 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u4OMtmZ2001072; Tue, 24 May 2016 16:55:48 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1464130548.1204.25.camel@freebsd.org> Subject: Re: xorg broken on Beaglebone black revision 300438 From: Ian Lepore To: Mark Millard Cc: freebsd-arm Date: Tue, 24 May 2016 16:55:48 -0600 In-Reply-To: References: <1464127156.1204.10.camel@freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 22:55:51 -0000 On Tue, 2016-05-24 at 15:19 -0700, Mark Millard wrote: > On 2016-May-24, at 2:59 PM, Ian Lepore wrote: > > > On Tue, 2016-05-24 at 14:35 -0700, Mark Millard wrote: > > > Quoting from Otacílio Tue May 24 00:06:10 UTC 2016 and its locore > > > -v6.S changes: > > > > > > > - orr r7, #CPU_CONTROL_UNAL_ENABLE > > > > - orr r7, #CPU_CONTROL_AFLT_ENABLE > > > > + bic r7, #CPU_CONTROL_UNAL_ENABLE > > > > + bic r7, #CPU_CONTROL_AFLT_ENABLE > > > > > > -r295256 (2016-Feb-14) changed from: > > > > > > bic r7, #CPU_CONTROL_UNAL_ENABLE > > > > > > to: > > > > > > orr r7, #CPU_CONTROL_UNAL_ENABLE > > > > > > in two places (moving it a few lines down for each example as > > > well). > > > So this much of the proposed changes would be reverting the > > > -r295256 > > > change. The check in comment indicates the bit is RAO/SBOP for > > > armv7. > > > For armv6 the check in comment claims it controls armv5 > > > compatible > > > alignment support. > > > > > > But: > > > > > > orr r7, #CPU_CONTROL_AFLT_ENABLE > > > > > > has been in locore-v6.S since the file's first checkin. So this > > > change to bic here be new. > > > > > > What is the FreeBSD intent for each of the two new settings for > > > armv7? armv6? > > > > > > > It was always wrong to clear CPU_CONTROL_UNAL_ENABLE on armv7 (it's > > documented as RAO/SBOP). Setting it on armv6 makes the v6 (which > > is > > only the RPi in our world) behave the same as v7. So that change > > was > > just a bugfix. > > > > I think FreeBSD is the only major OS left that is enforcing strict > > alignment on armv6/v7 and it causes a lot of trouble for ports and > > other 3rd party software, and prevents us from enabling certain > > compiler options and optimizations. I'm very close to a commit to > > stop > > enforcing strict alignment (clear rather than > > CPU_CONTROL_AFLT_ENABLE). > > I've been testing it yesterday and today, and haven't run into any > > trouble at all. > > > > -- Ian > > Good to know. I had submitted at least one port bug report that will > likely need to be canceled if this goes through. Effectively its an > ABI change allowing a wider variety of code to be compliant. > It was partly all that testing you did a few months ago, and the PRs and discussions coming out of that, which are driving these changes. If I could get away with procrastinating a bit more, I probably would (always too busy), but with the big hardfloat abi change and with a code freeze coming up later this week, this seems like the last chance to do some disruptive changes that are long overdue. > Is the kernel involved in emulating access/instructions via some > technique for misaligned access for armv6/armv7 for some types of > instructions? Are there performance issues/tradeoffs that might > contribute to sometimes choosing to be careful about alignment? > Nope, no emulation, the hardware is able to do this, we've just always run with alignment faults enabled, partly because base freebsd already has to work on other strict-alignment hardware anyway. The driver of this change is ports more than anything -- increasingly you run into code that assumes #ifdef __arm__ is sufficient to mean "unaligned access will work". There are a few arm instructions that still require alignment, but (at least in theory) the compiler knows about that and only emits those instructions when it knows they're safe (such as it knowing that the stack stays aligned to 8-byte boundaries in non-leaf functions). We'll see; everything seems okay in testing I've done so far. Performance-wise, there is a cost for unaligned access. The hardware has to do more work so unaligned accesses take extra cycles. On the other hand, if the data is unaligned, you also have to use extra cycles, potentially a lot of them, to copy-align the data or access it a byte at a time and reassmble it in a register. In theory this should be faster than doing copy-align stuff. -- Ian > In one way I liked the strict alignment environment being around: It > allowed easily testing if software was more portable for such issues > vs. not. (Not that FreeBSD should use such criteria for its choices.) >