Skip to content

Commit

Permalink
Add WOF sensors for AMESTER
Browse files Browse the repository at this point in the history
Fix char/obs to active state change going to UT on PowerVM
Change-Id: I7ecad134b31b89a392271169400c0240416d62b7
RTC:  197146
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65520
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
Tested-by: Martha Broyles <mbroyles@us.ibm.com>
Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
  • Loading branch information
marthabroyles committed Sep 5, 2018
1 parent d84708e commit 0f604d6
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 54 deletions.
27 changes: 25 additions & 2 deletions src/occ_405/amec/amec_dps.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void amec_dps_partition_update_sensors(const uint16_t i_part_id)
uint32_t l_cg_slack_accumulator = 0;
uint16_t l_cg_util_slack_perc = 0;
uint32_t l_divide32[2] = {0, 0};

static bool L_trace = FALSE;
/*------------------------------------------------------------------------*/
/* Code */
/*------------------------------------------------------------------------*/
Expand Down Expand Up @@ -184,7 +184,17 @@ void amec_dps_partition_update_sensors(const uint16_t i_part_id)
}

// Update the sensor of the utilization slack
sensor_update(&g_amec->part_config.part_list[i_part_id].util2msslack, l_cg_util_slack_perc);
// verify the sensor exists for the core group
if(i_part_id < AMEC_PART_MAX_PART)
{
sensor_update(&g_amec->part_config.part_list[i_part_id].util2msslack, l_cg_util_slack_perc);
}
else if(!L_trace)
{
// indicates missing support for sensors based on AMEC_PART_MAX_PART
TRAC_ERR("amec_dps_partition_update_sensors: Invalid part id[0x%04x]", i_part_id);
L_trace = TRUE;
}
}

// Function Specification
Expand All @@ -207,6 +217,7 @@ void amec_dps_partition_alg(const uint16_t i_part_id)
uint16_t l_temp16 = 0;
uint32_t l_divide32[2] = {0, 0};
OCC_INTERNAL_MODE l_part_policy = 0xFF;
static bool L_trace = FALSE;

/*------------------------------------------------------------------------*/
/* Code */
Expand All @@ -227,6 +238,18 @@ void amec_dps_partition_alg(const uint16_t i_part_id)

case 41:
// Type 41 algorithm
// verify the part id is valid
if(i_part_id >= AMEC_PART_MAX_PART)
{
if(!L_trace)
{
// indicates missing support for sensors based on AMEC_PART_MAX_PART
TRAC_ERR("amec_dps_partition_alg: Invalid part id[0x%04x]", i_part_id);
L_trace = TRUE;
}
break;
}

// l_tempreg=measure of slack over gamma time interval on a per core basis
l_tempreg = (uint16_t)g_amec->part_config.part_list[i_part_id].util2msslack.sample;
// Convert to 10000 is equivalent to 100.00% utilization.
Expand Down
7 changes: 5 additions & 2 deletions src/occ_405/amec/amec_part.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@
// Number of cores in system
#define AMEC_PART_NUM_CORES (MAX_NUM_OCC * MAX_NUM_CORES)

// On a given OCC, only 12 partitions can be defined
#define AMEC_PART_MAX_PART MAX_NUM_CORES
// No support for PLPM, all cores will be in the same core group (partition)
// The main PLPM code will stay but the partition sensors were removed for all but the
// one core group in order to save SRAM
// If this ever changes then there must be sensors UTILSLCGx defined for each core group possible
#define AMEC_PART_MAX_PART 1

// Invalid core group ID
#define AMEC_PART_INVALID_ID 0xFF
Expand Down
2 changes: 2 additions & 0 deletions src/occ_405/amec/amec_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@ typedef struct
// WOF structure
amec_wof_t wof;

// WOF sensors
amec_wof_sensors_t wof_sensors;

//---------------------------------------------------------
//
Expand Down
2 changes: 1 addition & 1 deletion src/occ_405/occbuildname.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) =

#else

volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_180822a\0" /*</BuildName>*/ ;
volatile const char G_occ_buildname[16] __attribute__((section(".buildname"))) = /*<BuildName>*/ "op_occ_180904a\0" /*</BuildName>*/ ;

#endif
1 change: 1 addition & 0 deletions src/occ_405/sensor/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ typedef enum
AMEC_SENSOR_TYPE_FREQ = 0x0040,
AMEC_SENSOR_TYPE_POWER = 0x0080,
AMEC_SENSOR_TYPE_PERF = 0x0200,
AMEC_SENSOR_TYPE_WOF = 0x0400,
AMEC_SENSOR_TYPE_ALL = 0xffff,
}AMEC_SENSOR_TYPE;
// Changes to sensor type bits would require changes to select sensor groups command
Expand Down
18 changes: 7 additions & 11 deletions src/occ_405/sensor/sensor_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -719,17 +719,13 @@ enum e_gsid
// Partition Sensors
// ------------------------------------------------------
UTILSLCG000,
UTILSLCG001,
UTILSLCG002,
UTILSLCG003,
UTILSLCG004,
UTILSLCG005,
UTILSLCG006,
UTILSLCG007,
UTILSLCG008,
UTILSLCG009,
UTILSLCG010,
UTILSLCG011,

// ------------------------------------------------------
// WOF Sensors
// ------------------------------------------------------
CEFFVDDRATIO,
CEFFVDNRATIO,
VRATIO,

// ------------------------------------------------------
// END of Sensor List (this must be last entry)
Expand Down
16 changes: 5 additions & 11 deletions src/occ_405/sensor/sensor_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,11 @@ const sensor_info_t G_sensor_info[] =

/* ==PartSummarySensors== NameString Units Type Location Number Freq ScaleFactor */
SENSOR_INFO_T_ENTRY( UTILSLCG000, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG001, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG002, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG003, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG004, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG005, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG006, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG007, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG008, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG009, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG010, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),
SENSOR_INFO_T_ENTRY( UTILSLCG011, "%\0", AMEC_SENSOR_TYPE_UTIL, AMEC_SENSOR_LOC_LPAR, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP_SCALE_0_16384),

/* ==WOF Sensors== NameString Units Type Location Number Freq ScaleFactor */
SENSOR_INFO_T_ENTRY( CEFFVDDRATIO, "%\0", AMEC_SENSOR_TYPE_WOF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP( 1,-2) ),
SENSOR_INFO_T_ENTRY( CEFFVDNRATIO, "%\0", AMEC_SENSOR_TYPE_WOF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP( 1,-2) ),
SENSOR_INFO_T_ENTRY( VRATIO, " \0", AMEC_SENSOR_TYPE_WOF, AMEC_SENSOR_LOC_PROC, AMEC_SENSOR_NONUM, AMEEFP_EVERY_8TH_TICK_HZ, AMEFP( 1, 0) ),
};

// Cause a compile error if we don't have all the sensors in the enum in the initialization list.
Expand Down
39 changes: 16 additions & 23 deletions src/occ_405/sensor/sensor_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,20 +434,17 @@ const sensor_ptr_t G_amec_sensor_list[] =
SENSOR_PTR(TEMPGPU2MEM, &g_amec_sys.gpu[2].tempgpumem),

// ------------------------------------------------------
// Partition Sensors
// Partition Sensors -- no PLPM support only 1 core group sensor
// additional sensors must be added if AMEC_PART_MAX_PART is ever changed to be more than 1
// ------------------------------------------------------
SENSOR_PTR( UTILSLCG000, &g_amec_sys.part_config.part_list[0].util2msslack),
SENSOR_PTR( UTILSLCG001, &g_amec_sys.part_config.part_list[1].util2msslack),
SENSOR_PTR( UTILSLCG002, &g_amec_sys.part_config.part_list[2].util2msslack),
SENSOR_PTR( UTILSLCG003, &g_amec_sys.part_config.part_list[3].util2msslack),
SENSOR_PTR( UTILSLCG004, &g_amec_sys.part_config.part_list[4].util2msslack),
SENSOR_PTR( UTILSLCG005, &g_amec_sys.part_config.part_list[5].util2msslack),
SENSOR_PTR( UTILSLCG006, &g_amec_sys.part_config.part_list[6].util2msslack),
SENSOR_PTR( UTILSLCG007, &g_amec_sys.part_config.part_list[7].util2msslack),
SENSOR_PTR( UTILSLCG008, &g_amec_sys.part_config.part_list[8].util2msslack),
SENSOR_PTR( UTILSLCG009, &g_amec_sys.part_config.part_list[9].util2msslack),
SENSOR_PTR( UTILSLCG010, &g_amec_sys.part_config.part_list[10].util2msslack),
SENSOR_PTR( UTILSLCG011, &g_amec_sys.part_config.part_list[11].util2msslack),

// ------------------------------------------------------
// WOF Sensors
// ------------------------------------------------------
SENSOR_PTR( CEFFVDDRATIO, &g_amec_sys.wof_sensors.ceff_ratio_vdd_sensor),
SENSOR_PTR( CEFFVDNRATIO, &g_amec_sys.wof_sensors.ceff_ratio_vdn_sensor),
SENSOR_PTR( VRATIO, &g_amec_sys.wof_sensors.v_ratio_sensor),

};
STATIC_ASSERT( (NUMBER_OF_SENSORS_IN_LIST != (sizeof(G_amec_sensor_list)/sizeof(sensor_ptr_t))) );
Expand Down Expand Up @@ -636,17 +633,13 @@ const minisensor_ptr_t G_amec_mini_sensor_list[] INIT_SECTION =
// Partition Sensors
// ------------------------------------------------------
MINI_SENSOR_PTR( UTILSLCG000, NULL),
MINI_SENSOR_PTR( UTILSLCG001, NULL),
MINI_SENSOR_PTR( UTILSLCG002, NULL),
MINI_SENSOR_PTR( UTILSLCG003, NULL),
MINI_SENSOR_PTR( UTILSLCG004, NULL),
MINI_SENSOR_PTR( UTILSLCG005, NULL),
MINI_SENSOR_PTR( UTILSLCG006, NULL),
MINI_SENSOR_PTR( UTILSLCG007, NULL),
MINI_SENSOR_PTR( UTILSLCG008, NULL),
MINI_SENSOR_PTR( UTILSLCG009, NULL),
MINI_SENSOR_PTR( UTILSLCG010, NULL),
MINI_SENSOR_PTR( UTILSLCG011, NULL),

// ------------------------------------------------------
// WOF Sensors
// ------------------------------------------------------
SENSOR_PTR( CEFFVDDRATIO, NULL),
SENSOR_PTR( CEFFVDNRATIO, NULL),
SENSOR_PTR( VRATIO, NULL),
};
STATIC_ASSERT( (NUMBER_OF_SENSORS_IN_LIST != (sizeof(G_amec_mini_sensor_list)/sizeof(uint16_t *))) );
STATIC_ASSERT( (MAX_AMEC_SENSORS < (sizeof(G_amec_mini_sensor_list)/sizeof(uint16_t *))) );
8 changes: 8 additions & 0 deletions src/occ_405/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
// Maximum time to wait for a PGPE task before timeout
#define WAIT_PGPE_TASK_TIMEOUT (MICS_PER_TICK * 4)

extern bool G_allowPstates;
extern bool G_mem_monitoring_allowed;
extern task_t G_task_table[TASK_END]; // Global task table
extern bool G_simics_environment;
Expand Down Expand Up @@ -764,6 +765,13 @@ errlHndl_t SMGR_observation_to_active()
// characterization state where user was manually writing Pstates
G_set_pStates = TRUE;

// for powerVM the clip is set to UT, need to make sure we determine new freq before
// 1st write to PMCR to prevent writing the clip to the PMCR and going to UT
if(!G_sysConfigData.system_type.kvm)
{
G_allowPstates = FALSE;
}

// Set the RTL Flags to indicate which tasks can run
// - Clear OBSERVATION b/c not in OBSERVATION State
// - Set ACTIVE b/c we're in ACTIVE State
Expand Down
17 changes: 13 additions & 4 deletions src/occ_405/wof/wof.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ void read_shared_sram( void )
g_wof->v_clip = l_wofstate.fields.vclip_mv;

g_wof->v_ratio = l_wofstate.fields.vratio;
sensor_update(AMECSENSOR_PTR(VRATIO), (uint16_t)l_wofstate.fields.vratio);

g_wof->f_ratio = 1;
// Get the requested active quad update
read_req_active_quads();
Expand Down Expand Up @@ -1140,6 +1142,7 @@ void calculate_ceff_ratio_vdn( void )
else
{
g_wof->ceff_ratio_vdn = g_wof->ceff_vdn / g_wof->ceff_tdp_vdn;
sensor_update(AMECSENSOR_PTR(CEFFVDNRATIO), (uint16_t)g_wof->ceff_ratio_vdn);
}
}

Expand All @@ -1151,6 +1154,8 @@ void calculate_ceff_ratio_vdn( void )
*/
void calculate_ceff_ratio_vdd( void )
{
uint32_t l_raw_ceff_ratio = 0;

// If we get v_ratio of 0 from pgpe, force ceff_ratio_vdd to 0;
if( g_wof->v_ratio == 0 )
{
Expand Down Expand Up @@ -1215,10 +1220,14 @@ void calculate_ceff_ratio_vdd( void )
}
else
{
// Save ceff_ratio_vdd. Multiply by 10000 to convert to correct granularity.
// Prevent Over current by clipping to max of 100%
g_wof->ceff_ratio_vdd =
prevent_over_current((g_wof->ceff_vdd*10000) / g_wof->ceff_tdp_vdd);
// Save raw ceff ratio vdd to a sensor, this sensor is NOT to be used by the WOF alg
// Multiply by 10000 to convert to correct granularity.
l_raw_ceff_ratio = (g_wof->ceff_vdd*10000) / g_wof->ceff_tdp_vdd;
sensor_update(AMECSENSOR_PTR(CEFFVDDRATIO), (uint16_t)l_raw_ceff_ratio);

// Now check the raw ceff ratio to prevent Over current by clipping to max of 100%
// this is saved to the parameter used by the rest of the wof alg
g_wof->ceff_ratio_vdd = prevent_over_current(l_raw_ceff_ratio);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/occ_405/wof/wof.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,16 @@ typedef struct __attribute__ ((packed))
uint8_t avgtemp_vdn[CORE_IDDQ_MEASUREMENTS];
} amec_wof_t;

// Structure for sensors used in g_amec for AMESTER
// these will contain raw values any clipping for WOF alg will be represented
// in the parameter above in amec_wof_t
typedef struct __attribute__ ((packed))
{
sensor_t ceff_ratio_vdd_sensor;
sensor_t ceff_ratio_vdn_sensor;
sensor_t v_ratio_sensor;
} amec_wof_sensors_t;

typedef struct __attribute__ ((packed))
{
uint8_t data[MIN_BCE_REQ_SIZE];
Expand Down

0 comments on commit 0f604d6

Please sign in to comment.