Bug 197227

Summary: [PATCH] Fix mutexes in databases/db5 on ARMv6 and later
Product: Ports & Packages Reporter: Andrew Turner <Andrew>
Component: Individual Port(s)Assignee: Andrew Turner <Andrew>
Status: Closed FIXED    
Severity: Affects Some People CC: freebsd-arm, sbruno
Priority: --- Flags: mandree: maintainer-feedback+
Version: Latest   
Hardware: arm   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=205001
Bug Depends on:    
Bug Blocks: 261196    
Attachments:
Description Flags
Patch to fix mutexes on armv6 none

Description Andrew Turner freebsd_committer freebsd_triage 2015-01-31 16:20:01 UTC
Created attachment 152418 [details]
Patch to fix mutexes on armv6

The databases/db5 port uses it's own mutex implementation. Unfortunately on ARM it uses the deprecated swp instruction for these. On some hardware supported by the armv6 FreeBSD target architecture this instruction is unavailable so we disallow it here where possible.

The attached patch fixes this by using POSIX mutexes in this case.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-31 16:20:01 UTC
Auto-assigned to maintainer mandree@FreeBSD.org
Comment 2 Matthias Andree freebsd_committer freebsd_triage 2015-02-02 00:26:56 UTC
Hi Andrew,

I approve of the patch - be sure to commit a version you have tested though.

Do we need this on db48 and db6, too?
Comment 3 Sean Bruno freebsd_committer freebsd_triage 2015-02-13 21:54:00 UTC
(In reply to Matthias Andree from comment #2)
unpatched armv6 builds running here:

http://tasty.ysv.freebsd.org/build.html?mastername=11armv6-default&build=2015-02-13_21h52m43s

db48, db5 and db6.
Comment 4 Sean Bruno freebsd_committer freebsd_triage 2015-02-14 00:49:08 UTC
Hrm.  All three built with no error.  I assume that this is a runtime, not a compile issue then?
Comment 5 Andrew Turner freebsd_committer freebsd_triage 2015-02-14 11:10:03 UTC
I have a local patch to llvm to not allow the bad instructions, unfortunately it's not able to be sent upstream as it breaks using them on earlier arm platforms where they are valid. I can test the other ports with these patches when I've cleared out my current patch queue.
Comment 6 Sean Bruno freebsd_committer freebsd_triage 2015-05-07 17:06:21 UTC
(In reply to Andrew Turner from comment #5)
Andrew:

Should I commit this to the db ports?
Comment 7 Sean Bruno freebsd_committer freebsd_triage 2015-05-07 17:08:59 UTC
Wait ... db48/db5/db6 all build for armv6 now.  This patch isn't needed anymore apparently.
Comment 8 Sean Bruno freebsd_committer freebsd_triage 2015-05-07 17:21:22 UTC
(In reply to Sean Bruno from comment #7)
No, this is a runtime not a buildtime failure.  Still needed and should be committed.
Comment 9 commit-hook freebsd_committer freebsd_triage 2015-05-07 17:36:33 UTC
A commit references this bug:

Author: sbruno
Date: Thu May  7 17:35:35 UTC 2015
New revision: 385644
URL: https://svnweb.freebsd.org/changeset/ports/385644

Log:
  enable posix-mutexes by default for armv6 targets as db will crash and burn
  when using the internal mutex implementation via unsupported instructions.

  PR:		197227
  Submitted by:	andrew@
  Approved by:	mandree@

Changes:
  head/databases/db48/Makefile
  head/databases/db5/Makefile
  head/databases/db6/Makefile