[riot-commits] [RIOT-OS/RIOT] 5ecafa: sys/pm: Correctly access pm_blocker

Francisco noreply at github.com
Wed Jul 15 16:53:26 CEST 2020


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 5ecafab83dc46869bba22d08a08af2c481ea10a6
      https://github.com/RIOT-OS/RIOT/commit/5ecafab83dc46869bba22d08a08af2c481ea10a6
  Author: Marian Buschsieweke <marian.buschsieweke at ovgu.de>
  Date:   2020-07-15 (Wed, 15 Jul 2020)

  Changed paths:
    M sys/pm_layered/pm.c

  Log Message:
  -----------
  sys/pm: Correctly access pm_blocker

Replace `volatile` access to pm_blocker by guarding the accesses with
`irq_disable()` ... `irq_restore()`.

`volatile` does only guarantee that no compiler optimizations are performed on
a variable access, but does not provide atomic access. E.g. on systems with
a memory bus of less than 32 bit, the access to pm_blocker cannot be done
with a single CPU instruction. Thus, resorting to disabling IRQs is the easiest
and most portable way to actually achieve atomic access.


  Commit: 3934f9f09bd70069925df12edea1b7589152904f
      https://github.com/RIOT-OS/RIOT/commit/3934f9f09bd70069925df12edea1b7589152904f
  Author: Francisco <femolina at uc.cl>
  Date:   2020-07-15 (Wed, 15 Jul 2020)

  Changed paths:
    M sys/pm_layered/pm.c

  Log Message:
  -----------
  Merge pull request #13977 from maribu/pm_atomic_access

sys/pm: Correctly access pm_blocker


Compare: https://github.com/RIOT-OS/RIOT/compare/1167867d02ff...3934f9f09bd7


More information about the commits mailing list