chef / ohai

Ohai profiles your system and emits JSON
https://docs.chef.io/ohai.html
Apache License 2.0
681 stars 452 forks source link

Incorrect/truncated CPU flags returned with later Linux kernels #1791

Open comay opened 1 year ago

comay commented 1 year ago

Description

With later 5.x Linux kernels, /proc/cpuinfo can return a field of VMX related flags along the lines of

vmx flags   : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs pml ept_mode_based_exec tsc_scaling

As this line follows the original flags line, its contents replace the primary CPU flags resulted in a truncated, incorrect list of the flags. Instead, a new field such as vmx_flags or vmx should be introduced to contain these particular flags under vmx flags.

Ohai Version

14.8.12 or 15.6.3

Platform Version

Kernel versions that incorporated this commit or variations of it.

Ohai Output

Note how common CPU flags like fpu are missing.

{
  "0": {
    "vendor_id": "GenuineIntel",
    "family": "6",
    "model": "106",
    "model_name": "Intel(R) Xeon(R) Platinum 8380 CPU @ 2.30GHz",
    "stepping": "6",
    "mhz": "3000.000",
    "cache_size": "61440 KB",
    "physical_id": "0",
    "core_id": "0",
    "cores": "40",
    "flags": [
      "vnmi",
      "preemption_timer",
      "posted_intr",
      "invvpid",
      "ept_x_only",
      "ept_ad",
      "ept_1gb",
      "flexpriority",
      "apicv",
      "tsc_offset",
      "vtpr",
      "mtf",
      "vapic",
      "ept",
      "vpid",
      "unrestricted_guest",
      "vapic_reg",
      "vid",
      "ple",
      "shadow_vmcs",
      "pml",
      "ept_mode_based_exec",
      "tsc_scaling"
    ]
  },
  "1": {
  .
  .
  .