On 3/22/2023 10:49 PM, Dan Williams wrote:
Ian Rogers wrote:
Hi nvdimm@,

In the perf tool there are metrics for platforms like cascade lake
where we're collecting data for optane memory [1] but if optane memory
isn't installed then the counters will always read 0. Is there a
relatively simple way of determining if Optane memory is installed?
For example, the presence of a file in /sys/devices. I'd like to
integrate detection of this and make the perf metrics more efficient
for the case where Optane memory isn't installed.

In simple terms the presence of an ACPI NFIT table is probably enough to
tell you that the platform has persistent memory of some form:

     test -e /sys/firmware/acpi/tables/NFIT

...if you need precision to tell the difference between battery backed
NVDIMMs and Optane memory then you are looking for something like:

     ndctl list -D

...which gathers NVDIMM device data from sysfs and spits it out in json
of the form:

     {
       "dev":"nmem0",
       "id":"cdab-0a-07e0-ffffffff",
       "handle":0,
       "phys_id":0,
       "security:":"disabled"
     }

...where the id string follow the format defined here:

https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#nvdimm-representation-format

...and then you would need to know the id string of Optane devices vs
other NVDIMM vendors, which I think is overkill for what seems like a
simple case of hide counters that will never increment.

Cool!  My older machine with first gen Optane DC shows:

    "id":"8089-a2-1911-0000148d",
    "id":"8089-a2-1911-00001546",
    "id":"8089-a2-1911-0000173c",
    "id":"8089-a2-1911-00001781",
    "id":"8089-a2-1911-00001a7f",
    "id":"8089-a2-1911-00001a8e",
    "id":"8089-a2-1911-00001a9c",
    "id":"8089-a2-1911-00001aba",
    "id":"8089-a2-1911-00001b0a",
    "id":"8089-a2-1911-00001b1f",
    "id":"8089-a2-1911-00001b31",
    "id":"8089-a2-1911-00001b33",

My newer one with second gen shows:

    "id":"8089-a2-2134-00000027",
    "id":"8089-a2-2134-00000156",
    "id":"8089-a2-2134-00000159",
    "id":"8089-a2-2134-00000317",
    "id":"8089-a2-2134-00000709",
    "id":"8089-a2-2134-0000091e",
    "id":"8089-a2-2134-00000935",
    "id":"8089-a2-2134-00000981",

Enjoy!  Eliot Moss

Reply via email to