Skip to content

Commit 68efb8b

Browse files
committed
Introducing a framework to collect thermal points, per Core, per Package.
For capable processors, thresholds and limits within registers: * Intel: MSR_IA32_THERM_INTERRUPT; MSR_IA32_PACKAGE_THERM_INTERRUPT * AMD: SMU_AMD_THM_TCTL_REGISTER_F17H at offsets 0x4 and 0x8
1 parent 1cccd64 commit 68efb8b

10 files changed

+235
-13
lines changed

corefreq-api.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ typedef struct
361361
} Delta __attribute__ ((aligned (8)));
362362

363363
POWER_THERMAL PowerThermal;
364+
THERMAL_POINT ThermalPoint;
364365

365366
struct
366367
{
@@ -877,6 +878,8 @@ typedef struct
877878
};
878879
} PowerThermal;
879880

881+
THERMAL_POINT ThermalPoint;
882+
880883
struct {
881884
struct {
882885
size_t Size;

corefreq-cli-rsc-en.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,9 @@
997997
#define RSC_POWER_THERMAL_TPL_CODE_EN "Power Limit"
998998
#define RSC_POWER_THERMAL_EDC_CODE_EN "Electrical Design Current"
999999
#define RSC_POWER_THERMAL_TDC_CODE_EN "Thermal Design Current"
1000+
#define RSC_POWER_THERMAL_POINT_CODE_EN "Thermal Point"
1001+
#define RSC_THERMAL_POINT_THRESHOLD_CODE_EN "Threshold"
1002+
#define RSC_THERMAL_POINT_LIMIT_CODE_EN "Limit"
10001003

10011004
#define RSC_KERNEL_TITLE_CODE_EN " Kernel "
10021005
#define RSC_KERNEL_TOTAL_RAM_CODE_EN "Total RAM"

corefreq-cli-rsc-fr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ do echo -en "$h$l\t""\xc3""\x$h$l""\t"; done; done;echo
645645
#define RSC_POWER_THERMAL_TPL_CODE_FR "Limite de puissance"
646646
#define RSC_POWER_THERMAL_EDC_CODE_FR "Limite de courant sup""\xa9""rieure"
647647
#define RSC_POWER_THERMAL_TDC_CODE_FR "Limite de courant sup""\xa9""rieure"
648+
#define RSC_POWER_THERMAL_POINT_CODE_FR "Seuil thermique"
649+
#define RSC_THERMAL_POINT_THRESHOLD_CODE_FR "Threshold"
650+
#define RSC_THERMAL_POINT_LIMIT_CODE_FR "Limite"
648651

649652
#define RSC_KERNEL_TITLE_CODE_FR " Noyau "
650653
#define RSC_KERNEL_TOTAL_RAM_CODE_FR "RAM totale"

corefreq-cli-rsc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,9 @@ RESOURCE_ST Resource[] = {
997997
LDT(RSC_POWER_THERMAL_TPL),
998998
LDT(RSC_POWER_THERMAL_EDC),
999999
LDT(RSC_POWER_THERMAL_TDC),
1000+
LDT(RSC_POWER_THERMAL_POINT),
1001+
LDT(RSC_THERMAL_POINT_THRESHOLD),
1002+
LDT(RSC_THERMAL_POINT_LIMIT),
10001003
LDQ(RSC_POWER_LABEL_ODCM),
10011004
LDQ(RSC_POWER_LABEL_PWM),
10021005
LDQ(RSC_POWER_LABEL_BIAS),

corefreq-cli-rsc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,9 @@ enum {
811811
RSC_POWER_THERMAL_TPL,
812812
RSC_POWER_THERMAL_EDC,
813813
RSC_POWER_THERMAL_TDC,
814+
RSC_POWER_THERMAL_POINT,
815+
RSC_THERMAL_POINT_THRESHOLD,
816+
RSC_THERMAL_POINT_LIMIT,
814817
RSC_POWER_LABEL_ODCM,
815818
RSC_POWER_LABEL_PWM,
816819
RSC_POWER_LABEL_BIAS,

corefreq-cli.c

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4020,7 +4020,6 @@ REASON_CODE SysInfoPwrThermal(Window *win, CUINT width, CELL_FUNC OutFunc)
40204020
- RSZ(POWER_THERMAL_MAX), hSpace,
40214021
RSC(POWER_LABEL_MAX).CODE(), POWERED(0) );
40224022
}
4023-
{
40244023
struct {
40254024
const ASCII *code;
40264025
const int size;
@@ -4113,7 +4112,6 @@ REASON_CODE SysInfoPwrThermal(Window *win, CUINT width, CELL_FUNC OutFunc)
41134112
PL2_Update, pw );
41144113
}
41154114
}
4116-
}
41174115
if((Shm->Proc.Features.Info.Vendor.CRC == CRC_AMD)
41184116
|| (Shm->Proc.Features.Info.Vendor.CRC == CRC_HYGON))
41194117
{
@@ -4158,6 +4156,60 @@ REASON_CODE SysInfoPwrThermal(Window *win, CUINT width, CELL_FUNC OutFunc)
41584156
width - 18 - RSZ(POWER_THERMAL_TDC), hSpace,
41594157
RSC(POWER_LABEL_TDC).CODE(), POWERED(0) );
41604158
}
4159+
4160+
PUT( SCANKEY_NULL, attrib[0], width, 2, "%s %s",
4161+
RSC(POWER_LABEL_CORE).CODE(), RSC(POWER_THERMAL_POINT).CODE() );
4162+
4163+
enum THM_POINTS tp;
4164+
for (tp = THM_THRESHOLD_1; tp < THM_POINTS_DIM; tp++)
4165+
{
4166+
if (BITVAL(Shm->Cpu[Shm->Proc.Service.Core].ThermalPoint.Mask, tp)
4167+
& BITVAL(Shm->Cpu[Shm->Proc.Service.Core].ThermalPoint.State, tp))
4168+
{
4169+
ASCII *code;
4170+
int size;
4171+
if (BITVAL(Shm->Cpu[Shm->Proc.Service.Core].ThermalPoint.Kind, tp)) {
4172+
code = RSC(THERMAL_POINT_LIMIT).CODE();
4173+
size = RSZ(THERMAL_POINT_LIMIT);
4174+
} else {
4175+
code = RSC(THERMAL_POINT_THRESHOLD).CODE();
4176+
size = RSZ(THERMAL_POINT_THRESHOLD);
4177+
}
4178+
PUT( SCANKEY_NULL, attrib[5], width, 3,
4179+
"%s%.*s%s [%5u %c]",
4180+
RSC(POWER_THERMAL_POINT).CODE(),
4181+
width - (OutFunc == NULL ? 18 : 16)
4182+
- RSZ(POWER_THERMAL_POINT) - size, hSpace, code,
4183+
Shm->Cpu[Shm->Proc.Service.Core].ThermalPoint.Value[tp], 'C');
4184+
}
4185+
}
4186+
4187+
PUT( SCANKEY_NULL, attrib[0], width, 2, "%s %s",
4188+
RSC(POWER_LABEL_PKG).CODE(), RSC(POWER_THERMAL_POINT).CODE() );
4189+
4190+
for (tp = THM_THRESHOLD_1; tp < THM_POINTS_DIM; tp++)
4191+
{
4192+
if (BITVAL(Shm->Proc.ThermalPoint.Mask, tp)
4193+
& BITVAL(Shm->Proc.ThermalPoint.State, tp))
4194+
{
4195+
ASCII *code;
4196+
int size;
4197+
if (BITVAL(Shm->Proc.ThermalPoint.Kind, tp)) {
4198+
code = RSC(THERMAL_POINT_LIMIT).CODE();
4199+
size = RSZ(THERMAL_POINT_LIMIT);
4200+
} else {
4201+
code = RSC(THERMAL_POINT_THRESHOLD).CODE();
4202+
size = RSZ(THERMAL_POINT_THRESHOLD);
4203+
}
4204+
PUT( SCANKEY_NULL, attrib[5], width, 3,
4205+
"%s%.*s%s [%5u %c]",
4206+
RSC(POWER_THERMAL_POINT).CODE(),
4207+
width - (OutFunc == NULL ? 18 : 16)
4208+
- RSZ(POWER_THERMAL_POINT) - size, hSpace, code,
4209+
Shm->Proc.ThermalPoint.Value[tp], 'C');
4210+
}
4211+
}
4212+
41614213
PUT( SCANKEY_NULL, attrib[0], width, 2,
41624214
(char*) RSC(POWER_THERMAL_UNITS).CODE(), NULL );
41634215

corefreq.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ typedef struct
153153
} HWP;
154154
} PowerThermal;
155155

156+
THERMAL_POINT ThermalPoint;
157+
156158
struct {
157159
struct {
158160
double Limit[SENSOR_LIMITS_DIM];
@@ -445,6 +447,8 @@ typedef struct
445447
} Feature;
446448
} Power;
447449

450+
THERMAL_POINT ThermalPoint;
451+
448452
signed int ArchID;
449453
enum HYPERVISOR HypervisorID;
450454
char Architecture[CODENAME_LEN],

corefreqd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,9 @@ void Package_Update(SHM_STRUCT *Shm, RO(PROC) *RO(Proc), RW(PROC) *RW(Proc))
17761776
PowerInterface(Shm, RO(Proc));
17771777

17781778
Mitigation_1st_Stage(Shm, RO(Proc), RW(Proc));
1779+
1780+
memcpy(&Shm->Proc.ThermalPoint, &RO(Proc)->ThermalPoint,
1781+
sizeof(THERMAL_POINT));
17791782
}
17801783

17811784
typedef struct {
@@ -5654,6 +5657,9 @@ void PowerThermal(SHM_STRUCT *Shm, RO(PROC) *RO(Proc), RO(CORE) **RO(Core),
56545657

56555658
Shm->Cpu[cpu].PowerThermal.HWP.Request.Energy_Pref = \
56565659
RO(Core, AT(cpu))->PowerThermal.HWP_Request.Energy_Pref;
5660+
5661+
memcpy(&Shm->Cpu[cpu].ThermalPoint, &RO(Core, AT(cpu))->ThermalPoint,
5662+
sizeof(THERMAL_POINT));
56575663
}
56585664

56595665
void SystemRegisters(SHM_STRUCT *Shm, RO(CORE) **RO(Core), unsigned int cpu)

0 commit comments

Comments
 (0)