-
Notifications
You must be signed in to change notification settings - Fork 161
underhill_core: keepalive cli arguments for nvme follow the "disabled,host,privatepool" pattern #2473
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
base: main
Are you sure you want to change the base?
underhill_core: keepalive cli arguments for nvme follow the "disabled,host,privatepool" pattern #2473
Changes from all commits
a1d7ef4
408e001
2e22fd8
75187cf
725104b
a0557fc
b783e20
2c029d3
dd3497e
3de5082
aeb70c0
db59f94
f63d23b
4792d7a
4705d32
349d45c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -289,13 +289,25 @@ fn build_kernel_command_line( | |||||||||||||||||||
| )?; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Only when explicitly supported by Host. | ||||||||||||||||||||
| // Generate the NVMe keep alive command line which should look something | ||||||||||||||||||||
| // like: OPENHCL_NVME_KEEP_ALIVE=disabled,host,privatepool | ||||||||||||||||||||
| // TODO: Move from command line to device tree when stabilized. | ||||||||||||||||||||
| if partition_info.nvme_keepalive | ||||||||||||||||||||
| && vtl2_pool_supported | ||||||||||||||||||||
| && !partition_info.boot_options.disable_nvme_keep_alive | ||||||||||||||||||||
| { | ||||||||||||||||||||
| write!(cmdline, "OPENHCL_NVME_KEEP_ALIVE=1 ")?; | ||||||||||||||||||||
| write!(cmdline, "OPENHCL_NVME_KEEP_ALIVE=")?; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if partition_info.boot_options.disable_nvme_keep_alive { | ||||||||||||||||||||
| write!(cmdline, "disabled,")?; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if partition_info.nvme_keepalive { | ||||||||||||||||||||
| write!(cmdline, "host,")?; | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
| write!(cmdline, "nohost,")?; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if vtl2_pool_supported { | ||||||||||||||||||||
| write!(cmdline, "privatepool ")?; | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
| write!(cmdline, "noprivatepool ")?; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+308
to
311
|
||||||||||||||||||||
| write!(cmdline, "privatepool ")?; | |
| } else { | |
| write!(cmdline, "noprivatepool ")?; | |
| } | |
| write!(cmdline, "privatepool")?; | |
| } else { | |
| write!(cmdline, "noprivatepool")?; | |
| } | |
| write!(cmdline, " ")?; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,7 @@ impl FromStr for KeepAliveConfig { | |
| "host,privatepool" => Ok(KeepAliveConfig::EnabledHostAndPrivatePoolPresent), | ||
| "nohost,privatepool" => Ok(KeepAliveConfig::DisabledHostAndPrivatePoolPresent), | ||
| "nohost,noprivatepool" => Ok(KeepAliveConfig::Disabled), | ||
| x if x.starts_with("disabled,") => Ok(KeepAliveConfig::Disabled), | ||
| _ => Err(anyhow::anyhow!("Invalid keepalive config: {}", s)), | ||
| } | ||
| } | ||
|
|
@@ -207,15 +208,23 @@ pub struct Options { | |
| /// hit exits. | ||
| pub no_sidecar_hotplug: bool, | ||
|
|
||
| /// (OPENHCL_NVME_KEEP_ALIVE=1) Enable nvme keep alive when servicing. | ||
| pub nvme_keep_alive: bool, | ||
| /// (OPENHCL_NVME_KEEP_ALIVE=\<KeepaliveConfig\>) | ||
| /// Configure NVMe keep alive behavior when servicing. | ||
| /// Options are: | ||
| /// - "host,privatepool" - Enable keep alive if both host and private pool support it. | ||
| /// - "nohost,privatepool" - Used when the host does not support keepalive, but a private pool is present. Keepalive is disabled. | ||
| /// - "nohost,noprivatepool" - Keepalive is disabled. | ||
| /// - "disabled,<x>,<x>" - Keepalive is disabled due to manual | ||
| /// override. Host and private pool options are ignored. | ||
| pub nvme_keep_alive: KeepAliveConfig, | ||
|
|
||
| /// (OPENHCL_MANA_KEEP_ALIVE=\<KeepAliveConfig\>) | ||
| /// Configure MANA keep alive behavior when servicing. | ||
| /// Options are: | ||
| /// - "host,privatepool" - Enable keep alive if both host and private pool support it. | ||
| /// - "nohost,privatepool" - Used when the host does not support keepalive, but a private pool is present. Keepalive is disabled. | ||
| /// - "nohost,noprivatepool" - Keepalive is disabled. | ||
| /// - "disabled,<x>,<x>" - TODO: This needs to be implemented for mana. | ||
| pub mana_keep_alive: KeepAliveConfig, | ||
|
|
||
| /// (OPENHCL_NVME_ALWAYS_FLR=1) | ||
|
|
@@ -366,15 +375,28 @@ impl Options { | |
| let no_sidecar_hotplug = parse_legacy_env_bool("OPENHCL_NO_SIDECAR_HOTPLUG"); | ||
| let gdbstub = parse_legacy_env_bool("OPENHCL_GDBSTUB"); | ||
| let gdbstub_port = parse_legacy_env_number("OPENHCL_GDBSTUB_PORT")?.map(|x| x as u32); | ||
| let nvme_keep_alive = parse_env_bool("OPENHCL_NVME_KEEP_ALIVE"); | ||
| let nvme_keep_alive = read_env("OPENHCL_NVME_KEEP_ALIVE") | ||
| .map(|x| { | ||
| let s = x.to_string_lossy(); | ||
| match s.parse::<KeepAliveConfig>() { | ||
| Ok(v) => v, | ||
| Err(e) => { | ||
| tracing::warn!( | ||
| "failed to parse OPENHCL_NVME_KEEP_ALIVE ('{s}'): {e}. Nvme keepalive will be disabled." | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: Decided to keep this here as opposed to defaulting to disabled in parse. That way we can more accurately log which variable parsing is failing (nvme vs mana) |
||
| ); | ||
| KeepAliveConfig::Disabled | ||
| } | ||
| } | ||
| }) | ||
| .unwrap_or(KeepAliveConfig::Disabled); | ||
| let mana_keep_alive = read_env("OPENHCL_MANA_KEEP_ALIVE") | ||
| .map(|x| { | ||
| let s = x.to_string_lossy(); | ||
| match s.parse::<KeepAliveConfig>() { | ||
| Ok(v) => v, | ||
| Err(e) => { | ||
| tracing::warn!( | ||
| "failed to parse OPENHCL_MANA_KEEP_ALIVE ('{s}'): {e}. keepalive will be disabled." | ||
| "failed to parse OPENHCL_MANA_KEEP_ALIVE ('{s}'): {e}. Mana keepalive will be disabled." | ||
| ); | ||
| KeepAliveConfig::Disabled | ||
| } | ||
|
|
||
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.
When
disable_nvme_keep_aliveis false, the command line will not include the "disabled," prefix. However, when it's true, the pattern becomes "disabled,host,privatepool" or "disabled,nohost,noprivatepool", etc.The
FromStrimplementation at line 97 handles strings starting with "disabled," but doesn't have explicit matches for patterns like "disabled,host,privatepool". While the catch-all at line 97 will map these toDisabled, this means the host and privatepool information is ignored even though it's being generated.Consider either: