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

iMac drive bay temperature shown as 249 º C. #48

Closed
xxxserxxx opened this issue Feb 15, 2020 · 23 comments
Closed

iMac drive bay temperature shown as 249 º C. #48

xxxserxxx opened this issue Feb 15, 2020 · 23 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@xxxserxxx
Copy link
Owner

gotop v3.0.0 displays hard_drive_bay temperature as 249 º C on two different 27'' iMacs (both have fusion drives), but displays correct information on 12'' Macbook and 15'' Macbook Pro.

Required information:

  • gotop version (gotop -V):
    3.0.0

  • The output of uname -a:
    Darwin Jupiter.local 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64

  • Terminal emulator (e.g. iTerm or gnome terminal):
    Apple Terminal.app or iTerm.

  • Any releveant hardware info:
    iMac (Retina 5K, 27-inch, 2017)
    3.4 GHz Quad-Core Intel Core i5
    40 GB 2400 MHz DDR4
    Radeon Pro 570 4 GB
    APPLE HDD ST1000DM003:
    Capacity: 1 TB (1,000,204,886,016 bytes)
    Model: APPLE HDD ST1000DM003
    Revision: AQ04
    Native Command Queuing: Yes
    Queue Depth: 32
    Removable Media: No
    Detachable Drive: No
    BSD Name: disk1
    Medium Type: Rotational
    Partition Map Type: GPT (GUID Partition Table)
    S.M.A.R.T. status: Verified
    Volumes:
    EFI:
    Capacity: 209.7 MB (209,715,200 bytes)
    File System: MS-DOS FAT32
    BSD Name: disk1s1
    Content: EFI
    Volume UUID: BDC1974F-6B8C-3DAE-9DB2-3AA3C17BF506
    disk1s2:
    Capacity: 1 TB (999,995,129,856 bytes)
    BSD Name: disk1s2
    Content: Apple_APFS

  • tmux version if using tmux:
    Not using tmux

Also please copy or attach ~/.local/state/gotop/errors.log if it exists and contains logs:
errors.log is empty

@xxxserxxx
Copy link
Owner Author

Note that all other temperatures seam reasonable (except perhaps ambient air temperature which is very low 4 º C up to 8 º C for iMacs).

@xxxserxxx
Copy link
Owner Author

Clone cjbassi#176
@mario-grgic FYI

@xxxserxxx xxxserxxx added the bug Something isn't working label Feb 19, 2020
@xxxserxxx xxxserxxx added this to the v3.6.0 milestone Mar 7, 2020
@xxxserxxx
Copy link
Owner Author

@mario-grgic, are you still having this issue, and are you willing to help in debugging this? I don't have access to a Mac (or, as may be necessary with this ticket, many Macs) to track the issue down.

@xxxserxxx xxxserxxx self-assigned this Apr 16, 2020
@mario-grgic
Copy link

In the current version 3.5.0 hard drive bay temperature is no longer displayed as a statistic, so it's hard to tell if it is fixed per se. The temperatures that are displayed look plausible, except the ambient air temperature which shows 8 º C.

@xxxserxxx
Copy link
Owner Author

@mario-grgic , I've created a little program to dump the temperature values directly from SMC. You can download the tarball from here; the link will be valid through Apr 26. The archive contains the source for the program and a compiled executable; you can also compile it yourself with a simple go build -o dumptemps . from within the directory if you have Go installed.

If you would please run the program and post the output, it'd help me see what the raw values are coming out of your computer.

@mario-grgic
Copy link

Here is the output from 2017 15'' Macbook Pro:

$ ./dumptemps 
              enclosure_base_1: 25              enclosure_base_3: 0               cpu_0_proximity: 36                 thunderbolt_0: 0                 ambient_air_1: 0                 memory_slot_0: 0                cpu_0_heatsink: 0        memory_slots_proximity: 35                 ambient_air_0: 0                   northbridge: 0               wireless_module: 39                   cpu_0_diode: 0                 thunderbolt_1: 0             northbridge_diode: 0               gpu_0_proximity: 33                gpu_0_heatsink: 0                hard_drive_bay: 0              enclosure_base_0: 25         northbridge_proximity: 0              enclosure_base_2: 25                   gpu_0_diode: 35$ 

And from 2017 27'' iMac:

$ ./dumptemps 
                hard_drive_bay: 249               gpu_0_proximity: 26                 ambient_air_0: 6                 ambient_air_1: 0             northbridge_diode: 0                gpu_0_heatsink: 0         northbridge_proximity: 0                   northbridge: 0              enclosure_base_0: 0                   cpu_0_diode: 0        memory_slots_proximity: 28              enclosure_base_2: 0                   gpu_0_diode: 32                cpu_0_heatsink: 0              enclosure_base_1: 0               cpu_0_proximity: 29              enclosure_base_3: 0               wireless_module: 0                 thunderbolt_0: 0                 memory_slot_0: 0                 thunderbolt_1: 0$ 

@xxxserxxx
Copy link
Owner Author

Crap. I forgot carriage returns in the Printfs. Oh well; I can reformat it, thanks.

@xxxserxxx
Copy link
Owner Author

The numbers being returned by the C code still look weird, and that's coming directly from SMC calls. There could be a bug in smc.c. It looks like the same C code is widely used across github projects, and the last copyright is from 2014.

There's another project that provides binaries to do a similar data dump using different SMC libraries. Do you mind downloading one of their releases and providing the temperature output? If those look more reasonable, that project uses a different library; that uses a C binding with an even older copyright, but if it produces more reasonable data, I can replace smc.c from the gopsutils project.

@mario-grgic
Copy link

mario-grgic commented Apr 22, 2020

Here is the output of iSMC on 2017 27'' iMac:

Temperature:
 DESCRIPTION                                                      KEY   VALUE      TYPE 
 AirFlow 1                                                        TA0P     6.9 °C  sp78 
 Ambient Virtual                                                  TA0V    18.2 °C  sp78 
 Ambient Raw                                                      TA0p    26.9 °C  sp78 
 CPU 1 Virtual                                                    TC0E    67.6 °C  sp78 
 CPU 1 Virtual                                                    TC0F    65.9 °C  sp78 
 CPU PECI Die Max Error                                           TC0J     1.6 °C  sp78 
 CPU 1 Proximity                                                  TC0P    31.4 °C  sp78 
 CPU PECI Die Trend                                               TC0T     0.0 °C  sp78 
 CPU Core 0 Absolute Raw                                          TC0c    31.0 °C  sp78 
 CPU Proximity Raw                                                TC0p    31.4 °C  sp78 
 CPU Core 1 Absolute Raw                                          TC1c    31.0 °C  sp78 
 CPU Core 2 Absolute Raw                                          TC2c    30.0 °C  sp78 
 CPU Core 3 Absolute Raw                                          TC3c    30.0 °C  sp78 
 PECI GPU                                                         TCGc    32.0 °C  sp78 
 PECI SA                                                          TCSc    29.0 °C  sp78 
 CPU Max Package Core Relative Cooked                             TCXR    67.9 °C  sp78 
 PECI CPU                                                         TCXc    32.1 °C  sp78 
 CPU Max Package Core Relative Raw                                TCXr    67.9 °C  sp78 
 GPU Die                                                          TG0D    37.0 °C  sp78 
 GPU 0 Die Filtered For Fan Control                               TG0E    37.0 °C  sp78 
 GPU 0 Die Filtered And Adjusted For Power Control                TG0F    37.5 °C  sp78 
 GPU 0 Die Max Error Used In TG0F=TG0E+                           TG0J     0.5 °C  sp78 
 GPU Proximity                                                    TG0P    30.4 °C  sp78 
 GPU 0 Die Raw                                                    TG0d    37.0 °C  sp78 
 GPU 0 Proximity Raw                                              TG0p    30.4 °C  sp78 
 GPU A VRAM Proximity Cooked                                      TG1P    34.1 °C  sp78 
 GPU Digital Die Raw                                              TG1d    34.1 °C  sp78 
 GPU GDDR5 Proximity 1 Raw                                        TG1p    34.1 °C  sp78 
 GPU A VR Proximity Cooked                                        TG2P    31.5 °C  sp78 
 GPU VR Proximity 2 Raw                                           TG2p    31.5 °C  sp78 
 GPU B Proximity Cooked                                           TG3P    35.5 °C  sp78 
 GPU FB VR Proximity 3                                            TG3p    35.5 °C  sp78 
 Drive 0 OOBv1 Mapped                                             TH0O     7.0 °C  sp78 
 HDD Bay 1                                                        TH0P     7.0 °C  sp78 
 Drive 0 OOBv1 Raw Bit-Mapped                                     TH0o     7.0 °C  hex_ 
 SSD 1 OOBv3 Absolute Cooked A                                    TH1A    27.0 °C  sp78 
 SSD 1                                                            TH1F    61.9 °C  sp78 
 Drive 1 OOBv1 Mapped                                             TH1O     9.0 °C  sp78 
 SSD 1                                                            TH1R    62.0 °C  sp78 
 Drive 1 OOBv3 Absolute Raw A                                     TH1a    27.0 °C  sp78 
 Drive 1 OOBv1 Raw Bit-Mapped                                     TH1o   129.0 °C  hex_ 
 LCD Proximity                                                    TL0P    27.4 °C  sp78 
 LCD Filtered Right Front-Of-Screen Virtual                       TL0V    27.6 °C  sp78 
 LCD UnFiltered Front-Of-Screen Raw                               TL0p    27.4 °C  sp78 
 LCD TCON Proximity Cooked                                        TL1P    28.6 °C  sp78 
 LCD TL1v-Filtered Center Front-Of-Screen For Color Compensation  TL1V    25.0 °C  sp78 
 LCD TCON Proximity Raw                                           TL1p    28.6 °C  sp78 
 LCD TL1v-Filtered Center Front-Of-Screen For Color Compensation  TL1v    25.0 °C  sp78 
 Mem Bank A1                                                      TM0P    29.4 °C  sp78 
 Drive 0 Sensor Existence Used For TM0V                           TM0V    31.2 °C  sp78 
 DIMM 0 Proximity Raw                                             TM0p    29.4 °C  sp78 
 Mem Bank A2                                                      TM1P    26.4 °C  sp78 
 DIMM Virtual For 2x DIMM Slot1+2+3+4 Config                      TM1a    33.4 °C  sp78 
 DIMM 1 Proximity Raw                                             TM1p    26.4 °C  sp78 
 DIMM 0/1 VR Proximity Cooked                                     TM2P    27.9 °C  sp78 
 DIMM Virtual For 2x DIMM Slot1+3 Config                          TM2a    32.0 °C  sp78 
 DIMM Virtual For 2x DIMM Slot1+2 Or Slot2+3 Config               TM2b    32.4 °C  sp78 
 DIMM Virtual For 2x DIMM Slot1+4 Or Slot2+4 Config               TM2c    31.6 °C  sp78 
 DIMM Virtual For 2x DIMM Slot3+4 Config                          TM2d    33.6 °C  sp78 
 DIMM 2 Proximity Raw                                             TM2p    27.9 °C  sp78 
 DIMM 2/3 VR Proximity Cooked                                     TM3P    27.8 °C  sp78 
 DIMM Virtual For 3x DIMM Slot2+3+4 Config                        TM3a    31.8 °C  sp78 
 DIMM Virtual For 3x DIMM Slot1+3+4 Config                        TM3b    33.8 °C  sp78 
 DIMM Virtual For 3x DIMM Slot1+2+4 Config                        TM3c    30.5 °C  sp78 
 DIMM Virtual For 3x DIMM Slot1+2+3 Config                        TM3d    31.8 °C  sp78 
 DIMM 3 Proximity Raw                                             TM3p    27.8 °C  sp78 
 DIMM Virtual For 4x DIMM Slot1+2+3+4 Config                      TM4a    31.2 °C  sp78 
 DIMM Proximity Max Cooked                                        TMXP    29.4 °C  sp78 
 PCH Die                                                          TPCD    28.0 °C  sp78 
 Skin 0 Virtual                                                   TS0V    27.4 °C  sp78 
 BLC Proximity                                                    Tb0P    35.1 °C  sp78 
 Backlight Controller Proximity Raw                               Tb0p    35.1 °C  sp78 
 Mainboard Proximity                                              Tm0P    28.2 °C  sp78 
 EMC1428 Internal Diode Raw                                       Tm0p    28.2 °C  sp78 
 MLB Bottom Side                                                  Tm1P    28.9 °C  sp78 
 MLB Proximity 1 Raw                                              Tm1p    28.9 °C  sp78 
 MLB Proximity 2 Cooked                                           Tm2P    30.9 °C  sp78 
 MLB Proximity 2 Raw                                              Tm2p    30.9 °C  sp78 
 Power Supply T2 Secondary Heatsink Filtered                      Tp2F    28.0 °C  sp78 
 Power Supply T2 Secondary Heatsink Cooked                        Tp2H    28.0 °C  sp78 
 Power Supply T2 Secondary Heatsink Raw                           Tp2h    28.0 °C  sp78 

@xxxserxxx
Copy link
Owner Author

Well, there's one thing. On the 27", smc.c asks for celcius, but is obviously getting back fahrenheit: drive 1 in gosmc is 129°C (gosmc) == 264°F ≅249° (smc.c).

Ok, I've pulled out the relevant code from gosmc. I don't want to use it directly because it includes a CLI that pulls in a bunch of heavy dependencies, but I may clone it and strip all of that out because it is really nicely written and has support for fans and other stuff I might like to use. Can you try this binary and let me know how it works? It should produce similar labels & values as gosmc.

@mario-grgic
Copy link

Here it is

$ ./sersmc 
DIMM Virtual For 2x DIMM Slot1+3 Config: 33.2 °C
                 LCD Proximity: 27.9 °C
LCD UnFiltered Front-Of-Screen Raw: 27.9 °C
Drive 0 Sensor Existence Used For TM0V: 32.5 °C
          DIMM 0 Proximity Raw: 30.6 °C
Power Supply T2 Secondary Heatsink Filtered: 28.8 °C
                GPU Die Analog: 0.0 °C
        GPU B Proximity Cooked: 37.0 °C
DIMM Virtual For 2x DIMM Slot1+2+3+4 Config: 34.7 °C
DIMM Virtual For 4x DIMM Slot1+2+3+4 Config: 32.5 °C
          Drive 0 OOBv1 Mapped: 7.0 °C
DIMM Virtual For 3x DIMM Slot1+3+4 Config: 35.1 °C
                       PCH Die: 31.0 °C
Backlight Controller Proximity Raw: 36.8 °C
                     AirFlow 1: 8.1 °C
       CPU Core 0 Absolute Raw: 33.0 °C
                       PECI SA: 30.0 °C
CPU Max Package Core Relative Raw: 65.7 °C
               CPU 1 Proximity: 32.8 °C
             CPU Proximity Raw: 32.8 °C
CPU Max Package Core Relative Cooked: 65.7 °C
          DIMM 1 Proximity Raw: 27.2 °C
                Skin 0 Virtual: 28.4 °C
               MLB Bottom Side: 30.4 °C
                      PECI GPU: 34.0 °C
          Drive 1 OOBv1 Mapped: 9.0 °C
DIMM Virtual For 3x DIMM Slot1+2+3 Config: 33.1 °C
     DIMM Proximity Max Cooked: 30.6 °C
 SSD 1 OOBv3 Absolute Cooked A: 28.0 °C
  Drive 1 OOBv3 Absolute Raw A: 28.0 °C
LCD TL1v-Filtered Center Front-Of-Screen For Color Compensation: 25.6 °C
                   Ambient Raw: 28.1 °C
       CPU Core 1 Absolute Raw: 32.0 °C
       CPU Core 2 Absolute Raw: 31.0 °C
        GPU VR Proximity 2 Raw: 32.9 °C
DIMM Virtual For 2x DIMM Slot1+4 Or Slot2+4 Config: 32.9 °C
           Mainboard Proximity: 29.4 °C
            CPU PECI Die Trend: 0.0 °C
GPU 0 Die Filtered For Fan Control: 38.6 °C
           GPU Digital Die Raw: 35.9 °C
                   Mem Bank A2: 27.2 °C
     LCD TCON Proximity Cooked: 29.2 °C
DIMM Virtual For 3x DIMM Slot2+3+4 Config: 33.1 °C
Power Supply T2 Secondary Heatsink Cooked: 28.8 °C
        CPU PECI Die Max Error: 2.2 °C
GPU 0 Die Max Error Used In TG0F=TG0E+: 0.7 °C
                     HDD Bay 1: 7.0 °C
                         SSD 1: 61.0 °C
       CPU Core 3 Absolute Raw: 32.0 °C
LCD Filtered Right Front-Of-Screen Virtual: 28.1 °C
          DIMM 3 Proximity Raw: 29.0 °C
           MLB Proximity 1 Raw: 30.4 °C
          DIMM 2 Proximity Raw: 28.9 °C
                       GPU Die: 39.0 °C
  Drive 0 OOBv1 Raw Bit-Mapped: 7.0 °C
GPU 0 Die Filtered And Adjusted For Power Control: 39.3 °C
                 BLC Proximity: 36.8 °C
  Drive 1 OOBv1 Raw Bit-Mapped: 129.0 °C
        LCD TCON Proximity Raw: 29.2 °C
  DIMM 0/1 VR Proximity Cooked: 28.9 °C
DIMM Virtual For 2x DIMM Slot1+2 Or Slot2+3 Config: 33.7 °C
                 GPU 0 Die Raw: 39.0 °C
           GPU 0 Proximity Raw: 31.9 °C
     GPU A VR Proximity Cooked: 32.9 °C
         GPU FB VR Proximity 3: 37.0 °C
DIMM Virtual For 2x DIMM Slot3+4 Config: 34.8 °C
     GPU GDDR5 Proximity 1 Raw: 35.6 °C
                   Mem Bank A1: 30.6 °C
        MLB Proximity 2 Cooked: 32.1 °C
