-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
modbus: Respect CONFIG_UART_USE_RUNTIME_CONFIGURE flag #68858
modbus: Respect CONFIG_UART_USE_RUNTIME_CONFIGURE flag #68858
Conversation
This together with #68857 enables testing modbus communication on native_posix builds. Edit: More precisely, it enables testing modbus communication between two native_posix builds without any hardware attached. Or between one native_posix zephyr application and some other software speaking modbus. I do this by creating two pseudo-ttys with the command |
subsys/modbus/modbus_serial.c
Outdated
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE | ||
struct uart_config uart_cfg; |
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.
CONFIG_UART_USE_RUNTIME_CONFIGURE is a Kconfig option not a flag.
Runtime configuration is mandatory for Modbus with no exceptions. You have to implement it where it is missed.
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.
Why do you want runtime configuration to be mandatory for modbus?
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.
Because is is designed to use runtime configuration to e.g. update server baudrate. And there is a dependency on 'UART_USE_RUNTIME_CONFIGURE' in the Kconfig file. And based on your motivation, it must be implemented for native_posix/native_sim to do "testing modbus". Otherwise, you are not testing exactly what the test is supposed to test. Finally, I personally see no reason to have another Kconfig option.
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.
Just because a use case for runtime configuration exists doesn't mean it is mandatory. We have a Kconfig option to give users the power to choose if they want this or not. What gives you the right to override their choice, forcing them to include code they have explicitly said they do not want? It adds 1 KB to my STM32 build.
I run virtual system tests involving multiple zephyr native_sim applications that talk to each other using modbus. I don't want to "test modbus", I want to test my application logic.
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.
Just because a use case for runtime configuration exists doesn't mean it is mandatory.
It is also because "there is a dependency on 'UART_USE_RUNTIME_CONFIGURE' in the Kconfig file" and you patch does not do what you think.
We have a Kconfig option to give users the power to choose if they want this or not. What gives you the right to override their choice, forcing them to include code they have explicitly said they do not want?
Maybe my role as author and maintainer gives me the right to drive it and decide.
But I do not force anyone "to include code they have explicitly said they do not want". The system has this dependency either you fulfill this dependency or it does not work. Btw, Kconfig option UART_USE_RUNTIME_CONFIGURE was introduced after Modbus subsys, and other effective changes in the drivers even later.
It adds 1 KB to my STM32 build.
Great, glad to hear it does not take that much flash. However that was not the motivation according to the commit message.
I run virtual system tests involving multiple zephyr native_sim applications that talk to each other using modbus. I don't want to "test modbus", I want to test my application logic.
This is also understandable yet. If you have implemented it for native_posix/native_sim, nothing stands in the way, right?
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 I do not force anyone "to include code they have explicitly said they do not want". The system has this dependency either you fulfill this dependency or it does not work.
You say that, yet the modbus subsystem works just fine without it. Where is this hard dependency?
Kconfig option UART_USE_RUNTIME_CONFIGURE was introduced after Modbus subsys, and other effective changes in the drivers even later.
That may explain why it wasn't already added. It does not explain why you won't let anyone add it now.
It adds 1 KB to my STM32 build.
Great, glad to hear it does not take that much flash.
I don't think it is up to you or me to decide what users' code space is worth and what they should use it for. We can safely assume that anyone who chooses to disable UART_USE_RUNTIME_CONFIGURE considers the size saving to be significant.
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 I do not force anyone "to include code they have explicitly said they do not want". The system has this dependency either you fulfill this dependency or it does not work.
You say that, yet the modbus subsystem works just fine without it. Where is this hard dependency?
Original description as motivation for your change:
"This together with #68857 enables testing modbus communication on native_posix builds."
In the context of this project, it means being able to test tests/subsys/modbus, and requires UART driver to implement uart_configure(). Your patch had no effect because of "select UART_USE_RUNTIME_CONFIGURE". Subsys is designed to configure and reconfigure interfaces at runtime. Your changes were far from what would be reasonable or acceptable.
Kconfig option UART_USE_RUNTIME_CONFIGURE was introduced after Modbus subsys, and other effective changes in the drivers even later.
That may explain why it wasn't already added. It does not explain why you won't let anyone add it now.
Because these changes are not necessary and and smaller additional consumption of resources is acceptable.
09b3729
to
5931028
Compare
Updated patch with the missed Kconfig change. |
subsys/modbus/modbus_serial.c
Outdated
@@ -521,6 +520,9 @@ int modbus_serial_init(struct modbus_context *ctx, | |||
return -ENODEV; | |||
} | |||
|
|||
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE |
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.
This can and should be solved differently, without ifdefery.
5931028
to
c73f505
Compare
Latest patch addresses all technical concerns and passes all checks. What more is required to merge this? |
I'll mention this note by @nordic-krch in the Zephyr 3.6 migration notes that is relevant to 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.
It is addressed, using the solution you yourself pointed to. If you are not happy with |
right, my fault, this one #68858 (comment) Here is the patch https://github.com/jfischer-no/zephyr/commit/8727703a1a9121eb5d6c97358e4fd6f503bc7638.patch, sorry, was faster for me to write it than to try to explain it and complain about the commit message. |
Sure, that's fine with me. But are you sure this is the solution you want? I chose the "ifdef empty function" solution to follow the code style of your implementation of |
c73f505
to
38e310d
Compare
Rewritten as requested and rebased on main. |
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.
My two cents :)
@@ -44,7 +44,7 @@ config MODBUS_SERIAL | |||
default y | |||
depends on SERIAL && SERIAL_HAS_DRIVER | |||
depends on DT_HAS_ZEPHYR_MODBUS_SERIAL_ENABLED | |||
select UART_USE_RUNTIME_CONFIGURE | |||
imply UART_USE_RUNTIME_CONFIGURE |
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.
Hi, I would remove this select/imply entirely :) The default value of UART_USE_RUNTIME_CONFIGURE
is y
, so unless the user explicitly adds CONFIG_UART_USE_RUNTIME_CONFIGURE=n
to their .prj somewhere, it will be selected. This also means that no current users of the modbus_serial.c
have explicitly disabled runtime as it produces this Kconfig error to do so:
warning: UART_USE_RUNTIME_CONFIGURE (defined at drivers/serial/Kconfig:51) was assigned the value
'n' but got the value 'y'. See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_USE_RUNTIME_CONFIGURE and/or look up
UART_USE_RUNTIME_CONFIGURE in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.
If it is possible to use this driver without UART_USE_RUNTIME_CONFIGURE
as it is after this PR, it shall not be selected in Kconfig. select
is explicitly used only when the dependency is "small" but obligatory :)
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.
I agree. The first version of this PR removed the select line entirely, but Johann refused it.
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.
@jfischer-no can we agree on removing the select
not being a breaking change? or have I missed something? :)
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.
No.
I am afraid it is still not "Rewritten as requested", see #68858 (comment). And, you commit message is wrong, there is nothing like CONFIG_UART_USE_RUNTIME_CONFIGURE to implement, it is just a Kconfig option. There is a link to the patch you could just apply and force push to your PR branch and we would be done. |
Would you, please please with a cherry on top, say what you don't like instead of saying "it is wrong" over and over? It is really tiresome and a fantastic waste of both our times.
implement, verb: "to start using a plan or system" "Implement" is the proper verb. But I can change it back to "respect" if you prefer.
Of course I'm not blind-committing code from someone else in my name. I seriously hope you never either. If you'd rather commit your own-written version of this change, please just go ahead instead of playing these innuendo games for weeks. The only reason this PR drags on is because you consistently refuse to engage in discussion or provide constructive feedback. |
I have added this PR to the Architecture WG project in order for it to get some traction. CC: @carlescufi |
And I just removed it because there is nothing about architecture and therefore this label makes no sense. |
Technically though the Arch WG meeting can be used for PR disagreement escalation: The contributor is free to ask for this topic to be discussed there. |
I am very sorry that you are frustrated. I only used "wrong" once in this PR and in the patch is the alternative commit title, I have pointed this out for some time.
I do not understand why you refuse to look closer at the patch and apply it. I intentionally used the patch link instead of the branch link to make it easier for you and me. You would see that it is based on your original commit, see the differences, and see my sign-off. |
Are you? You ignore direct questions, state your opinions as facts, dont tell us when your opinions then change, stay silent for weeks, and still to this day refuse to do the most fundamental task of code reviewing: Saying what part of the patch you disagree with and why. Open source development is based on the concept of talking about code and proposed changes. Conversations between peers where we look at code and proposals from many angles and try to make every change as good as we can. We learn from each other and cooperate to improve our shared code. You appear to be under the illusion that we can do software development without talking. That the job of maintainers is merely to give a roman thumbs up or down and be done with it. But such an approach loses nearly all of the benefits of the open source process and you end up as just a gatekeeper discouraging contribution. Code gets improved, increment by increment. That's what we do. That's why we are here. And that includes the modbus subsystem. It has its' share of warts and shortcomings to address, just as all code does. You need to start getting comfortable talking about it.
Two reasons:
|
Only perform runtime UART configuration if it is enabled. Signed-off-by: Björn Stenberg <[email protected]>
38e310d
to
81a3a0e
Compare
Architecture WG:
|
Only perform runtime UART configuration if it is enabled.
This allows using serial modbus on a native ptty.