-
Notifications
You must be signed in to change notification settings - Fork 20
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
mctpd: Make timeout and bus owner configs configurable #14
base: main
Are you sure you want to change the base?
Conversation
Currently, the timeout is hardcoded with the value of 250ms. However, when developing, we may want to make the timeout longer to make sure we do not miss any messages due to other reasons. This commit adds timeout overriding using program arguments. This makes tweaking the timeout at runtime possible. Tested: 1. Send a request to a non-existent endpoint. It should timeout in 250ms by default. root@mtmitchell:~# time busctl call xyz.openbmc_project.MCTP /xyz/openbmc_project/mctp \ > au.com.CodeConstruct.MCTP SetupEndpoint say mctppcie0 2 0xCA 0xFE Call failed: MCTP Endpoint did not respond real 0m0.344s user 0m0.016s sys 0m0.000s 2. Change mctpd.service to use longer timeout, 10 seconds for example. ExecStart=/usr/sbin/mctpd -t 10000000 3. Resend the request. It should timeout in 10 seconds. root@mtmitchell:~# time busctl call xyz.openbmc_project.MCTP /xyz/openbmc_project/mctp \ > au.com.CodeConstruct.MCTP SetupEndpoint say mctppcie0 2 0xCA 0xFE Call failed: MCTP Endpoint did not respond real 0m10.083s user 0m0.015s sys 0m0.001s Signed-off-by: Khang Nguyen <[email protected]>
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 would prefer we do this as a command-line argument (or through run-time configuration, but that can come later). A compile-time flag makes testing more complex...
just to clarify - this was on the bus-owner configuration commit! |
Currently, mctpd defaults to run as a bus owner, so ctx->bus_owner is always true. This commit adds a role argument so that we can change the role without editing the source code. Tested: Send a Get EID command to mctpd. See the response: - Running as Bus Owner (no flag): 00 00 02 00 ee 12 00 - Running as Endpoint (-r endpoint): 00 00 02 00 ee 02 00 The second to last byte signifies the endpoint type. (0xee is the EID assigned to mctpd) Signed-off-by: Khang Nguyen <[email protected]>
I updated the PR. Not sure what to call the flag, |
fprintf(stderr, " -v verbose\n"); | ||
fprintf(stderr, " -N testing mode. Not safe for production\n"); | ||
fprintf(stderr, " -t timeout in usecs\n"); |
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.
Timeout for what? This may need to be a little more descriptive.
And why microseconds here? milliseconds may be easier to deal with.
I've been thinking about a configuration file for a while, which would allow adjustment to the timeout and bus-owner states, and allow for future flexibility (eg, for the EID pools) too. I have a proposed change at 4b40af1 Would this work for you? Note that this uses the tomlc99 parser as a git subtree, so the git history might be a bit convoluted! I'm open to other approaches if necessary. |
I just want to be able to tweak the configuration at runtime, so anything works for me :D Putting them all in a file looks nicer IMO. My only tiny concern is why specifically TOML? Since my main interest is the OpenBMC project, there doesn't seem to be any TOML parsing C libs recipe yet AFAIK. I am more in favor of INI, despite the criticisms, because it is used by I have seen Since the config files support all the configs in this MR, I'm going to close this. |
Ah oops, the config file branch isn't merged yet so I will reopen this for discussion. |
OK, great!
My reasoning behind the toml approach is that we'll likely need something more structured, in able to describe multiple networks and/or EID pools. We could still do that with ini, but requires namespacing the keys/sections, which may get messy.
We can get around that - currently by including the toml library directly (see 0501df8) . No new deps are required for this build currently. This subtree approach is a bit heavy-handed though; we have a few other options:
I'd suggest a semi staged approach:
That won't help with the obmc build case though, the wraps are disabled there. |
Sounds good to me. I did not think through the process to stabilize the dependency at all, now it makes sense. I have one question regarding the config: should the config be specific for each MCTP links? Currently, we can support TMBOs and EPs, which have the same mode for all MCTP links, but bridges/normal BOs require different modes. Each links could have separate timing parameters, MTUs, networks, EID pools, ... Granted that the configuration schema/syntax is open to bikeshedding and can contain some way to do default/override options, but after parsing, the options are now stored in |
Hi Khang,
Some of it could be - we'd still want global defaults for the simple cases, but we can later make this override-able at different levels. Links would be one of those levels, but aren't appropriate for everything:
Currently, mctpd doesn't assume control of the local network state (the network assignments and link-level MTU). The EID pools could be either per-network or per-link; or per-network with static allocations that are link-specific. So, there's a bunch of design decisions behind that. Might be good to get some use-case data before we start making those though. (maybe we should arrange a chat about your endpoint usage some time?) Also, I have updated the conf branch for the plan above: https://github.com/CodeConstruct/mctp/commits/dev/conf and submitted a PR for meson support in the toml parser, so we can later do a wrap: |
i have a need for the configurable timeout in emulation use-case. If there is interest to support it, refer to There is a need for a large timeout since both fvp may be running at different speeds and also one or both may be running faster/slower than realtime, depending on configuration options. In this case, i need to set a large timeout of multiple seconds. I do not need the capability to set the timeout for different links, it can be the same for all links (i only have one link). Is this PR still moving forward or should a new PR be created? |
Hi @pointbazaar Thanks for the input - good to know about the use case you have!
Yep, we'll still go with this one, and extend to per-link config in future. |
Currently, the timeout and bus owner configs is statically defined inside
mctpd.c
. This PR makes those configs configurable:The bus owner config can be configured via. The bus owner config is changed to be configured via a program argument for easier use.meson_options.txt
, because this seems to be a build time / one time decision