mbox series

[v2,0/4] panic: Add new API in_panic_state()

Message ID 20201220034505.113118-1-nixiaoming@huawei.com
Headers show
Series panic: Add new API in_panic_state() | expand

Message

Xiaoming Ni Dec. 20, 2020, 3:45 a.m. UTC
For some features (such as hang_task, ledtrig-activity, ledtrig-heartbeat)
different processing logics need to be performed based on whether the
current system is in panic state:
	1: Register hook for panic_notifier_list.
	2. Assign a value to the global variable in the hook function.
	3. Determine whether the system is in panic state based on the
          global variable and perform different processing.
Duplicate code snippets exist, and the timing judgment is relatively lag.
Therefore, consider extracting the new API: bool in_panic_state(void).

----------------

v2: Rename api to in_panic_state as recommended by Pavel Machek, Tetsuo
 Handa, Randy Dunlap.

v1: https://lore.kernel.org/lkml/20201218114406.61906-1-nixiaoming@huawei.com/
  API name: is_being_panic
----------------

Xiaoming Ni (4):
  panic: Add new API in_panic_state()
  hung_task: Replace "did_panic" with in_panic_state()
  leds:trigger:ledtrig-activity Replace "panic_detected" with
    in_panic_state()
  leds:trigger:ledtrig-heartbeat: Replace "panic_heartbeats" with
    in_panic_state()

 drivers/leds/trigger/ledtrig-activity.c  | 19 +------------------
 drivers/leds/trigger/ledtrig-heartbeat.c | 19 +------------------
 include/linux/kernel.h                   |  1 +
 kernel/hung_task.c                       | 17 +----------------
 kernel/panic.c                           |  6 ++++++
 5 files changed, 10 insertions(+), 52 deletions(-)