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

Add MeasurementKind::Dimensionless #291

Merged
merged 3 commits into from
Sep 30, 2024
Merged

Add MeasurementKind::Dimensionless #291

merged 3 commits into from
Sep 30, 2024

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Sep 26, 2024

This commit adds a CpuTctl variant to the MeasurementKind enum. This
is intended to be used to represent AMD CPU Tctl thermal
values, which are a unitless value from 0-100 representing a kind of
"abstract thermal throttling danger level" --- see
oxidecomputer/hubris#1881 for details on why we need to differentiate
this from other temperature measurements.

This commit adds a `Dimensionless` variant to the `MeasurementKind` enum
to represent measurements without units. This is intended to be used to
represent AMD CPU T<sub>ctl</sub> thermal values, which are a unitless
value from 0-100 representing a kind of "abstract thermal throttling
danger level" --- see oxidecomputer/hubris#1881 for details on why we
need to differentiate this from other temperature measurements.

I wasn't totally sure as to the best approach for naming this variant. I
note that the name of the enum is "measurement kind", not "measurement
unit", so it doesn't directly represent the unit of the measurement but
rather, the kind of quantity being measured. So, perhaps this ought to
be a `CpuTctl` variant or similar, to *specifically* represent
T<sub>ctl</sub> measurements. If other dimensionless values show up in
future, they would then have their own variant. I'm open to being
convicned either way --- what do others think?
@jgallagher
Copy link
Collaborator

jgallagher commented Sep 27, 2024

So, perhaps this ought to be a CpuTctl variant or similar, to specifically represent Tctl measurements. If other dimensionless values show up in future, they would then have their own variant. I'm open to being convicned either way --- what do others think?

I think I'd vote for CpuTctl. Adding Dimensionless means future measurement unit/kinds in the future that don't fit into one of the existing variants have somewhere to land without software changes, which is good, but also feels vague. Presumably two different sensors with the same MeasurementKind are comparable in some way (although that comparison is maybe meaningless and requires more context to know?), but two Dimensionless sensors are definitely not comparable without knowing exactly what they are.

But this is an area well outside where I've been any time recently, so I'm happy to defer to others too. @mkeeter might have opinions too; he worked on the SP <-> IPCC <-> host inventory path with @rmustacc.

@mkeeter
Copy link
Contributor

mkeeter commented Sep 27, 2024

I'm also weakly in favor of CpuTctl; enum variants are basically free, and it's a weird corner case.

Because this is a change to the SP-MGS protocol, you should also

This ensures that we get helpful error reporting if there's a mismatch between SP and MGS; specifically, MGS can report "I failed to serialize this message, but it's on v16 while I'm only on v15, so that's not totally surprising".

@hawkw
Copy link
Member Author

hawkw commented Sep 27, 2024

Okay, I think y'all have convinced me that this should be Tctl-specific. And, thanks @mkeeter for the instructions on how to update the protocol! I'll make those changes shortly.

@hawkw hawkw requested a review from mkeeter September 27, 2024 20:54
@hawkw
Copy link
Member Author

hawkw commented Sep 27, 2024

Okay, I changed the variant to be just for Tctl, bumped the version, and added a test.


#[test]
fn measurement_kinds() {
let mut out = [0; SpResponse::MAX_SIZE];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this could be MeasurementKind::MAX_SIZE

Copy link
Contributor

@mkeeter mkeeter left a comment

Choose a reason for hiding this comment

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

Normally, I open a Hubris PR staged against the MGS branch before merging it (to make sure the Hubris integration doesn't require further changes in MGS).

In this case, the change is simple enough that doesn't seem necessary.

@hawkw
Copy link
Member Author

hawkw commented Sep 27, 2024

Normally, I open a Hubris PR staged against the MGS branch before merging it (to make sure the Hubris integration doesn't require further changes in MGS).

In this case, the change is simple enough that doesn't seem necessary.

Yeah, I would be quite happy to leave this open until the Hubris-side change is done. But, in this case, I also feel like, well...if fixing this in Hubris actually requires more protocol changes, I'll eat a ST-Link live at Oxcon. :)

@hawkw hawkw merged commit caf1e6a into main Sep 30, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants