Message ID | 20241219-hw_protection-reboot-v1-4-263a0c1df802@pengutronix.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | reboot: support runtime configuration of emergency hw_protection action | expand |
Hi Ahmad, kernel test robot noticed the following build warnings: [auto build test WARNING on 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8] url: https://github.com/intel-lab-lkp/linux/commits/Ahmad-Fatoum/reboot-replace-__hw_protection_shutdown-bool-action-parameter-with-an-enum/20241219-155416 base: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8 patch link: https://lore.kernel.org/r/20241219-hw_protection-reboot-v1-4-263a0c1df802%40pengutronix.de patch subject: [PATCH 04/11] reboot: rename now misleading hw_protection symbols config: i386-buildonly-randconfig-003-20241220 (https://download.01.org/0day-ci/archive/20241220/202412201443.inJcQtcl-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241220/202412201443.inJcQtcl-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202412201443.inJcQtcl-lkp@intel.com/ All warnings (new ones prefixed by >>): kernel/reboot.c:241: warning: Function parameter or struct member 'cmd' not described in 'do_kernel_restart' kernel/reboot.c:995: warning: Function parameter or struct member 'action' not described in 'hw_failure_emergency_schedule' kernel/reboot.c:995: warning: Function parameter or struct member 'poweroff_delay_ms' not described in 'hw_failure_emergency_schedule' >> kernel/reboot.c:1023: warning: Function parameter or struct member 'action' not described in '__hw_protection_trigger' >> kernel/reboot.c:1023: warning: Excess function parameter 'shutdown' description in '__hw_protection_trigger' vim +1023 kernel/reboot.c dfa19b11385d4c Matti Vaittinen 2021-06-03 1002 dfa19b11385d4c Matti Vaittinen 2021-06-03 1003 /** c37fda1c195d45 Ahmad Fatoum 2024-12-19 1004 * __hw_protection_trigger - Trigger an emergency system shutdown or reboot dfa19b11385d4c Matti Vaittinen 2021-06-03 1005 * 79fa723ba84c2b Fabio Estevam 2023-11-29 1006 * @reason: Reason of emergency shutdown or reboot to be printed. 79fa723ba84c2b Fabio Estevam 2023-11-29 1007 * @ms_until_forced: Time to wait for orderly shutdown or reboot before 79fa723ba84c2b Fabio Estevam 2023-11-29 1008 * triggering it. Negative value disables the forced 79fa723ba84c2b Fabio Estevam 2023-11-29 1009 * shutdown or reboot. 79fa723ba84c2b Fabio Estevam 2023-11-29 1010 * @shutdown: If true, indicates that a shutdown will happen 79fa723ba84c2b Fabio Estevam 2023-11-29 1011 * after the critical tempeature is reached. 79fa723ba84c2b Fabio Estevam 2023-11-29 1012 * If false, indicates that a reboot will happen 79fa723ba84c2b Fabio Estevam 2023-11-29 1013 * after the critical tempeature is reached. dfa19b11385d4c Matti Vaittinen 2021-06-03 1014 * 79fa723ba84c2b Fabio Estevam 2023-11-29 1015 * Initiate an emergency system shutdown or reboot in order to protect 79fa723ba84c2b Fabio Estevam 2023-11-29 1016 * hardware from further damage. Usage examples include a thermal protection. 79fa723ba84c2b Fabio Estevam 2023-11-29 1017 * NOTE: The request is ignored if protection shutdown or reboot is already 79fa723ba84c2b Fabio Estevam 2023-11-29 1018 * pending even if the previous request has given a large timeout for forced 79fa723ba84c2b Fabio Estevam 2023-11-29 1019 * shutdown/reboot. dfa19b11385d4c Matti Vaittinen 2021-06-03 1020 */ c37fda1c195d45 Ahmad Fatoum 2024-12-19 1021 void __hw_protection_trigger(const char *reason, int ms_until_forced, d3e5893beaf551 Ahmad Fatoum 2024-12-19 1022 enum hw_protection_action action) dfa19b11385d4c Matti Vaittinen 2021-06-03 @1023 { dfa19b11385d4c Matti Vaittinen 2021-06-03 1024 static atomic_t allow_proceed = ATOMIC_INIT(1); dfa19b11385d4c Matti Vaittinen 2021-06-03 1025 dfa19b11385d4c Matti Vaittinen 2021-06-03 1026 pr_emerg("HARDWARE PROTECTION shutdown (%s)\n", reason); dfa19b11385d4c Matti Vaittinen 2021-06-03 1027 dfa19b11385d4c Matti Vaittinen 2021-06-03 1028 /* Shutdown should be initiated only once. */ dfa19b11385d4c Matti Vaittinen 2021-06-03 1029 if (!atomic_dec_and_test(&allow_proceed)) 07a22b61946f0b Petr Mladek 2022-06-23 1030 return; dfa19b11385d4c Matti Vaittinen 2021-06-03 1031 dfa19b11385d4c Matti Vaittinen 2021-06-03 1032 /* dfa19b11385d4c Matti Vaittinen 2021-06-03 1033 * Queue a backup emergency shutdown in the event of dfa19b11385d4c Matti Vaittinen 2021-06-03 1034 * orderly_poweroff failure dfa19b11385d4c Matti Vaittinen 2021-06-03 1035 */ 595ab92650cc28 Ahmad Fatoum 2024-12-19 1036 hw_failure_emergency_schedule(action, ms_until_forced); d3e5893beaf551 Ahmad Fatoum 2024-12-19 1037 if (action == HWPROT_ACT_REBOOT) 79fa723ba84c2b Fabio Estevam 2023-11-29 1038 orderly_reboot(); d3e5893beaf551 Ahmad Fatoum 2024-12-19 1039 else d3e5893beaf551 Ahmad Fatoum 2024-12-19 1040 orderly_poweroff(true); dfa19b11385d4c Matti Vaittinen 2021-06-03 1041 } c37fda1c195d45 Ahmad Fatoum 2024-12-19 1042 EXPORT_SYMBOL_GPL(__hw_protection_trigger); dfa19b11385d4c Matti Vaittinen 2021-06-03 1043
diff --git a/include/linux/reboot.h b/include/linux/reboot.h index d6780fbf51535e1f98b576da0a06701402dfd447..b1e2c86d29a281abbcfe69bc00321df185c32c91 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -180,17 +180,17 @@ extern void orderly_reboot(void); enum hw_protection_action { HWPROT_ACT_SHUTDOWN, HWPROT_ACT_REBOOT }; -void __hw_protection_shutdown(const char *reason, int ms_until_forced, - enum hw_protection_action action); +void __hw_protection_trigger(const char *reason, int ms_until_forced, + enum hw_protection_action action); static inline void hw_protection_reboot(const char *reason, int ms_until_forced) { - __hw_protection_shutdown(reason, ms_until_forced, HWPROT_ACT_REBOOT); + __hw_protection_trigger(reason, ms_until_forced, HWPROT_ACT_REBOOT); } static inline void hw_protection_shutdown(const char *reason, int ms_until_forced) { - __hw_protection_shutdown(reason, ms_until_forced, HWPROT_ACT_SHUTDOWN); + __hw_protection_trigger(reason, ms_until_forced, HWPROT_ACT_SHUTDOWN); } /* diff --git a/kernel/reboot.c b/kernel/reboot.c index 8e3680d36654587b57db44806a3d7b0228b10f67..da6c8bdeeefe627a76c7ec6e8926138ebbe3ae4e 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -947,13 +947,13 @@ static const char *hw_protection_action_str(enum hw_protection_action action) static enum hw_protection_action hw_failure_emergency_action; /** - * hw_failure_emergency_poweroff_func - emergency poweroff work after a known delay - * @work: work_struct associated with the emergency poweroff function + * hw_failure_emergency_action_func - emergency action after a known delay + * @work: work_struct associated with the emergency action function * * This function is called in very critical situations to force - * a kernel poweroff after a configurable timeout value. + * a kernel poweroff or reboot after a configurable timeout value. */ -static void hw_failure_emergency_poweroff_func(struct work_struct *work) +static void hw_failure_emergency_action_func(struct work_struct *work) { const char *action_str = hw_protection_action_str(hw_failure_emergency_action); @@ -981,8 +981,8 @@ static void hw_failure_emergency_poweroff_func(struct work_struct *work) emergency_restart(); } -static DECLARE_DELAYED_WORK(hw_failure_emergency_poweroff_work, - hw_failure_emergency_poweroff_func); +static DECLARE_DELAYED_WORK(hw_failure_emergency_action_work, + hw_failure_emergency_action_func); /** * hw_failure_emergency_schedule - Schedule an emergency system shutdown or reboot @@ -996,12 +996,12 @@ static void hw_failure_emergency_schedule(enum hw_protection_action action, if (poweroff_delay_ms <= 0) return; hw_failure_emergency_action = action; - schedule_delayed_work(&hw_failure_emergency_poweroff_work, + schedule_delayed_work(&hw_failure_emergency_action_work, msecs_to_jiffies(poweroff_delay_ms)); } /** - * __hw_protection_shutdown - Trigger an emergency system shutdown or reboot + * __hw_protection_trigger - Trigger an emergency system shutdown or reboot * * @reason: Reason of emergency shutdown or reboot to be printed. * @ms_until_forced: Time to wait for orderly shutdown or reboot before @@ -1018,8 +1018,8 @@ static void hw_failure_emergency_schedule(enum hw_protection_action action, * pending even if the previous request has given a large timeout for forced * shutdown/reboot. */ -void __hw_protection_shutdown(const char *reason, int ms_until_forced, - enum hw_protection_action action) +void __hw_protection_trigger(const char *reason, int ms_until_forced, + enum hw_protection_action action) { static atomic_t allow_proceed = ATOMIC_INIT(1); @@ -1039,7 +1039,7 @@ void __hw_protection_shutdown(const char *reason, int ms_until_forced, else orderly_poweroff(true); } -EXPORT_SYMBOL_GPL(__hw_protection_shutdown); +EXPORT_SYMBOL_GPL(__hw_protection_trigger); static int __init reboot_setup(char *str) {
The __hw_protection_shutdown, hw_failure_emergency_poweroff_work and hw_failure_emergency_poweroff_func symbol names have become misleading, because they can either cause a shutdown (poweroff) or a reboot depending on an argument or a global variable. To avoid further confusion, let's rename them, so they don't suggest that a poweroff is all they can do. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- include/linux/reboot.h | 8 ++++---- kernel/reboot.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-)