Re: armv7 alignment faults

2017-07-04 Thread Artturi Alm
On Tue, Jul 04, 2017 at 05:14:00AM +0200, Jeremie Courreges-Anglas wrote:
> Artturi Alm  writes:
> 
> > Hi,
> >
> > i think i've noted about this before, around 13months ago freebsd
> > first disabled alignment faults, and they haven't enabled them since.
> > deja vu, or not, i don't recall if the last diff like below did go
> > anywhere, nor if it got discussed about, so i'm sorry in advance,
> > if i'm banging my head to the wall with this one.
> 
> AFAIK we're rather headed towards strict alignement rules whenever
> possible.
> 

Yep, kind of presumed so, and should of have studied the issue further,
to find out that it was just the git, which i needed most at the time.

> > and indeed, even git is unusable without this (on latest snapshot w/git
> > installed from packages), 'git branch' did happen to be the only command
> > of the few i tried,
> > that didn't end up into SIGBUS, but even it fails reliably w/-v..
> 
> They messed up their new sha1 implementation.  Should be fixed with
> git-2.13.1p0, git-2.13.2 works fine here.
> 

Thanks for the info, diff withdrawn, and it's sysctl-knob-diff version rm'd.

> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE


I understand why this alignment correctness is wanted, and appreciate it's
performance winnings, exposure to bugs etc., i just got fooled by having not
been user of armv7 for around an year or so, and git was the first and only
package i had installed when i sent out the diff while being under false
impression of current. sheer bad luck w/regards timing to hit the bug in git.

-Artturi



Re: armv7 alignment faults

2017-07-03 Thread Theo de Raadt
> > i think i've noted about this before, around 13months ago freebsd
> > first disabled alignment faults, and they haven't enabled them since.
> > deja vu, or not, i don't recall if the last diff like below did go
> > anywhere, nor if it got discussed about, so i'm sorry in advance,
> > if i'm banging my head to the wall with this one.
> 
> AFAIK we're rather headed towards strict alignement rules whenever
> possible.

right.

fact: there are strict alignment architectures.
fact: there are non-strict alignment architectures, in fact now the
  majority by install base.

if we don't provide encouragement for developers to pay attention to
strict alignment architectures today, we might as well send them all
the ones we have to the recycler today, right?

for nearly 20 years I've spoken about the strengths we gain from
supporting diverse platforms.

as to whether we are headed to a world where all platforms are
non-strict?  in hardware?  I don't believe it.  In software, sure but
the emulation cost in hw or sw is never really free.

it comes with a complexity we all pay for, and it limits future
innovation.  so in some ways I'd prefer if we allow them to survive,
by continuing to demand a sw ecosystem that recognizes their
existance.

> They messed up their new sha1 implementation.  Should be fixed with
> git-2.13.1p0, git-2.13.2 works fine here.

and in this case, it found a bug which affected all the other strict
platforms.  I rest my case.



Re: armv7 alignment faults

2017-07-03 Thread Jeremie Courreges-Anglas
Artturi Alm  writes:

> Hi,
>
> i think i've noted about this before, around 13months ago freebsd
> first disabled alignment faults, and they haven't enabled them since.
> deja vu, or not, i don't recall if the last diff like below did go
> anywhere, nor if it got discussed about, so i'm sorry in advance,
> if i'm banging my head to the wall with this one.

AFAIK we're rather headed towards strict alignement rules whenever
possible.

> and indeed, even git is unusable without this (on latest snapshot w/git
> installed from packages), 'git branch' did happen to be the only command
> of the few i tried,
> that didn't end up into SIGBUS, but even it fails reliably w/-v..

They messed up their new sha1 implementation.  Should be fixed with
git-2.13.1p0, git-2.13.2 works fine here.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



armv7 alignment faults

2017-07-03 Thread Artturi Alm
Hi,

i think i've noted about this before, around 13months ago freebsd
first disabled alignment faults, and they haven't enabled them since.
deja vu, or not, i don't recall if the last diff like below did go
anywhere, nor if it got discussed about, so i'm sorry in advance,
if i'm banging my head to the wall with this one.

and indeed, even git is unusable without this (on latest snapshot w/git
installed from packages), 'git branch' did happen to be the only command
of the few i tried,
that didn't end up into SIGBUS, but even it fails reliably w/-v..

# git branch
* av7_a4x_dsb
  av7_use_uvm
  master
# git branch -v
Bus error (core dumped) 

the diff below still id enough to get over those, and let the
software run regardless of it's assumptions about what is right or wrong.

$ git branch -v
* av7_a4x_dsb b065a9e59a0 [ahead 1] gotta try
  av7_use_uvm 7f8cb8f2d0d [behind 1] whitespace
  master  7f8cb8f2d0d whitespace

small quote of the related fbsd commit msg:
"The hardware we support has always been
able to do unaligned accesses, we've just never enabled it until now.

This brings FreeBSD into line with all the other major OSes, and should help
with the growing volume of 3rd-party software that assumes unaligned access
will just work on armv6 and armv7."

major or not, more usable w/o diving into ports would be much appreciated.
-Artturi


diff --git a/sys/arch/arm/arm/cpufunc.c b/sys/arch/arm/arm/cpufunc.c
index c91108e7066..716628750dd 100644
--- a/sys/arch/arm/arm/cpufunc.c
+++ b/sys/arch/arm/arm/cpufunc.c
@@ -396,7 +396,6 @@ armv7_setup()
| CPU_CONTROL_AFE;
 
cpuctrl = CPU_CONTROL_MMU_ENABLE
-   | CPU_CONTROL_AFLT_ENABLE
| CPU_CONTROL_DC_ENABLE
| CPU_CONTROL_BPRD_ENABLE
| CPU_CONTROL_IC_ENABLE