OS/2, eCS & ArcaOS - Technical > Programming
An XWorkplace CPU Temperature Widget for AMD CPUs
Lars:
Found out what the problem was: I need to use DosSetThreadAffinity to force the execution onto a specfic logical Processor. Plus, it is better to leave the other settings in the CPU temperature register unmodified.
DosSetThreadAffinity has the oddity that if I specify affinity = {1,0} (that is, only logical processor 1) it will block the system, so I need to specify {3,0} for whatever reason to make it work.
In order to report all temperatures, I would need to walk through all logical processors (by using DosSetThreadAffinity) but I think I am going to stick to logical processor number 1 (the CPU widget only displays one temperature anyway).
Will attach what I have right now, just hold on ...
Lars:
Hi Dariusz,
try the attached. If you look at the output, check "local APIC ID" to see if it is constant (it should never change from one invocation to the next).
Feel free to modify the code and propose different stuff.
My experience is that logical processor 1 is always the hottest as it is most busy under OS/2 (logical processor 1 has special role under OS/2: will exclusively run IRQ handlers, for example).
Dariusz Piatkowski:
Hi Lars,
--- Quote from: Lars on March 09, 2025, 02:20:08 pm ---try the attached. If you look at the output, check "local APIC ID" to see if it is constant (it should never change from one invocation to the next).
Feel free to modify the code and propose different stuff.
--- End quote ---
Yup, that works. I am consistenty seeing just 'Local APIC:0x01':
--- Code: ---[G:\test\cputemp]cputemp
AMD CPU: Family:0x15, Model:0x02, Local APIC:0x01
MMIO Configuration Base Address:0x00000000E0000000
Temperature core 0 (0x3B800F5F):59.50 °C
[G:\test\cputemp]cputemp
AMD CPU: Family:0x15, Model:0x02, Local APIC:0x01
MMIO Configuration Base Address:0x00000000E0000000
Temperature core 0 (0x3B400F5F):59.25 °C
[G:\test\cputemp]cputemp
AMD CPU: Family:0x15, Model:0x02, Local APIC:0x01
MMIO Configuration Base Address:0x00000000E0000000
Temperature core 0 (0x3C600F5F):60.38 °C
--- End code ---
--- Quote from: Lars on March 09, 2025, 02:20:08 pm ---My experience is that logical processor 1 is always the hottest as it is most busy under OS/2 (logical processor 1 has special role under OS/2: will exclusively run IRQ handlers, for example).
--- End quote ---
I think this makes sense, but I'll say this: I have been consistently surprised that acpistat reports the most IRQs being handled by P002 on my box:
--- Code: ---The version of ACPI.PSD that is installed is 3.23.16
The system is operating in Symmetric mode (Mode 2)
The kernel is 14.203_SMP
The retail PSD is installed
Number of interrupts available: 60
IRQ 00 count 5727838
IRQ 01 count 41176
IRQ 04 count 970024
IRQ 07 count 86
IRQ 08 count 161109395
IRQ 09 count 525
IRQ 12 count 560805
IRQ 14 count 2181
IRQ 16 count 10601
IRQ 17 count 14
IRQ 18 count 320483
IRQ 19 count 3487544
MSI 46 count 6689081
========== CPU0 ==================
ACPI name [P001]
IPIGenCount = 4708113 IPICount = 68489594 HaltCount = 0
IPIPsdCount = 0 IdleCount = 186081463 BusyCount = 7350809
========== CPU1 ==================
ACPI name [P002]
IPIGenCount = 171725589 IPICount = 37725731 HaltCount = 4
IPIPsdCount = 0 IdleCount = 34529681 BusyCount = 34529679
========== CPU2 ==================
ACPI name [P003]
IPIGenCount = 45044918 IPICount = 61734043 HaltCount = 4
IPIPsdCount = 0 IdleCount = 35391949 BusyCount = 35391948
========== CPU3 ==================
ACPI name [P004]
IPIGenCount = 52654385 IPICount = 60671812 HaltCount = 4
IPIPsdCount = 0 IdleCount = 35551057 BusyCount = 35551056
========== CPU4 ==================
ACPI name [P005]
IPIGenCount = 49883419 IPICount = 61011487 HaltCount = 4
IPIPsdCount = 0 IdleCount = 35997515 BusyCount = 35997513
========== CPU5 ==================
ACPI name [P006]
IPIGenCount = 53737973 IPICount = 60473144 HaltCount = 4
IPIPsdCount = 0 IdleCount = 36198100 BusyCount = 36198099
========== CPU6 ==================
ACPI name [P007]
IPIGenCount = 47435079 IPICount = 61374857 HaltCount = 4
IPIPsdCount = 0 IdleCount = 35395312 BusyCount = 35395311
========== CPU7 ==================
ACPI name [P008]
IPIGenCount = 47665206 IPICount = 61374014 HaltCount = 4
IPIPsdCount = 0 IdleCount = 35555379 BusyCount = 35555378
--- End code ---
...unless of course that "IPIGenCount" value <> IRQ count?
Lars:
1) as a test: if you modify the affinity mask of DosSetThreadAffinity to say 0x4,0, you will always see LocalAPIC 2 being displayed and as I suspect, with the temperature value of that logical processor that has that LocalAPIC ID, so it will be different. You can test ...
2) "IPIGenCount" reflects the number of times a core generates an IPI (Inter Processor Interrupt) to CPU0 to get its attention for various reasons (synchronisation, requesting exclusive access to a resource, whatever)..
In other words: that core does not handle an interrupt but instead, it generates an interrupt (to CPU0) and it is not an interrupt routed via an interrupt controller but rather within the chip itself. I don't know what "IPICount" is. Maybe this is indeed the other way around, any other CPU generating an IPI to that CPU, in which case there is some interrupt handling going on on all cores besides CPU0. But Hardware devices induced interrupts routed via an interrupt controller (all those IRQ and MSI interrupts, say USB Host controller, Network controller, audio device, timer tick device etc.) will always only be handled by CPU0.
Lars:
@Dariusz: I have now made an XCenter Widget of it. Can you test ?
By the way: having the SYSCALL driver installed is no longer necessary. You do not need anything besides the Widget.
Source is included.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version