Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/ztimer: rename required_pm_mode to block_pm_mode #16160

Merged
merged 1 commit into from
Apr 7, 2021

Conversation

kfessel
Copy link
Contributor

@kfessel kfessel commented Mar 5, 2021

Contribution description

the mode that is stored in required_pm_mode would not keep clock running
but one mode higher therefor the timer needs to block that mode, the logic does it this way.

The define keeps it's name for compatiblity but its use should fade, when #15715 is merged,
and should be deprecated in the release after that.

this PR is backward compatible to previous name waiting for it to be deprecated and removed.

Testing procedure

build and test things that use pm_layerd and ztimer

Issues/PRs references

the name was introduced with #13722 maybe #13722 (comment)_ creted the name != function mismatch
this is in conflict with an other PR I am writing on: #15715 i will happily rebase either when the other is merged

@fjmolinas fjmolinas requested a review from jue89 March 6, 2021 13:57
@fjmolinas fjmolinas added Area: timers Area: timer subsystems Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. labels Mar 6, 2021
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

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

See inline

Comment on lines 332 to 346
union{
uint8_t required_pm_mode; /**< min. pm mode required for the clock to run */
uint8_t block_pm_mode; /**< min. pm mode to block for the clock to run */
};
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we really need backward compatibility here. Isn't this an internal API?

But if we really want this:

Suggested change
union{
uint8_t required_pm_mode; /**< min. pm mode required for the clock to run */
uint8_t block_pm_mode; /**< min. pm mode to block for the clock to run */
};
union{
uint8_t required_pm_mode; /**< min. pm mode required for the clock to run */
uint8_t block_pm_mode; /**< min. pm mode to block for the clock to run */
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am not sure how internal and not internal API is decided but core/lifo i going through a deprecation cycle for maybe beeing not internal even though no one could name a valid usecase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personaly think this is only used via the PM_MODE defines and therefor internal but since the require does not take up any space i am ok with deprecation and deletion

Copy link
Member

Choose a reason for hiding this comment

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

Deprecation comes at a cost: This increases complexity and can cause confusion. Also, new users of deprecated API occasionally still pop up even many months after. So, if there is no (valid) external use, we should IMO avoid the effort.

Maybe @kaspar030 and @bergzand have an opinion on this?

@fjmolinas
Copy link
Contributor

Deprecation comes at a cost: This increases complexity and can cause confusion. Also, new users of deprecated API occasionally still pop up even many months after. So, if there is no (valid) external use, we should IMO avoid the effort.

Maybe @kaspar030 and @bergzand have an opinion on this?

I think in this case keeping the compatibility is not that expensive, but I don't think the header is clear enough, the union element should have a deprecated tag. But at the same time ztimer is still considered experimental, si I think users should expect the API to change. So, in conclusion, is a similar case would come up and this union solution is applicable I would say why not, but in this case since the API is experimental I would simply change it.

@fjmolinas
Copy link
Contributor

This one needs a rebase BTW

@kfessel kfessel force-pushed the p-block-required branch from c2ab655 to 56c7239 Compare April 2, 2021 15:08
@kfessel
Copy link
Contributor Author

kfessel commented Apr 2, 2021

rebased (@maribu s sugestions are squash into the new intial commit)

@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 2, 2021
@kfessel
Copy link
Contributor Author

kfessel commented Apr 2, 2021

Murdock had some time (no builds running) therefor i added the (CI: ready for build) label: Murdock found no issues.
Please remove if this jumps the Discussion ( afaik it is: no review label )

@kfessel
Copy link
Contributor Author

kfessel commented Apr 2, 2021

there is still no response from @kaspar030 and/or @bergzand

should i just remove the union thing?
or
should i add a deprecation marker?

@kfessel
Copy link
Contributor Author

kfessel commented Apr 4, 2021

i went with deprecating for now

i would also deprecate the use of CONFIG_ZTIMER_*SEC_REQUIRED_PM_MODE but i do not know how
CONFIG_ZTIMER_(TIMER/RTC/RTT)_BLOCK_PM_MODE should be used. (this honor the change requested by #15911 and implemented by #16172)

@kaspar030
Copy link
Contributor

IMO just renaming would have been fine, but now the deprecation is there, also fine!

What puzzles me more is that the anonymous union actually passed murdock. AFAIK they're c11 only, and our AVR toolchain doesn't support that? Is any ztimer code built on CI for AVR?

@kaspar030
Copy link
Contributor

What puzzles me more is that the anonymous union actually passed murdock. AFAIK they're c11 only, and our AVR toolchain doesn't support that? Is any ztimer code built on CI for AVR?

Seems like AVR is actually on C11, so no blocker here.

So, please squash!

@kfessel kfessel force-pushed the p-block-required branch from 4c8edb0 to 20ae4bc Compare April 6, 2021 09:34
Copy link
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

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

ACK.

@kfessel kfessel removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 6, 2021
@kfessel
Copy link
Contributor Author

kfessel commented Apr 6, 2021

Murdock failed with (unrelated i think):
https://ci.riot-os.org/RIOT-OS/RIOT/16160/20ae4bce9e1008ec8193dbdad8b11bcae6cdc9c5/output/makefile_broken.txt
I removed the (CI:ready for build) label.

@kaspar030
Copy link
Contributor

Hm, this doesn't change any makefiles. Could you give this another rebase, then try restarting the build?

@kfessel kfessel force-pushed the p-block-required branch from 20ae4bc to 8f0e47a Compare April 6, 2021 12:11
@kfessel kfessel added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 6, 2021
Comment on lines 340 to 346
union {
uint8_t required_pm_mode; /**< min. pm mode required for the clock to run
* @deprecated name change -> block_pm_mode:
* this is used to block a pm_mode
* use block_pm_mode instead */
uint8_t block_pm_mode; /**< min. pm mode to block for the clock to run */
};
Copy link
Member

Choose a reason for hiding this comment

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

Do we really consider this a user facing API that needs deprecation? IMO this is internal and we should just rename it and be done with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine with me

Copy link
Contributor

Choose a reason for hiding this comment

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

so @kfessel, sorry for the confusion, please just remove the deprecation stuff...

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also fine with just renaming it. This struct member is just touched by auto_init.c. At least in all my use cases ;)

Copy link
Contributor Author

@kfessel kfessel Apr 6, 2021

Choose a reason for hiding this comment

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

done (both variants are good from my pov)

@kfessel kfessel force-pushed the p-block-required branch from 8f0e47a to 951fa14 Compare April 6, 2021 14:58
@kfessel
Copy link
Contributor Author

kfessel commented Apr 6, 2021

i removed the deprecation part

@maribu
Copy link
Member

maribu commented Apr 6, 2021

@kaspar030 merge?

@kaspar030 kaspar030 merged commit 04b5627 into RIOT-OS:master Apr 7, 2021
@kfessel
Copy link
Contributor Author

kfessel commented Apr 7, 2021

next stop: round robin scheduling #16126

@kaspar030 kaspar030 added this to the Release 2021.04 milestone Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants