-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
sched/wdog: merge wdog_periods_s into wdog_s #15959
base: master
Are you sure you want to change the base?
Conversation
Make wdog support period semantics by default, avoid exposing two structures to enhance consistency Signed-off-by: chao an <[email protected]>
[Experimental Bot, please feedback here] No, this PR does not fully meet the NuttX requirements. While it provides a summary of the change, it lacks crucial details. Here's a breakdown of what's missing:
In short, the PR needs more detail and evidence to demonstrate that the change is beneficial, safe, and well-tested. |
|
||
struct wdog_period_s | ||
{ | ||
struct wdog_s wdog; /* Watchdog */ | ||
clock_t period; /* Period time in ticks */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the chagne will increase wdog_s size even the caller doesn't require the period callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about add a kconfig setting to make period wdog feature configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't resolve the problem, since not all user in the same image use the periodic watchdog.
Thanks @anchao :-) Could you please write some more details why this change is necessary and what it solves / fixes / improves? You often introduce changes in critical parts of the RTOS but with not much explanation why. Single sentence on what you change is not enough, we can see that in the code, but we also need to know WHY. It is important to explain the motivation behind the change to other people and that would help in review. You say "Make wdog support period semantics by default, avoid exposing two structures to enhance consistency". Consistency with what? Implementations on other OS/RTOS? Removes code that is not always necessary / used to decrease firmware size? Current split design looks on purpose? Have you checked what targets will be affected by this change? If so where is the check presented? What if some people use that code as it is now.. it will be broken for them.. and it would be nice to know WHY. |
Just merge wdog_periods_s into wdog_s , individual developers don't need to learn whether to use wdog_periods_s or wdog_s
original author of this feature is not me, I carried out some refined tweaks of the code.
you should raise the question to #15937
ditto
this feature was merged just 2 days ago, why don't you raise these questions before #15937 merged? |
Aaah, fresh stuff, thanks @anchao, one more simple sentence more in the description would make things clear from start :-) Well I sit usually ~16h in front of the computer but not always sorry :D Build time selectable option seems reasonable but @xiaoxiang781216 knows the details so I will remain silent :-P Good luck guys :-) |
I think you should do more exercise and not sit in front of the computer for a long time, it's good for your health |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anchao please update the log message to include: why this feature is needed and its advantages
new API is not compatible with the old structure. The following is a comparison before and after the PR change:
Here is a decision for yours. If prefer proposal 1, I will close this PR. otherwise please approve this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anchao the initial design is using the unified wdog_s, but it increase 8 bytes for each wdog_s even the caller doesn't use period timer, so the final decision is to used the seperated structure.
8 bytes can enhance consistency and avoid software bugs. I think the benefits are greater. |
Sorry, I don't think the new function use new struct isn't consistency. < avoid software bugs. I think the benefits are greater. what's software bug? |
If I only have one wdog_s instance, and I want to support both periodic and non-periodic scenarios, how should I implement this? Using 1 wdog_s and 1 wdog_periods_s instances?
see issue 1 |
@xiaoxiang781216 So you expect developers to write code like this?
|
in this case, you can always use wdog_periods_s with period == 0 for no period case |
So, to avoid similar problems, we must use wdog_period_s, right? could we remove wdog_s and only keep wdog_period_s? I don't think wdog_s needs to exist anymore |
To be honest, interfaces and data types are extremely important concepts. They interact directly with developers. If you want to reduce the size, you should optimize the internal implementation instead of exposing these APIs that are prone to problems during the development process. |
Summary
sched/wdog: merge wdog_periods_s into wdog_s
Make wdog support period semantics by default, avoid exposing two structures to enhance consistency
Signed-off-by: chao an [email protected]
Impact
N/A
Testing
ostest