Expose `SetManualPwm` in the thermal collector Google-Bug-Id:555225021,555226212 PiperOrigin-RevId: 974719095 Change-Id: I548a7f1b7895ad6d841902d720e39698034f976f
diff --git a/include/webserver_main_setup.hpp b/include/webserver_main_setup.hpp index 1e2bc32..ade7c4e 100644 --- a/include/webserver_main_setup.hpp +++ b/include/webserver_main_setup.hpp
@@ -22,9 +22,6 @@ #include "bmcweb_config.h" #include "app.hpp" #include "app_singleton.hpp" -#ifdef BMCWEB_ENABLE_EXCEPTION_STACK_TRACER -#include "exception_stack_tracer.hpp" -#endif #include "logging.hpp" #include "cors_preflight.hpp" #include "persistent_data.hpp" @@ -75,7 +72,6 @@ ABSL_DECLARE_FLAG(absl::optional<int>, rde_errors_max); ABSL_DECLARE_FLAG(absl::optional<int>, rde_skips_max); ABSL_DECLARE_FLAG(bool, multi_thread_get); -ABSL_DECLARE_FLAG(bool, exception_stack_tracer); ABSL_DECLARE_FLAG(bool, enable_tlbmc); ABSL_DECLARE_FLAG(bool, enable_tlbmc_trace); ABSL_DECLARE_FLAG(bool, enable_tlbmc_thermal_control); @@ -199,12 +195,6 @@ } inline int run() { - // First so even startup-path exceptions terminate with a throw-site stack. - // Also the explicit reference that pulls the tracer TU (and its __cxa_throw - // interposer) out of the bmcweblib archive despite --gc-sections. -#ifdef BMCWEB_ENABLE_EXCEPTION_STACK_TRACER - installExceptionStackTracer(absl::GetFlag(FLAGS_exception_stack_tracer)); -#endif // BMCWEB_ENABLE_EXCEPTION_STACK_TRACER std::shared_ptr<milotic_tlbmc::CredentialManager> credential_manager = nullptr; #ifdef BMCWEB_ENABLE_GRPC
diff --git a/meson.build b/meson.build index 37c914c..8f78352 100644 --- a/meson.build +++ b/meson.build
@@ -448,14 +448,6 @@ bmcweb_dependencies += abseil_deps - # The exception stack tracer installs a __cxa_throw interposer (the "folly - # trick") plus a std::terminate handler. It is meson/yocto-only: the g3/blaze - # build does not compile src/exception_stack_tracer.cpp, so every reference to - # it in webserver_main_setup is guarded by this macro to avoid a hard - # dependency in g3. Defined here because srcfiles_bmcweb below always builds - # the tracer translation unit for the meson/yocto build. - add_project_arguments('-DBMCWEB_ENABLE_EXCEPTION_STACK_TRACER', language : 'cpp') - # Source files fs = import('fs') @@ -482,7 +474,6 @@ 'redfish-core/src/utils/json_utils.cpp', 'redfish-core/src/utils/subprocess_utils.cpp', 'src/webserver_main_setup.cpp', - 'src/exception_stack_tracer.cpp', 'src/boost_asio_ssl.cpp', 'src/boost_asio.cpp', 'src/boost_beast.cpp', @@ -559,30 +550,16 @@ executable( 'bmcweb', 'src/webserver_main.cpp', - # Compiled directly into the executable (in addition to bmcweblib, which the - # unit tests link) so the __cxa_throw interposer is a direct object, not an - # archive member: --exclude-libs,ALL force-hides archive symbols and would - # otherwise defeat the --dynamic-list export below. The duplicate archive - # member is simply not pulled, since the direct object already defines it. - 'src/exception_stack_tracer.cpp', include_directories : incdir, dependencies: bmcweb_dependencies, link_with: libs_link_with, - # --gc-sections trims unused code; --dynamic-list force-exports only the - # exception stack tracer's __cxa_throw interposer so it interposes throws - # from every module (libstdc++ and other .so's), not just the executable. - link_args: [ - '-Wl,--gc-sections', - '-Wl,--dynamic-list=@0@/exception_stack_tracer.dynlist'.format( - meson.current_source_dir()), - ], + link_args: '-Wl,--gc-sections', install: true, install_dir: bindir, ) srcfiles_unittest = [ 'src/managed_store_http_test.cpp', - 'test/src/exception_stack_tracer_test.cpp', 'test/g3/mock_managed_store_test.cpp', 'test/http/crow_getroutes_test.cpp', 'test/http/http_response_test.cpp',
diff --git a/src/webserver_main_setup.cpp b/src/webserver_main_setup.cpp index d57565e..1933481 100644 --- a/src/webserver_main_setup.cpp +++ b/src/webserver_main_setup.cpp
@@ -54,10 +54,6 @@ "Number of requests skipped when rate limiting enabled"); ABSL_FLAG(bool, multi_thread_get, enableMultiThreadGet, "Enable multi-thread for Redfish GET"); -ABSL_FLAG(bool, exception_stack_tracer, true, - "Record throw-site stacks and print them from the terminate " - "handler. Kill switch: set to false to disable recording and keep " - "the default terminate handler."); ABSL_FLAG(bool, enable_tlbmc, enableTlbmc, "Enable tlBMC features"); ABSL_FLAG(bool, enable_tlbmc_trace, enableTlbmcTrace, "Enable tlBMC tracer"); ABSL_FLAG(bool, enable_tlbmc_thermal_control, enableTlbmcThermalControl,
diff --git a/tlbmc/collector/thermal_collector.cc b/tlbmc/collector/thermal_collector.cc index c6d6c32..a55e2d4 100644 --- a/tlbmc/collector/thermal_collector.cc +++ b/tlbmc/collector/thermal_collector.cc
@@ -1107,6 +1107,12 @@ return zone_id_to_manual_modes; } +void ThermalCollector::SetManualPwm(absl::string_view fan_name, double pwm) { + for (const auto& [zone_id, zone_manager] : zone_id_to_zone_manager_) { + zone_manager->SetManualPwm(fan_name, pwm); + } +} + absl::Status ThermalCollector::RequestPidControllerCoefficientsTuning( absl::string_view controller_id, const thermal::PidController::PidControllerCoefficients& coefficients) { @@ -1527,6 +1533,12 @@ return {}; } +void EmptyThermalCollector::SetManualPwm(absl::string_view fan_name, + double pwm) { + LOG(WARNING) << "EmptyThermalCollector::SetManualPwm is " + "called. This does nothing."; +} + absl::Status EmptyThermalCollector::RequestPidControllerCoefficientsTuning( absl::string_view controller_id, const thermal::PidController::PidControllerCoefficients& coefficients) {
diff --git a/tlbmc/collector/thermal_collector.h b/tlbmc/collector/thermal_collector.h index 90a0c46..c7bd6c9 100644 --- a/tlbmc/collector/thermal_collector.h +++ b/tlbmc/collector/thermal_collector.h
@@ -160,9 +160,9 @@ // Enable/Disable fan manual mode for all zones. virtual void SetManualMode(bool enable); - // Returns the map of zone ID to manual mode status. virtual absl::flat_hash_map<int, bool> GetZoneIdToManualModes() const; + virtual void SetManualPwm(absl::string_view fan_name, double pwm); // Tuning request functions virtual absl::Status RequestPidControllerCoefficientsTuning( @@ -386,8 +386,8 @@ void StartCollection(); void SetManualMode(bool enable) override; - absl::flat_hash_map<int, bool> GetZoneIdToManualModes() const override; + void SetManualPwm(absl::string_view fan_name, double pwm) override; absl::Status RequestPidControllerCoefficientsTuning( absl::string_view controller_id,