From: George Koehler Subject: Re: nvme(4) sensors To: Mark Kettenis Cc: Jonathan Matthew , tech@openbsd.org Date: Tue, 16 Jul 2024 01:12:33 -0400 On Thu, 11 Jul 2024 16:03:32 +0200 Mark Kettenis wrote: > Diff doesn't compile on arm64. Adding #include to > dev/ic/nvmevar.h fixes that. Same problem, same fix on powerpc64. After the fix, my temperature looks too high, $ sysctl hw.sensors.nvme0 hw.sensors.nvme0.temp0=1178.95 degC, OK hw.sensors.nvme0.percent0=1.00% (endurance used), OK hw.sensors.nvme0.percent1=100.00% (available spare), OK Not sure what's wrong, but powerpc64 is big-endian, so I tried an endian swap, --- dev/ic/nvme.c.before Tue Jul 16 00:47:25 2024 +++ dev/ic/nvme.c Tue Jul 16 01:01:05 2024 @@ -2207,7 +2207,8 @@ sc->sc_temp_sensor.status = (cw & NVM_HEALTH_CW_TEMP) ? SENSOR_S_CRIT : SENSOR_S_OK; - sc->sc_temp_sensor.value = health->temperature * 1000000; + sc->sc_temp_sensor.value = le16toh(health->temperature) * + 1000000; sc->sc_spare_sensor.status = (cw & NVM_HEALTH_CW_SPARE) ? SENSOR_S_CRIT : SENSOR_S_OK; With le16toh, the temperature is about 40. --gkoehler $ sysctl hw.sensors.nvme0 hw.sensors.nvme0.temp0=39.85 degC, OK hw.sensors.nvme0.percent0=1.00% (endurance used), OK hw.sensors.nvme0.percent1=100.00% (available spare), OK # bioctl nvme0 nvme0: WDC WDS500G2B0C-00PXH0, 211070WD, 20195E800651 nvme0: Max i/o 131072 bytes, Persisent Event Log, Volatile Write Cache, Sanitize 0x60000002 nvme0: Features 0x2 nvme0: Admin commands 0x17, NVM commands 0x5f nvme0: NVMe 1.4, NVM I/O command set, Enabled, Ready Volume Status Size Device nvme0 0 Online 500107862016 sd0 CONCAT 0: Formats *512 (Good), 4096 (Better) 0: Features 0x2 0 Online 500107862016 0:1.0 Namespace 1 <> OpenBSD 7.5-current (GENERIC.MP) #148: Tue Jul 16 01:02:13 EDT 2024 kernigh@illinois.my.domain:/sys/arch/powerpc64/compile/GENERIC.MP real mem = 8589934592 (8192MB) avail mem = 7823151104 (7460MB) random: good seed from bootblocks mainbus0 at root: T2P9S01 REV 1.01 cpu0 at mainbus0 pir c: IBM POWER9 2.2, 2700 MHz cpu0: 32KB 128b/line 8-way L1 I-cache, 32KB 128b/line 8-way L1 D-cache cpu0: 512KB 128b/line 8-way L2 cache cpu0: 10MB 128b/line 8-way L3 cache cpu1 at mainbus0 pir 14: IBM POWER9 2.2, 2700 MHz cpu1: 32KB 128b/line 8-way L1 I-cache, 32KB 128b/line 8-way L1 D-cache cpu1: 512KB 128b/line 8-way L2 cache cpu1: 10MB 128b/line 8-way L3 cache cpu2 at mainbus0 pir 1c: IBM POWER9 2.2, 2700 MHz cpu2: 32KB 128b/line 8-way L1 I-cache, 32KB 128b/line 8-way L1 D-cache cpu2: 512KB 128b/line 8-way L2 cache cpu2: 10MB 128b/line 8-way L3 cache cpu3 at mainbus0 pir 24: IBM POWER9 2.2, 2700 MHz cpu3: 32KB 128b/line 8-way L1 I-cache, 32KB 128b/line 8-way L1 D-cache cpu3: 512KB 128b/line 8-way L2 cache cpu3: 10MB 128b/line 8-way L3 cache "bmc" at mainbus0 not configured "ibm,firmware-versions" at mainbus0 not configured "ibm,hostboot" at mainbus0 not configured opal0 at mainbus0: skiboot-9858186 opal0: idle psscr 300332 opalcons0 at opal0 opalsens0 at opal0: "core-temp" opalsens1 at opal0: "core-temp" opalsens2 at opal0: "core-temp" opalsens3 at opal0: "core-temp" opalsens4 at opal0: "mem-temp" opalsens5 at opal0: "mem-temp" opalsens6 at opal0: "mem-temp" opalsens7 at opal0: "mem-temp" opalsens8 at opal0: "mem-temp" opalsens9 at opal0: "mem-temp" opalsens10 at opal0: "mem-temp" opalsens11 at opal0: "mem-temp" opalsens12 at opal0: "mem-temp" opalsens13 at opal0: "mem-temp" opalsens14 at opal0: "mem-temp" opalsens15 at opal0: "mem-temp" opalsens16 at opal0: "mem-temp" opalsens17 at opal0: "mem-temp" opalsens18 at opal0: "mem-temp" opalsens19 at opal0: "mem-temp" opalsens20 at opal0: "proc-energy" opalsens21 at opal0: "proc-energy" opalsens22 at opal0: "proc-energy" opalsens23 at opal0: "proc-in" opalsens24 at opal0: "proc-in" opalsens25 at opal0: "proc-power" opalsens26 at opal0: "proc-power" opalsens27 at opal0: "proc-power" opalsens28 at opal0: "proc-temp" opalsens29 at opal0: "vrm-curr" opalsens30 at opal0: "vrm-curr" opalsens31 at opal0: "vrm-in" opalsens32 at opal0: "vrm-in" opalsens33 at opal0: "vrm-temp" ipmi0 at opal0: version 2.0 interface OPAL "ibm,pcie-slots" at mainbus0 not configured "ibm,secureboot" at mainbus0 not configured "imc-counters" at mainbus0 not configured xics0 at mainbus0 xive0 at mainbus0 "ipl-params" at mainbus0 not configured "lpcm-opb" at mainbus0 not configured phb0 at mainbus0: chip 0x0 pci0 at phb0 ppb0 at pci0 dev 0 function 0 "IBM POWER9 Host" rev 0x00 pci1 at ppb0 bus 1 "ATI Polaris 11" rev 0xff at pci1 dev 0 function 0 not configured "ATI Radeon Pro Audio" rev 0x00 at pci1 dev 0 function 1 not configured phb1 at mainbus0: chip 0x0 pci2 at phb1 ppb1 at pci2 dev 0 function 0 "IBM POWER9 Host" rev 0x00 pci3 at ppb1 bus 1 nvme0 at pci3 dev 0 function 0 vendor "SanDisk", unknown product 0x5009 rev 0x01: msix, NVMe 1.4 nvme0: WDC WDS500G2B0C-00PXH0, firmware 211070WD, serial 20195E800651 scsibus0 at nvme0: 2 targets, initiator 0 sd0 at scsibus0 targ 1 lun 0: sd0: 476940MB, 512 bytes/sector, 976773168 sectors phb2 at mainbus0: chip 0x0 pci4 at phb2 ppb2 at pci4 dev 0 function 0 "IBM POWER9 Host" rev 0x00 pci5 at ppb2 bus 1 phb3 at mainbus0: chip 0x0 pci6 at phb3 ppb3 at pci6 dev 0 function 0 "IBM POWER9 Host" rev 0x00 pci7 at ppb3 bus 1 xhci0 at pci7 dev 0 function 0 "TI xHCI" rev 0x02: msix, xHCI 0.96 usb0 at xhci0: USB revision 3.0 uhub0 at usb0 configuration 1 interface 0 "TI xHCI root hub" rev 3.00/1.00 addr 1 phb4 at mainbus0: chip 0x0 pci8 at phb4 ppb4 at pci8 dev 0 function 0 "IBM POWER9 Host" rev 0x00 pci9 at ppb4 bus 1 bge0 at pci9 dev 0 function 0 "Broadcom BCM5719" rev 0x01, BCM5719 A1 (0x5719001), APE firmware NCSI 1.3.12.0: msi, address 2c:09:4d:00:07:1b brgphy0 at bge0 phy 1: BCM5719C 10/100/1000baseT PHY, rev. 0 bge1 at pci9 dev 0 function 1 "Broadcom BCM5719" rev 0x01, BCM5719 A1 (0x5719001), APE firmware NCSI 1.3.12.0: msi, address 2c:09:4d:00:07:1c brgphy1 at bge1 phy 2: BCM5719C 10/100/1000baseT PHY, rev. 0 phb5 at mainbus0: chip 0x0 pci10 at phb5 ppb5 at pci10 dev 0 function 0 "IBM POWER9 Host" rev 0x00 pci11 at ppb5 bus 1 ppb6 at pci11 dev 0 function 0 "ASPEED Technology AST1150 PCI" rev 0x04 pci12 at ppb6 bus 2 astfb0 at pci12 dev 0 function 0 "ASPEED Technology AST2000" rev 0x41: can't map framebuffer "psi" at mainbus0 not configured "vas" at mainbus0 not configured "vpd" at mainbus0 not configured "xscom" at mainbus0 not configured uhub1 at uhub0 port 3 configuration 1 interface 0 "Aspeed USB Virtual Hub" rev 2.00/1.00 addr 2 uhidev0 at uhub1 port 1 configuration 1 interface 0 "OpenBMC virtual_input" rev 2.00/1.00 addr 3 uhidev0: iclass 3/1 ukbd0 at uhidev0: 8 variable keys, 6 key codes wskbd0 at ukbd0 mux 1 uhidev1 at uhub1 port 1 configuration 1 interface 1 "OpenBMC virtual_input" rev 2.00/1.00 addr 3 uhidev1: iclass 3/1 ums0 at uhidev1: 3 buttons wsmouse0 at ums0 mux 0 uhub2 at uhub0 port 4 configuration 1 interface 0 "Genesys Logic USB2.0 Hub" rev 2.00/32.98 addr 4 vscsi0 at root scsibus1 at vscsi0: 256 targets softraid0 at root scsibus2 at softraid0: 256 targets sd1 at scsibus2 targ 1 lun 0: sd1: 6149MB, 512 bytes/sector, 12594448 sectors root on sd0a (9b297870368985ec.a) swap on sd0b dump on sd0b uhub1: illegal enable change, port 1