Bug 213801 - [lor] on Raspberry Pi Zero with raspbsd r307523 with bcm2835_audio.c and vchiq_core.c
Summary: [lor] on Raspberry Pi Zero with raspbsd r307523 with bcm2835_audio.c and vchi...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Only Me
Assignee: Oleksandr Tymoshenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-26 10:03 UTC by Benedict Reuschling
Modified: 2017-05-08 19:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benedict Reuschling freebsd_committer freebsd_triage 2016-10-26 10:03:18 UTC
I'm running a freshly installed FreeBSD-armv6-12.0-RPI-B-307523.img (based on 12-CURRENT) on a Raspberry Pi 0 (no camera module). When booting, I get the following lock order reversal: 

https://people.freebsd.org/~bcr/LOR/LOR-armv6-pi0-r307523.jpg

The first one (top of the screen) remains after rebooting the PI, the second one disappears.

I can provide further information upon request.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-11-07 17:39:25 UTC
A commit references this bug:

Author: gonzo
Date: Mon Nov  7 17:38:40 UTC 2016
New revision: 308424
URL: https://svnweb.freebsd.org/changeset/base/308424

Log:
  Fix locking in bcm2835_audio driver

  - Move all VCHI activity to worker thread: channel methods are called with
      non-sleepable lock held and VCHI uses sleepable lock.

  - In worker thread use sx(9) lock instead of mutex(9) for the same reason.

  PR:		213801, 205979

Changes:
  head/sys/arm/broadcom/bcm2835/bcm2835_audio.c
Comment 2 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2016-11-07 18:29:47 UTC
Fixed, thanks for reporting
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-05-08 19:58:38 UTC
A commit references this bug:

Author: gonzo
Date: Mon May  8 19:57:16 UTC 2017
New revision: 317974
URL: https://svnweb.freebsd.org/changeset/base/317974

Log:
  MFC r308424, r310636

  r308424:
  Fix locking in bcm2835_audio driver

  - Move all VCHI activity to worker thread: channel methods are called with
      non-sleepable lock held and VCHI uses sleepable lock.

  - In worker thread use sx(9) lock instead of mutex(9) for the same reason.

  PR:		213801, 205979

  r310636:
  [rpi] Fix bcm2835_audio locking and samples starvation

  Rework general approach to locking and working with audio worker thread:

  - Use flags to signal requested worker action
  - Fix submitted buffer calculations to avoid samples starvation
  - Protect buffer pointers with locks to fix race condition between callback
    and audio worker thread
  - Remove unnecessary vchi_service_use
  - Do not use lock to serialize VCHI requests since only one thread issues them now
  - Fix unloading signaling per hselasky@ suggestion
  - Add output to detect inconsistent callback data caused by possible firmware bug
    https://github.com/raspberrypi/firmware/issues/696
  - Add stats/debug sysctls to troubleshoot possible bugs

  PR:		213687, 205979, 215194

Changes:
_U  stable/11/
  stable/11/sys/arm/broadcom/bcm2835/bcm2835_audio.c