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

Fix: CRN API did not expose CPU features for trusted computing #622

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

hoh
Copy link
Member

@hoh hoh commented May 29, 2024

Trusted computing requires CPU features such as sev, sev_es and sev_snp.

This adds the field properties.cpu.features /about/usage/system as a list of CPU features.

Currently, only SEV related features are present, but more can be added, for example avx2, fma and f16c. Adding them will require ensuring that they are actually active and not just present on the CPU via /proc/cpuinfo.

This work is based on a proposal to add the relevant field on aleph-message: aleph-im/aleph-message#100

Example JSON output:

{
  "cpu": {
    "count": 12,
    "load_average": {
      "load1": 0.31494140625,
      "load5": 0.1806640625,
      "load15": 0.17138671875
    },
    "core_frequencies": {
      "min": 2200,
      "max": 3600
    }
  },
  "mem": {
    "total_kB": 16663798,
    "available_kB": 13188161
  },
  "disk": {
    "total_kB": 981630836,
    "available_kB": 879101616
  },
  "period": {
    "start_timestamp": "2024-05-29T18:16:00+00:00",
    "duration_seconds": 60
  },
  "properties": {
    "cpu": {
      "architecture": "x86_64",
      "vendor": "AuthenticAMD"
    },
    "features": [
      "sev"
    ]
  },
  "active": true
}

@hoh hoh requested review from olethanh and nesitor May 29, 2024 18:18
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.94%. Comparing base (4f9b3e6) to head (743a46c).

Files Patch % Lines
src/aleph/vm/conf.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #622      +/-   ##
==========================================
+ Coverage   59.70%   59.94%   +0.23%     
==========================================
  Files          64       64              
  Lines        5443     5458      +15     
  Branches      591      592       +1     
==========================================
+ Hits         3250     3272      +22     
+ Misses       2048     2043       -5     
+ Partials      145      143       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hoh
Copy link
Member Author

hoh commented Jun 18, 2024

Requires aleph-im/aleph-message#100

@hoh hoh marked this pull request as ready for review June 18, 2024 14:24
@hoh hoh force-pushed the hoh-add-cpu-features branch from 7978fcf to 3e158c4 Compare June 19, 2024 13:03
Copy link
Member

@nesitor nesitor left a comment

Choose a reason for hiding this comment

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

LGTM, but I think that you already added the sevctl PR changes into that one also.

@hoh hoh force-pushed the hoh-add-cpu-features branch 2 times, most recently from fc5d201 to 201efc9 Compare June 27, 2024 10:49
Trusted computing requires CPU features such as `sev`, `sev_es` and `sev_snp`.

This adds the field `properties.cpu.features` `/about/usage/system` as a list of CPU features.

Currently, only SEV related features are present, but more can be added, for example `avx2`, `fma` and `f16c`. Adding them will require ensuring that they are actually active and not just present on the CPU via `/proc/cpuinfo`.

This work is based on a proposal to add the relevant field on aleph-message: aleph-im/aleph-message#100
@hoh hoh force-pushed the hoh-add-cpu-features branch from 201efc9 to 3f3aaff Compare June 27, 2024 12:03
@hoh hoh merged commit 45c14c5 into main Jun 27, 2024
24 checks passed
@hoh hoh deleted the hoh-add-cpu-features branch June 27, 2024 15:43
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.

2 participants