Power Supply T2 Secondary Heatsink Raw: 28.8 °C
                 CPU 1 Virtual: 63.2 °C
   GPU A VRAM Proximity Cooked: 35.6 °C
DIMM Virtual For 3x DIMM Slot1+2+4 Config: 31.8 °C
    EMC1428 Internal Diode Raw: 29.4 °C
           MLB Proximity 2 Raw: 32.1 °C
               Ambient Virtual: 18.8 °C
                      PECI CPU: 34.3 °C
                 GPU Proximity: 31.9 °C
  DIMM 2/3 VR Proximity Cooked: 29.0 °C

@xxxserxxx
Copy link
Owner Author

Much better, thank you. This was a big help, and I should be able to fix this from here.

If you get a chance at some point to post results from your 15", just so we can verify that the values are also sane on that device, that'd be great.

@xxxserxxx
Copy link
Owner Author

@mario-grgic here's a gotop using iSMC. It's gzip'ed, so you'll have to gunzip it after you download it. Would you please test this and see if it looks sane? To focus on the temps, you can run:

echo temp | ./gotop -l -

Assuming that you do something like:

curl -s https://srv-file9.gofile.io/download/UTKhZf/gotop_darwin_3.6.x.gz | \
   zcat -c > gotop && chmod u+x gotop

@mario-grgic
Copy link

Is there a branch for this code I can checkout and build?

@xxxserxxx
Copy link
Owner Author

There is now. Pull branch ismc. I can't give you many instructions about building on Darwin, but you need at least CGO_ENABLED=1 because of the SMC link.

@mario-grgic
Copy link

The temperatures look reasonable now. Not sure which ones should be displayed in the most common case (when you just launch gotop with no options). Right now only the top of the list of all available temp stats (that is displayed with echo temp | ./gotemp -l -) is displayed, but perhaps CPU, GPU, Memory and Disk temps are most useful to show in that case.

@xxxserxxx
Copy link
Owner Author

Yes, there are a ton of temperatures reported on OSX; maybe on Linux, too, but Caleb may have been filtering them. I'm going to mark this as fixed, but I'm also going to add a configuration option so users can specify which temps they want to see, and I'll default to a couple of the main ones as you suggest.

Thanks for the report, the help with tracking down the issue, and testing the solution.

@xxxserxxx
Copy link
Owner Author

@mario-grgic If you get a chance, could you pull and build the ismc branch?

This turned into a bit of a rabbit hole. I added sensible defaults for the thermal sensors, but this required changing how devices are configured and set up. If you wouldn't mind testing a couple things, if you can verify that they work on OSX I'll include this in the 3.6 release.

First, verify that the defaults are sensible:

echo temp | gotop -l -

and you should see 5 sensors: one or two CPUs, GPU, drive, memory. Then try:

gotop --list devices

and you should see all of the Mac temperature sensors. Finally, test configuring the sensors you want to see. I am not enabling a command line option for this, so it has to be done in the config file.

gotop --write-config    # Creates a default config file

Edit the config file that is printed from the previous command, and uncomment the last line, which should be #temperatures. Add a comma-separated list of sensor names from --list devices, and then run gotop again and verify that you see the sensors you picked.

Thanks again.

@mario-grgic
Copy link

Latest branch build leads to:

$ ./gotop 
panic: interface conversion: interface {} is nil, not bool

goroutine 1 [running]:
main.parseArgs(0xc0002282c0, 0x0, 0x0)
	/Volumes/ramdisk/gotop/cmd/gotop/main.go:112 +0x1b6a
main.run(0x0)
	/Volumes/ramdisk/gotop/cmd/gotop/main.go:471 +0x153
main.main()
	/Volumes/ramdisk/gotop/cmd/gotop/main.go:452 +0x34

@xxxserxxx
Copy link
Owner Author

Ooof. Thanks. I wish I could find a Darwin VM on which to test these things.

Hold on a tic.

@xxxserxxx
Copy link
Owner Author

Ok, that was dumb. Try again, please.

@mario-grgic
Copy link

mario-grgic commented Apr 24, 2020

Ok, this is much better. The only problem I can think of is that it is going to be hard to come up with defaults across hardware. The defaults that make sense on iMac say are different than I would want to display on MacBook Pro, and are different than the ones on I would use on 12'' Macbook (no fans at all, or discrete GPU).

But at least users have the chance to pick themselves what they want displayed.

@xxxserxxx
Copy link
Owner Author

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants