From 1de1be8ec36b461f04bbe417023dbff3de5071f4 Mon Sep 17 00:00:00 2001 From: William Bryan Date: Fri, 14 Sep 2018 12:35:51 -0500 Subject: Memory bandwidth sensor fixes CQ:SW445286 Change-Id: Iaf86444442a391e218256a22883d6b248c410e9a Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66149 Reviewed-by: Martha Broyles Reviewed-by: Christopher J. Cain Tested-by: William A. Bryan Reviewed-by: William A. Bryan --- src/occ_405/amec/amec_amester.c | 28 +++- src/occ_405/amec/amec_sensors_centaur.c | 227 ++++++++++++++++++++++---------- src/occ_405/amec/amec_sensors_centaur.h | 3 +- src/occ_405/incl/common_types.h | 2 +- src/occ_405/sensor/sensor_main_memory.c | 11 +- src/occ_405/timer/timer.c | 19 ++- 6 files changed, 205 insertions(+), 85 deletions(-) diff --git a/src/occ_405/amec/amec_amester.c b/src/occ_405/amec/amec_amester.c index 2bee6a6..55a9cca 100755 --- a/src/occ_405/amec/amec_amester.c +++ b/src/occ_405/amec/amec_amester.c @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -276,7 +276,18 @@ static uint8_t amester_get_sensor_info( uint8_t* o_resp, uint16_t* io_resp_lengt break; } - *((uint32_t *)o_resp) = l_sensorInfo.sensor.scalefactor; + if( (MEM_TYPE_NIMBUS == G_sysConfigData.mem_type) && + ( ((i_sensor >= MRDM0) && + (i_sensor <= MRDM7)) || + ((i_sensor >= MWRM0) && + (i_sensor <= MWRM7)) ) ) + { + *((uint32_t *)o_resp) = AMEFP(64, -5); + } + else + { + *((uint32_t *)o_resp) = l_sensorInfo.sensor.scalefactor; + } *io_resp_length = l_length; break; } @@ -308,7 +319,18 @@ static uint8_t amester_get_sensor_info( uint8_t* o_resp, uint16_t* io_resp_lengt *((uint32_t *)dest) = l_sensorInfo.sensor.freq; dest+= 4; - *((uint32_t *)dest) = l_sensorInfo.sensor.scalefactor; + if( (MEM_TYPE_NIMBUS == G_sysConfigData.mem_type) && + ( ((i_sensor >= MRDM0) && + (i_sensor <= MRDM7)) || + ((i_sensor >= MWRM0) && + (i_sensor <= MWRM7)) ) ) + { + *((uint32_t *)dest) = AMEFP(64, -5); + } + else + { + *((uint32_t *)dest) = l_sensorInfo.sensor.scalefactor; + } dest+= 4; *io_resp_length = (uint8_t) ((uint32_t)dest - (uint32_t)o_resp); diff --git a/src/occ_405/amec/amec_sensors_centaur.c b/src/occ_405/amec/amec_sensors_centaur.c index f763a67..72e22cf 100644 --- a/src/occ_405/amec/amec_sensors_centaur.c +++ b/src/occ_405/amec/amec_sensors_centaur.c @@ -434,6 +434,32 @@ void amec_update_centaur_temp_sensors(void) AMEC_DBG("HotDimm=%d\n",l_hot); } +// Function Specification +// +// Name: amec_diff_adjust_for_overflow +// +// Description: Calculates the diff between 32-bit accumulator values +// while accounting for overflow. +// +// End Function Specification +uint32_t amec_diff_adjust_for_overflow(uint32_t i_new_value, uint32_t i_old_value) +{ + uint32_t l_result = 0; + uint64_t l_overflow = 0; + + if(i_new_value < i_old_value) + { + l_overflow = 0xFFFFFFFF + i_new_value; + l_overflow = l_overflow - i_old_value; + l_result = l_overflow; + } + else + { + l_result = i_new_value - i_old_value; + } + + return l_result; +} // Function Specification // @@ -445,25 +471,29 @@ void amec_update_centaur_temp_sensors(void) // Thread: RealTime Loop // // End Function Specification - void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, uint8_t i_centaur) { /*------------------------------------------------------------------------*/ /* Local Variables */ /*------------------------------------------------------------------------*/ - UINT32 tempu = 0; - UINT32 templ = 0; - UINT32 temp32new = 0; - UINT32 temp32 = 0; - UINT16 tempreg = 0; - UINT16 tempreg2 = 0; - uint8_t i_mc_id = 0; + UINT32 tempu = 0; + UINT32 templ = 0; + UINT32 temp32new = 0; + UINT32 temp32 = 0; + UINT16 tempreg = 0; + UINT16 tempreg2 = 0; + uint8_t i_mc_id = 0; + + static uint32_t L_num_ticks[MAX_NUM_CENTAURS] = {0}; + + #define NUM_TICKS_TO_DELAY_SENSOR_UPDATE 10 + #define AMECSENSOR_PORTPAIR_PTR(sensor_base,idx,idx2) \ (&(g_amec->proc[0].memctl[idx].centaur.portpair[idx2].sensor_base)) /*------------------------------------------------------------------------*/ - /* Code */ + /*Code */ /*------------------------------------------------------------------------*/ CentaurMemData * l_sensor_cache = i_sensor_cache; @@ -482,14 +512,14 @@ void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, } // --------------------------------------------------------------------------- - // Interim Calculation: MWRMx (0.01 Mrps) Memory write requests per sec + // Interim Calculation: MWRMx (0.01 Mrps) Memory write requests per sec // --------------------------------------------------------------------------- // Extract write bandwidth temp32new = (templ); - - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.wr_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.wr_cnt_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.wr_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.wr_cnt_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); @@ -497,14 +527,14 @@ void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.memwrite2ms = tempreg; // ------------------------------------------------------------------------- - // Interim Calculation: MRDMx (0.01 Mrps) Memory read requests per sec + // Interim Calculation: MRDMx (0.01 Mrps) Memory read requests per sec // ------------------------------------------------------------------------- // Extract read bandwidth temp32new = (tempu); - - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.rd_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.rd_cnt_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.rd_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.rd_cnt_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); @@ -524,46 +554,57 @@ void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, } // ---------------------------------------------------------------- - // Sensor: MPUMx (0.01 Mrps) Memory power-up requests per sec + // Sensor: MPUMx (0.01 Mrps) Memory power-up requests per sec // ---------------------------------------------------------------- // Extract power up count temp32new = (templ); // left shift into top 20 bits of 32 bits // For DD1.0, we only have 1 channel field that we use; DD2.0 we need to add another channel - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.pwrup_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.pwrup_cnt_accum = temp32new; // Save latest accumulator away for next time - tempreg=(UINT16)(temp32>>12); // Select upper 20 bits + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.pwrup_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.pwrup_cnt_accum = temp32new; // Save latest accumulator away for next time + tempreg=(UINT16)(temp32>>12); // Select upper 20 bits g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.pwrup_cnt=(UINT16)tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mpu2ms,i_centaur,i_mc_id), tempreg); - + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mpu2ms,i_centaur,i_mc_id), tempreg); + } // ------------------------------------------------------------------- - // Sensor: MACMx (0.01 Mrps) Memory activation requests per sec + // Sensor: MACMx (0.01 Mrps) Memory activation requests per sec // ------------------------------------------------------------------- // Extract activation count temp32 = templ; temp32 += tempu; - temp32new = (temp32); // left shift into top 20 bits of 32 bits + temp32new = (temp32); // left shift into top 20 bits of 32 bits // For DD1.0, we only have 1 channel field that we use; DD2.0 we need to add another channel - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.act_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.act_cnt_accum = temp32new; // Save latest accumulator away for next time - tempreg=(UINT16)(temp32>>12); // Select lower 16 of 20 bits + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.act_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.act_cnt_accum = temp32new; // Save latest accumulator away for next time + tempreg=(UINT16)(temp32>>12); // Select lower 16 of 20 bits g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.act_cnt=(UINT16)tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mac2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mac2ms,i_centaur,i_mc_id), tempreg); + } // -------------------------------------------------------------------------- - // Sensor: MTS (count) Last received Timestamp (frame count) from Centaur + // Sensor: MTS (count) Last received Timestamp (frame count) from Centaur // -------------------------------------------------------------------------- // Extract framecount (clock is 266.6666666MHz * 0.032 / 4096)=2083. temp32new = l_sensor_cache->scache.frame_count; // For DD1.0, we only have 1 channel field that we use; DD2.0 we need to add another channel - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.fr2_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.fr2_cnt_accum = temp32new; // Save latest accumulator away for next time - tempreg=(UINT16)(temp32>>12); // Select upper 20 bits + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.fr2_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.fr2_cnt_accum = temp32new; // Save latest accumulator away for next time + tempreg=(UINT16)(temp32>>12); // Select upper 20 bits g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.fr2_cnt=(UINT16)tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mts2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mts2ms,i_centaur,i_mc_id), tempreg); + } if (i_mc_id == 0) { @@ -576,11 +617,12 @@ void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, templ = l_sensor_cache->scache.mba23_cache_hits_wr; } // ---------------------------------------------------------------------- - // Sensor: M4RD (0.01 Mrps) Memory cached (L4) read requests per sec + // Sensor: M4RD (0.01 Mrps) Memory cached (L4) read requests per sec // ---------------------------------------------------------------------- temp32new = (tempu); // left shift into top 20 bits of 32 bits - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_rd_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_rd_cnt_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_rd_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_rd_cnt_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); @@ -594,14 +636,18 @@ void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, } g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4rd2ms = tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(m4rd2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(m4rd2ms,i_centaur,i_mc_id), tempreg); + } // ----------------------------------------------------------------------- - // Sensor: M4WR (0.01 Mrps) Memory cached (L4) write requests per sec + // Sensor: M4WR (0.01 Mrps) Memory cached (L4) write requests per sec // ----------------------------------------------------------------------- temp32new = (templ); // left shift into top 20 bits of 32 bits - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_wr_cnt_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_wr_cnt_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_wr_cnt_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4_wr_cnt_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); @@ -616,98 +662,135 @@ void amec_perfcount_getmc( CentaurMemData * i_sensor_cache, } g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.l4wr2ms = tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(m4wr2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(m4wr2ms,i_centaur,i_mc_id), tempreg); + } // ------------------------------------------------------------------------------ - // Sensor: MIRB (0.01 Mevents/s) Memory Inter-request arrival idle intervals + // Sensor: MIRB (0.01 Mevents/s) Memory Inter-request arrival idle intervals // ------------------------------------------------------------------------------ temp32new = (i_mc_id == 0) ? l_sensor_cache->scache.mba01_intreq_arr_cnt_base : l_sensor_cache->scache.mba23_intreq_arr_cnt_base; - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_base_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_base_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_base_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_base_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.mirb2ms = tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mirb2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mirb2ms,i_centaur,i_mc_id), tempreg); + } // -------------------------------------------------------------------------------------------------------- - // Sensor: MIRL (0.01 Mevents/s) Memory Inter-request arrival idle intervals longer than low threshold + // Sensor: MIRL (0.01 Mevents/s) Memory Inter-request arrival idle intervals longer than low threshold // -------------------------------------------------------------------------------------------------------- temp32new = (i_mc_id == 0) ? l_sensor_cache->scache.mba01_intreq_arr_cnt_low : l_sensor_cache->scache.mba23_intreq_arr_cnt_low; - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_low_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_low_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_low_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_low_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.mirl2ms = tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mirl2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mirl2ms,i_centaur,i_mc_id), tempreg); + } // ----------------------------------------------------------------------------------------------------------- - // Sensor: MIRM (0.01 Mevents/s) Memory Inter-request arrival idle intervals longer than medium threshold + // Sensor: MIRM (0.01 Mevents/s) Memory Inter-request arrival idle intervals longer than medium threshold // ----------------------------------------------------------------------------------------------------------- temp32new = (i_mc_id == 0) ? l_sensor_cache->scache.mba01_intreq_arr_cnt_med : l_sensor_cache->scache.mba23_intreq_arr_cnt_med; - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_med_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_med_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_med_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_med_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.mirm2ms = tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mirm2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mirm2ms,i_centaur,i_mc_id), tempreg); + } // --------------------------------------------------------------------------------------------------------- - // Sensor: MIRH (0.01 Mevents/s) Memory Inter-request arrival idle intervals longer than high threshold + // Sensor: MIRH (0.01 Mevents/s) Memory Inter-request arrival idle intervals longer than high threshold // --------------------------------------------------------------------------------------------------------- temp32new = (i_mc_id == 0) ? l_sensor_cache->scache.mba01_intreq_arr_cnt_high : l_sensor_cache->scache.mba23_intreq_arr_cnt_high; - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_high_accum; - g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_high_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_high_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.intreq_high_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); g_amec->proc[0].memctl[i_centaur].centaur.portpair[i_mc_id].perf.mirh2ms = tempreg; - sensor_update(AMECSENSOR_PORTPAIR_PTR(mirh2ms,i_centaur,i_mc_id), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update(AMECSENSOR_PORTPAIR_PTR(mirh2ms,i_centaur,i_mc_id), tempreg); + } } // -------------------------------------------------------------------------------------------------------------- - // Sensor: MIRC (0.01 Mevents/s) Memory Inter-request arrival idle interval longer than programmed threshold + // Sensor: MIRC (0.01 Mevents/s) Memory Inter-request arrival idle interval longer than programmed threshold // -------------------------------------------------------------------------------------------------------------- temp32new = l_sensor_cache->scache.intreq_arr_cnt_high_latency; - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.perf.intreq_highlatency_accum; - g_amec->proc[0].memctl[i_centaur].centaur.perf.intreq_highlatency_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.perf.intreq_highlatency_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.perf.intreq_highlatency_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); g_amec->proc[0].memctl[i_centaur].centaur.perf.mirc2ms = tempreg; - sensor_update((&(g_amec->proc[0].memctl[i_centaur].centaur.mirc2ms)), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update((&(g_amec->proc[0].memctl[i_centaur].centaur.mirc2ms)), tempreg); + } // ---------------------------------------------------- - // Sensor: MLP2 (events/s) Number of LP2 exits + // Sensor: MLP2 (events/s) Number of LP2 exits // ---------------------------------------------------- temp32new = l_sensor_cache->scache.lp2_exits; - temp32 = temp32new - g_amec->proc[0].memctl[i_centaur].centaur.perf.lp2exit_accum; - g_amec->proc[0].memctl[i_centaur].centaur.perf.lp2exit_accum = temp32new; // Save latest accumulator away for next time + temp32 = g_amec->proc[0].memctl[i_centaur].centaur.perf.lp2exit_accum; + temp32 = amec_diff_adjust_for_overflow(temp32new, temp32); + g_amec->proc[0].memctl[i_centaur].centaur.perf.lp2exit_accum = temp32new; // Save latest accumulator away for next time // Read every 8 ms....to convert to 0.01 Mrps = ((8ms read * 125)/10000) tempreg = ((temp32*125)/10000); g_amec->proc[0].memctl[i_centaur].centaur.perf.mlp2_2ms = tempreg; - sensor_update((&(g_amec->proc[0].memctl[i_centaur].centaur.mlp2ms)), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update((&(g_amec->proc[0].memctl[i_centaur].centaur.mlp2ms)), tempreg); + } // ------------------------------------------------------------ - // Sensor: MRDMx (0.01 Mrps) Memory read requests per sec + // Sensor: MRDMx (0.01 Mrps) Memory read requests per sec // ------------------------------------------------------------ tempreg = g_amec->proc[0].memctl[i_centaur].centaur.portpair[0].perf.memread2ms; tempreg += g_amec->proc[0].memctl[i_centaur].centaur.portpair[1].perf.memread2ms; - sensor_update( (&(g_amec->proc[0].memctl[i_centaur].mrd)), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update( (&(g_amec->proc[0].memctl[i_centaur].mrd)), tempreg); + } // ------------------------------------------------------------- - // Sensor: MWRMx (0.01 Mrps) Memory write requests per sec + // Sensor: MWRMx (0.01 Mrps) Memory write requests per sec // ------------------------------------------------------------- tempreg = g_amec->proc[0].memctl[i_centaur].centaur.portpair[0].perf.memwrite2ms; tempreg += g_amec->proc[0].memctl[i_centaur].centaur.portpair[1].perf.memwrite2ms; - sensor_update( (&(g_amec->proc[0].memctl[i_centaur].mwr)), tempreg); + if(L_num_ticks[i_centaur] >= NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + sensor_update( (&(g_amec->proc[0].memctl[i_centaur].mwr)), tempreg); + } + + if(L_num_ticks[i_centaur] < NUM_TICKS_TO_DELAY_SENSOR_UPDATE) + { + L_num_ticks[i_centaur]++; + } return; } -/*----------------------------------------------------------------------------*/ -/* End */ +/*----------------------------------------------------------------------------*/ /* End */ /*----------------------------------------------------------------------------*/ diff --git a/src/occ_405/amec/amec_sensors_centaur.h b/src/occ_405/amec/amec_sensors_centaur.h index ddc3132..ffca6b2 100644 --- a/src/occ_405/amec/amec_sensors_centaur.h +++ b/src/occ_405/amec/amec_sensors_centaur.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -31,6 +31,7 @@ //************************************************************************* void amec_update_centaur_sensors(uint8_t i_centaur); void amec_update_centaur_temp_sensors(void); +uint32_t amec_diff_adjust_for_overflow(uint32_t i_new_value, uint32_t i_old_value); #endif diff --git a/src/occ_405/incl/common_types.h b/src/occ_405/incl/common_types.h index a2f2363..beab593 100755 --- a/src/occ_405/incl/common_types.h +++ b/src/occ_405/incl/common_types.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER OnChipController Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ diff --git a/src/occ_405/sensor/sensor_main_memory.c b/src/occ_405/sensor/sensor_main_memory.c index 41b8d6c..458c2dc 100644 --- a/src/occ_405/sensor/sensor_main_memory.c +++ b/src/occ_405/sensor/sensor_main_memory.c @@ -956,9 +956,18 @@ void mm_sensors_init_names_entry(const main_mem_sensor_t * i_mm_sensor, // Set entry struct field values memcpy(o_entry->name, l_sensor_info->name, MAX_SENSOR_NAME_SZ); memcpy(o_entry->units, l_sensor_info->sensor.units, MAX_SENSOR_UNIT_SZ); + if( (MEM_TYPE_NIMBUS == G_sysConfigData.mem_type) && + ( ((l_gsid >= MRDM0) && (l_gsid <= MRDM7)) || + ((l_gsid >= MWRM0) && (l_gsid <= MWRM7)) ) ) + { + o_entry->scale_factor = AMEFP(64, -5); + } + else + { + o_entry->scale_factor = l_sensor_info->sensor.scalefactor; + } o_entry->gsid = l_gsid; o_entry->freq = l_sensor_info->sensor.freq; - o_entry->scale_factor = l_sensor_info->sensor.scalefactor; o_entry->type = l_sensor_info->sensor.type; o_entry->location = l_sensor_info->sensor.location; o_entry->sensor_structure_version = i_mm_sensor->struct_ver; diff --git a/src/occ_405/timer/timer.c b/src/occ_405/timer/timer.c index e562cab..be5abbe 100755 --- a/src/occ_405/timer/timer.c +++ b/src/occ_405/timer/timer.c @@ -37,6 +37,7 @@ #include #include #include +#include //*************************************************************************/ // Externs @@ -301,6 +302,7 @@ void manage_mem_deadman_task(void) // There is no way to synchronously start or stop the counter, so must // take the difference between two readings. static perf_mon_count0_t L_last_reading[NUM_NIMBUS_MCAS] = {{0}}; + static bool L_read_once[NUM_NIMBUS_MCAS] = {0}; uint32_t l_rd_wr_diff = 0; uint32_t gpe_rc = G_gpe_reset_mem_deadman_args.error.rc; // IPC task rc @@ -352,18 +354,21 @@ void manage_mem_deadman_task(void) //Reset the timeout. L_scom_timeout[mca] = 0; - // Update read/write sensors - l_rd_wr_diff = G_gpe_reset_mem_deadman_args.rd_wr_counts.mba_read_cnt - - L_last_reading[mca].mba_read_cnt; + // Update read sensors + l_rd_wr_diff = G_gpe_reset_mem_deadman_args.rd_wr_counts.mba_read_cnt; + l_rd_wr_diff = amec_diff_adjust_for_overflow(l_rd_wr_diff, L_last_reading[mca].mba_read_cnt); l_rd_wr_diff = ((l_rd_wr_diff*25)/1000); - sensor_update(AMECSENSOR_ARRAY_PTR(MRDM0,mca), l_rd_wr_diff); + if(L_read_once[mca]) sensor_update(AMECSENSOR_ARRAY_PTR(MRDM0,mca), l_rd_wr_diff); - l_rd_wr_diff = G_gpe_reset_mem_deadman_args.rd_wr_counts.mba_write_cnt - - L_last_reading[mca].mba_write_cnt; + // Update write sensors + l_rd_wr_diff = G_gpe_reset_mem_deadman_args.rd_wr_counts.mba_write_cnt; + l_rd_wr_diff = amec_diff_adjust_for_overflow(l_rd_wr_diff, L_last_reading[mca].mba_write_cnt); l_rd_wr_diff = ((l_rd_wr_diff*25)/1000); - sensor_update(AMECSENSOR_ARRAY_PTR(MWRM0,mca), l_rd_wr_diff); + if(L_read_once[mca]) sensor_update(AMECSENSOR_ARRAY_PTR(MWRM0,mca), l_rd_wr_diff); + // Update last read/write measurement L_last_reading[mca] = G_gpe_reset_mem_deadman_args.rd_wr_counts; + L_read_once[mca] = TRUE; } } -- cgit v1.2.1