diff options
author | Jacob Harvey <jlharvey@us.ibm.com> | 2017-04-12 18:05:15 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-04-27 09:16:34 -0400 |
commit | 6f8455bced213e8612cc89d7403726beda2d8d05 (patch) | |
tree | e8aacbd38fdaac0b140b844da0403497abf3e15e | |
parent | d9fa670675bf2870ff8a37f865e50e98a5ede39c (diff) | |
download | talos-hostboot-6f8455bced213e8612cc89d7403726beda2d8d05.tar.gz talos-hostboot-6f8455bced213e8612cc89d7403726beda2d8d05.zip |
Fix eff_config_thermal's powerlimit check SW386095
Change-Id: I2817e43ee8e7780832141b72f4457e2b26033c5f
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39187
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: Michael D. Pardeik <pardeik@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39188
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
7 files changed, 72 insertions, 50 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.C b/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.C index a5b54489f..28d156a84 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.C @@ -320,7 +320,7 @@ fapi_try_exit: fapi2::ReturnCode throttle::calc_port_power(const double i_idle_util [MAX_DIMM_PER_PORT], const double i_max_util [MAX_DIMM_PER_PORT], double& o_port_power_idle, - double& o_port_power_max) + double& o_port_power_max) const { //Playing it safe o_port_power_idle = 0; @@ -375,7 +375,7 @@ fapi_try_exit: void throttle::calc_dimm_power(const double i_databus_idle, const double i_databus_max, double o_dimm_power_idle [MAX_DIMM_PER_PORT], - double o_dimm_power_max [MAX_DIMM_PER_PORT]) + double o_dimm_power_max [MAX_DIMM_PER_PORT]) const { for ( const auto& l_dimm : mss::find_targets<TARGET_TYPE_DIMM>(iv_target) ) { @@ -409,7 +409,7 @@ void throttle::calc_dimm_power(const double i_databus_idle, fapi2::ReturnCode throttle::calc_power_curve(const double i_power_idle, const double i_power_max, uint32_t& o_slope, - uint32_t& o_int) + uint32_t& o_int) const { const double l_divisor = ((static_cast<double>(iv_databus_port_max) / UTIL_CONVERSION) - IDLE_UTIL); FAPI_ASSERT ((l_divisor > 0), @@ -452,7 +452,7 @@ fapi_try_exit: void throttle::calc_util_usage(const uint32_t i_slope, const uint32_t i_int, const uint32_t i_power_limit, - double& o_util) + double& o_util) const { o_util = ((static_cast<double>(i_power_limit) - i_int) / i_slope ) * UTIL_CONVERSION; @@ -470,7 +470,9 @@ void throttle::calc_util_usage(const uint32_t i_slope, /// @param[out] o_power the calculated power /// @return fapi2::ReturnCode iff it was a success /// -fapi2::ReturnCode throttle::calc_power_from_n (const uint16_t i_n_slot, const uint16_t i_n_port, uint32_t& o_power) +fapi2::ReturnCode throttle::calc_power_from_n (const uint16_t i_n_slot, + const uint16_t i_n_port, + uint32_t& o_power) const { double l_calc_util_port = 0; double l_calc_util_slot = 0; @@ -570,7 +572,7 @@ fapi_try_exit: fapi2::ReturnCode throttle::calc_split_util( const double i_util_slot, const double i_util_port, - double o_util_dimm_max [MAX_DIMM_PER_PORT]) + double o_util_dimm_max [MAX_DIMM_PER_PORT]) const { uint8_t l_count_dimms = count_dimm (iv_target); //The total utilization to be used is limited by either what the port can allow or what the dimms can use @@ -776,11 +778,13 @@ fapi_try_exit: /// /// @brief Equalize the throttles and estimated power at those throttle levels /// @param[in] i_targets vector of MCS targets all on the same VDDR domain +/// @param[in] i_throttle_type denotes if this was done for POWER (VMEM) or THERMAL (VMEM+VPP) throttles /// @return FAPI2_RC_SUCCESS iff ok /// @note sets the throttles and power to the worst case /// Called by p9_mss_bulk_pwr_throttles and by p9_mss_utils_to_throttle (so by IPL or by OCC) /// -fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCS> >& i_targets) +fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCS> >& i_targets, + const throttle_type i_throttle_type) { //Set to max values so every compare will change to min value uint16_t l_min_slot = ~(0); @@ -821,9 +825,9 @@ fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TA { for (const auto& l_mcs : i_targets) { - uint16_t l_fin_slot [mss::PORTS_PER_MCS]; - uint16_t l_fin_port [mss::PORTS_PER_MCS]; - uint32_t l_fin_power [mss::PORTS_PER_MCS]; + uint16_t l_fin_slot [mss::PORTS_PER_MCS] = {}; + uint16_t l_fin_port [mss::PORTS_PER_MCS] = {}; + uint32_t l_fin_power [mss::PORTS_PER_MCS] = {}; for (const auto& l_mca : mss::find_targets<TARGET_TYPE_MCA>(l_mcs)) { @@ -833,6 +837,8 @@ fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TA } const auto l_pos = mss::index(l_mca); + // Declaring above to avoid fapi2 jump + uint64_t l_power_limit = 0; l_fin_slot[l_pos] = (mss::count_dimm(l_mca)) ? l_min_slot : 0; l_fin_port[l_pos] = (mss::count_dimm(l_mca)) ? l_min_port : 0; @@ -840,7 +846,8 @@ fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TA //Need to create throttle object for each mca in order to get dimm configuration and power curves //To calculate the slot/port utilization and total port power consumption fapi2::ReturnCode l_rc; - auto l_dummy = mss::power_thermal::throttle(l_mca, l_rc); + + const auto l_dummy = mss::power_thermal::throttle(l_mca, l_rc); FAPI_TRY(l_rc, "Failed creating a throttle object in equalize_throttles"); FAPI_TRY( l_dummy.calc_power_from_n(l_fin_slot[l_pos], l_fin_port[l_pos], l_fin_power[l_pos]), @@ -852,14 +859,20 @@ fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TA //Only calculate the power for ports that have dimms l_fin_power[l_pos] = (mss::count_dimm(l_mca) != 0 ) ? l_fin_power[l_pos] : 0; - FAPI_INF("Calculated power is %d, limit is %d", l_fin_power[l_pos], l_dummy.iv_port_power_limit); + // You may ask why this is not a variable within the throttle struct + // It's because POWER throttling is on a per port basis while the THERMAL throttle is per dimm + // Didn't feel like adding a variable just for this check + l_power_limit = (i_throttle_type == throttle_type::POWER) ? + l_dummy.iv_port_power_limit : (l_dummy.iv_dimm_thermal_limit[0] + l_dummy.iv_dimm_thermal_limit[1]); + + FAPI_INF("Calculated power is %d, limit is %d", l_fin_power[l_pos], l_power_limit); //If there's an error with calculating port power, the wrong watt target was passed in //Returns an error but doesn't deconfigure anything. Calling function can log if it wants to //Called by OCC and by p9_mss_eff_config_thermal, thus different ways for error handling //Continue setting throttles to prevent a possible throttle == 0 //The error will be the last bad port found - if (l_fin_power[l_pos] > l_dummy.iv_port_power_limit) + if (l_fin_power[l_pos] > l_power_limit) { //Need this because of pos traits and templating stuff uint64_t l_fail = mss::fapi_pos(l_mca); @@ -871,16 +884,21 @@ fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TA FAPI_ASSERT_NOEXIT( false, fapi2::MSS_CALC_PORT_POWER_EXCEEDS_MAX() .set_CALCULATED_PORT_POWER(l_fin_power[l_pos]) - .set_MAX_POWER_ALLOWED(l_dummy.iv_port_power_limit) + .set_MAX_POWER_ALLOWED(l_power_limit) .set_PORT_POS(mss::pos(l_mca)) .set_MCA_TARGET(l_mca), "Error calculating the final port power value for target %s, calculated power is %d, max value can be %d", mss::c_str(l_mca), l_fin_power[l_pos], - l_dummy.iv_port_power_limit); + l_power_limit); } } + FAPI_INF("%s Final throttles values for slot %d, for port %d, power value %d", + mss::c_str(l_mcs), + l_fin_port, + l_fin_slot, + l_fin_port); //Even if there's an error, still calculate and set the throttles. //OCC will set to safemode if there's an error //Better to set the throttles than leave them 0, and potentially brick the memory diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H b/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H index 7bfad2f03..05c1ce166 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H @@ -70,7 +70,7 @@ class throttle /// @return Integral type T /// template<typename T> - inline T calc_power (const T i_util, const size_t i_pos) + inline T calc_power (const T i_util, const size_t i_pos) const { return ((i_util / UTIL_CONVERSION) * iv_pwr_slope[i_pos]) + iv_pwr_int[i_pos]; } @@ -80,16 +80,15 @@ class throttle /// @param[in] i_uplift the percent the o_Value should be raised by /// @param[out] o_value the value that will be modified /// - inline void calc_power_uplift (const uint8_t i_uplift, double& o_value) + inline void calc_power_uplift (const uint8_t i_uplift, double& o_value) const { o_value *= (1 + (static_cast<double>(i_uplift) / PERCENT_CONVERSION)); } public: const fapi2::Target<fapi2::TARGET_TYPE_MCA>& iv_target; - //dimm level + uint32_t iv_databus_port_max; - //TK change thermal limit as well as power curves uint8_t iv_power_uplift_idle; uint8_t iv_power_uplift; @@ -132,7 +131,7 @@ class throttle fapi2::ReturnCode calc_port_power( const double i_idle_util [MAX_DIMM_PER_PORT], const double i_max_util [MAX_DIMM_PER_PORT], double& o_port_power_idle, - double& o_port_power_max); + double& o_port_power_max) const; /// /// @brief Calculates max and min power usages based off of DIMM power curves /// @param[in] i_databus_port_max max databus utilization for the port (either calculated or mrw) @@ -145,7 +144,7 @@ class throttle void calc_dimm_power(const double i_databus_idle, const double i_databus_max, double o_dimm_power_idle [MAX_DIMM_PER_PORT], - double o_dimm_power_max [MAX_DIMM_PER_PORT]); + double o_dimm_power_max [MAX_DIMM_PER_PORT]) const; /// /// @brief Calculate the power curve in order to calculate databus utilization @@ -160,7 +159,7 @@ class throttle fapi2::ReturnCode calc_power_curve(const double i_power_idle, const double i_power_max, uint32_t& o_power_slope, - uint32_t& o_power_int); + uint32_t& o_power_int) const; /// /// @brief Calculate the databus utilization given the power curve /// @param[in] i_slope @@ -173,7 +172,7 @@ class throttle void calc_util_usage(const uint32_t i_slope, const uint32_t i_int, const uint32_t i_power_limit, - double& o_util); + double& o_util) const; /// /// @brief set iv_n_port, iv_n_slot, iv_calc_port_maxpower /// @param[in] i_util_port pass in the calculated port databus utilization @@ -188,7 +187,7 @@ class throttle /// @param[out] o_power the calculated power /// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff the split is OK /// - fapi2::ReturnCode calc_power_from_n (const uint16_t i_n_slot, const uint16_t i_n_port, uint32_t& o_power); + fapi2::ReturnCode calc_power_from_n (const uint16_t i_n_slot, const uint16_t i_n_port, uint32_t& o_power) const; /// /// @brief Converts the port maximum databus util to a dimm level based on powerslopes and dimms installed @@ -211,7 +210,7 @@ class throttle fapi2::ReturnCode calc_split_util( const double i_util_slot, const double i_util_port, - double o_util_dimm_max [MAX_DIMM_PER_PORT]); + double o_util_dimm_max [MAX_DIMM_PER_PORT]) const; /// @@ -336,10 +335,12 @@ fapi2::ReturnCode set_runtime_m_and_watt_limit( const std::vector< fapi2::Target /// /// @brief Equalize the throttles and estimated power at those throttle levels /// @param[in] i_targets vector of MCS targets all on the same VDDR domain +/// @param[in] i_throttle_type denotes if this was done for POWER (VMEM) or THERMAL (VMEM+VPP) throttles /// @return FAPI2_RC_SUCCESS iff ok /// @note sets the throttles and power to the worst case /// -fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCS> >& i_targets); +fapi2::ReturnCode equalize_throttles (const std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCS> >& i_targets, + const throttle_type i_throttle_type); }//power_thermal }// mss diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H b/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H index 0c9d0194b..ec682b8f4 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/shared/mss_const.H @@ -371,6 +371,16 @@ enum test_type } // namespace mcbist +/// +/// @brief throttle_type used to set bulk_pwr_throttls to run POWER or THERMAL throttling +/// @note OCC will be using the POWER option +/// +enum class throttle_type +{ + POWER = 0, + THERMAL = 1, +}; + enum class shmoo_edge : std::size_t { LEFT, diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.C index 47173cdb0..0357a92ed 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.C @@ -58,10 +58,10 @@ extern "C" /// @note equalizes the throttles to the lowest of runtime and the lowest slot-throttle value /// fapi2::ReturnCode p9_mss_bulk_pwr_throttles( const std::vector< fapi2::Target<TARGET_TYPE_MCS> >& i_targets, - const throttle_type i_throttle_type) + const mss::throttle_type i_throttle_type) { FAPI_INF("Start p9_mss_bulk_pwr_throttles for %s type throttling", - (( i_throttle_type == THERMAL) ? "THERMAL" : "POWER")); + (( i_throttle_type == mss::throttle_type::THERMAL) ? "THERMAL" : "POWER")); for ( const auto& l_mcs : i_targets) @@ -87,7 +87,7 @@ extern "C" mss::c_str(l_mca)); //Let's do the actual work now - if ( i_throttle_type == THERMAL) + if ( i_throttle_type == mss::throttle_type::THERMAL) { FAPI_TRY (l_pwr_struct.thermal_throttles()); } @@ -110,13 +110,13 @@ extern "C" } //Set all of the throttles to the lowest value per port for performance reasons - FAPI_TRY(mss::power_thermal::equalize_throttles(i_targets)); + FAPI_TRY(mss::power_thermal::equalize_throttles(i_targets, i_throttle_type)); FAPI_INF("End bulk_pwr_throttles"); return fapi2::current_err; fapi_try_exit: FAPI_ERR("Error calculating bulk_pwr_throttles using %s throttling", - ((i_throttle_type == POWER) ? "power" : "thermal")); + ((i_throttle_type == mss::throttle_type::POWER) ? "power" : "thermal")); return fapi2::current_err; } } //extern C diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.H b/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.H index 2b148fd98..cea2edc43 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.H +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_bulk_pwr_throttles.H @@ -38,19 +38,9 @@ #include <fapi2.H> #include <vector> - -/// -/// @brief throttle_type used toset bulk_pwr_throttls to run POWER or THERMAL throttling -/// @note OCC will be using the POWER option -/// -enum throttle_type : uint8_t -{ - POWER = 0, - THERMAL = 1, -}; - +#include <lib/shared/mss_const.H> typedef fapi2::ReturnCode (*p9_mss_bulk_pwr_throttles_FP_t) (const - std::vector< fapi2::Target< fapi2::TARGET_TYPE_MCS>>&, const throttle_type i_throttle_type); + std::vector< fapi2::Target< fapi2::TARGET_TYPE_MCS>>&, const mss::throttle_type i_throttle_type); extern "C" { @@ -67,7 +57,7 @@ extern "C" /// @note equalizes the throttles to the lowest of runtime and the lowest slot-throttle value /// fapi2::ReturnCode p9_mss_bulk_pwr_throttles (const std::vector < fapi2::Target< fapi2::TARGET_TYPE_MCS>>& i_targets, - const throttle_type i_throttle_type ); + const mss::throttle_type i_throttle_type ); } #endif diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C index 766e60375..4c1ca1cff 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C @@ -41,6 +41,7 @@ #include <lib/power_thermal/decoder.H> #include <lib/dimm/kind.H> #include <lib/utils/count_dimm.H> +#include <lib/shared/mss_const.H> #include <mss.H> extern "C" { @@ -156,13 +157,13 @@ extern "C" FAPI_INF("Starting bulk_pwr"); //get the thermal limits, done per dimm and set to worst case for the slot and port throttles //Bulk_pwr sets the general, all purpose ATTR_MSS_MEM_THROTTLED_N_COMMANDS_PER_SLOT, _PER_PORT, and MAXPOWER ATTRs - FAPI_EXEC_HWP(l_rc, p9_mss_bulk_pwr_throttles, i_targets, POWER); + FAPI_EXEC_HWP(l_rc, p9_mss_bulk_pwr_throttles, i_targets, mss::throttle_type::POWER); FAPI_TRY(l_rc, "Failed running p9_mss_bulk_pwr_throttles"); //Set runtime throttles to worst case between ATTR_MSS_MEM_THROTTLED_N_COMMANDS_PER_SLOT //and ATTR_MSS_MEM_RUNTIME_THROTTLED_N_COMMANDS_PER_SLOT and the _PORT equivalents also FAPI_INF("Starting update"); - FAPI_TRY( mss::power_thermal::update_runtime_throttles (i_targets)); + FAPI_TRY( mss::power_thermal::update_runtime_throttles (i_targets) ); FAPI_INF("finished update"); //Set VDDR+VPP power curve values @@ -192,10 +193,10 @@ extern "C" } //Run thermal throttles with the VDDR+VPP power curves - FAPI_EXEC_HWP(l_rc, p9_mss_bulk_pwr_throttles, i_targets, THERMAL); + FAPI_EXEC_HWP(l_rc, p9_mss_bulk_pwr_throttles, i_targets, mss::throttle_type::THERMAL); FAPI_TRY(l_rc, "Failed running p9_mss_bulk_pwr_throttles with THERMAL throttling in p9_mss_eff_config_thermal"); //Update everything to worst case - FAPI_TRY( mss::power_thermal::update_runtime_throttles (i_targets)); + FAPI_TRY( mss::power_thermal::update_runtime_throttles (i_targets) ); //Done FAPI_INF( "End effective config thermal"); diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C index 59bb2fc93..a62314a65 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C @@ -49,6 +49,7 @@ #include <lib/power_thermal/throttle.H> #include <lib/mss_attribute_accessors.H> #include <lib/utils/count_dimm.H> +#include <lib/shared/mss_const.H> using fapi2::TARGET_TYPE_MCS; using fapi2::TARGET_TYPE_MCA; @@ -118,9 +119,10 @@ extern "C" FAPI_TRY( l_throttle.calc_slots_and_power(l_databus_util)); - FAPI_INF( "Calculated N commands per port %s = %d commands per %d dram clock window, maxpower is %d", + FAPI_INF( "%s Calculated N commands per port %d, per slot %d, commands per dram clock window %d, maxpower is %d", mss::c_str(l_mca), l_throttle.iv_n_port, + l_throttle.iv_n_slot, l_dram_clocks, l_throttle.iv_calc_port_maxpower); @@ -141,7 +143,7 @@ extern "C" } //equalize throttles to prevent variable performance - FAPI_TRY( mss::power_thermal::equalize_throttles (i_targets)); + FAPI_TRY( mss::power_thermal::equalize_throttles (i_targets, mss::throttle_type::POWER)); fapi_try_exit: return fapi2::current_err; |