Skip to content

sys/ztimer: convert clock do not require pm#16573

Merged
fjmolinas merged 1 commit intoRIOT-OS:masterfrom
kfessel:p-convert-ztimer-require-no-pm
Jun 28, 2021
Merged

sys/ztimer: convert clock do not require pm#16573
fjmolinas merged 1 commit intoRIOT-OS:masterfrom
kfessel:p-convert-ztimer-require-no-pm

Conversation

@kfessel
Copy link
Copy Markdown
Contributor

@kfessel kfessel commented Jun 18, 2021

avoid blocking and unblocking of power mode 0 for convert clocks

@vincent-d identified in #15911 that pm should be done in base clock which was implemented in the huge ztimer auto init overhaul, but it was lacking the not blocking and not unblocking of #15911 for convert clocks which by default are set to 0 (un)blocking that pm

this removes that flaw

in contrast to my comment in #15911 ztimer/convert_muldiv64.c and ztimer/convert_shift.c do not need modification since they call the init of ztimer/convert.c

Contribution description

this add setting convert clocks to require no pm (the base clock should have the pm blocking setup correctly)

Testing procedure

have hardware that operates with pm_mode 0 active, check the power consumption while you expect it sleeping, check if it wakes up when required.

i don't have such a setup (stm loses most of their mem with pm 0), but would @vincent-d and maybe @jue89 to have.

while one may not be able to test the effect it should be possible to check what this does by:

build and flash tests/ztimer_xsec with USEMODULE=pm_layered to your favorite board and make debug

(gdb) b main

on a second console make term and start Help: Press s to start test, r to print it is ready -> [s] and [return]

back to the first console and see

Breakpoint 1 at 0x80000f0: file ztimer_xsec/main.c, line 57.
(gdb) p ZTIMER_SEC->block_pm_mode

ante patch -> $n = 0 '\000' means block an unblock pm 0 what ZTIMER_SEC should not do
post patch -> $n = 255 '\377' means do not do any pm thing for ZTIMER_SEC ✔️

Issues/PRs references

fixes what is left of #15911

I think this should be added to the ztimer project

@kfessel kfessel requested review from fjmolinas, jue89 and vincent-d June 18, 2021 16:48
@kfessel kfessel added Area: CI Area: Continuous Integration of RIOT components Area: timers Area: timer subsystems CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Jun 18, 2021
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Jun 18, 2021

this could also be achieved by having
.block_pm_mode = ZTIMER_CLOCK_NO_REQUIRED_PM_MODE
as a default in ztimer_init_extend() and ensure it is written to the correct value after the clock Initialisation is called (this is case for all clocks in ztimer/auto_init.c)

@kfessel kfessel added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 19, 2021
@kfessel kfessel closed this Jun 21, 2021
@kfessel kfessel reopened this Jun 21, 2021
@github-actions github-actions bot added Area: sys Area: System and removed Area: CI Area: Continuous Integration of RIOT components labels Jun 21, 2021
@kfessel
Copy link
Copy Markdown
Contributor Author

kfessel commented Jun 21, 2021

closed and reopend to trigger github actions that failed due to partial github failure

@kfessel kfessel added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 21, 2021
@kfessel kfessel force-pushed the p-convert-ztimer-require-no-pm branch from a884fb6 to 6c452d5 Compare June 21, 2021 11:54
avoid blocking and unblocking of power_mode 0 for convert clocks
@kfessel kfessel force-pushed the p-convert-ztimer-require-no-pm branch from 6c452d5 to a6a53c9 Compare June 21, 2021 11:56
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@MrKevinWeiss
Copy link
Copy Markdown
Contributor

This would be great to get in for the release, maybe someone could test as the code looks OK. ping @vincent-d @jue89 @fjmolinas

Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, I was able to reproduce the test procedure (checking the mode value in gdb)

(gdb) p ZTIMER_SEC->block_pm_mode
$1 = 255 '\377'

@fjmolinas fjmolinas merged commit bc5810e into RIOT-OS:master Jun 28, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 13, 2021
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: sys Area: System Area: timers Area: timer subsystems CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants