요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Notifier error injection
========================
Notifier error injection provides the ability to inject artificial errors to
specified notifier chain callbacks. It is useful to test the error handling of
notifier call chain failures which is rarely executed. There are kernel
modules that can be used to test the following notifiers.
* PM notifier
* Memory hotplug notifier
* powerpc pSeries reconfig notifier
* Netdevice notifier
PM notifier error injection module
----------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
Possible PM notifier events to be failed are:
* PM_HIBERNATION_PREPARE
* PM_SUSPEND_PREPARE
* PM_RESTORE_PREPARE
Example: Inject PM suspend error (-12 = -ENOMEM)::
# cd /sys/kernel/debug/notifier-error-inject/pm/
# echo -12 > actions/PM_SUSPEND_PREPARE/error
# echo mem > /sys/power/state
bash: echo: write error: Cannot allocate memory
Memory hotplug notifier error injection module
----------------------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
Possible memory notifier events to be failed are:
* MEM_GOING_ONLINE
* MEM_GOING_OFFLINE
Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
# cd /sys/kernel/debug/notifier-error-inject/memory
# echo -12 > actions/MEM_GOING_OFFLINE/error
# echo offline > /sys/devices/system/memory/memoryXXX/state
bash: echo: write error: Cannot allocate memory
powerpc pSeries reconfig notifier error injection module
--------------------------------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
Possible pSeries reconfig notifier events to be failed are:
* PSERIES_RECONFIG_ADD
* PSERIES_RECONFIG_REMOVE
* PSERIES_DRCONF_MEM_ADD
* PSERIES_DRCONF_MEM_REMOVE
Netdevice notifier error injection module
----------------------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
Netdevice notifier events which can be failed are:
* NETDEV_REGISTER
* NETDEV_CHANGEMTU
* NETDEV_CHANGENAME
* NETDEV_PRE_UP
* NETDEV_PRE_TYPE_CHANGE
* NETDEV_POST_INIT
* NETDEV_PRECHANGEMTU
* NETDEV_PRECHANGEUPPER
* NETDEV_CHANGEUPPER
Example: Inject netdevice mtu change error (-22 == -EINVAL)::
# cd /sys/kernel/debug/notifier-error-inject/netdev
# echo -22 > actions/NETDEV_CHANGEMTU/error
# ip link set eth0 mtu 1024
RTNETLINK answers: Invalid argument
For more usage examples
-----------------------
There are tools/testing/selftests using the notifier error injection features
for CPU and memory notifiers.
* tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
* tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
These scripts first do simple online and offline tests and then do fault
injection tests if notifier error injection module is available.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Notifier callback 오류 주입 범위
1-13Notifier error injection은 지정한 notifier chain callback이 인위적인 오류를 반환하도록 합니다. 정상 운영에서는 거의 실행되지 않는 notifier call-chain failure의 오류 처리 경로를 시험할 때 유용합니다.
제공되는 kernel module은 PM notifier, memory hotplug notifier, powerpc pSeries reconfiguration notifier, netdevice notifier를 대상으로 합니다.
Notifier error injection
========================
Notifier error injection provides the ability to inject artificial errors to
specified notifier chain callbacks. It is useful to test the error handling of
notifier call chain failures which is rarely executed. There are kernel
modules that can be used to test the following notifiers.
* PM notifier
* Memory hotplug notifier
* powerpc pSeries reconfig notifier
* Netdevice notifier
PM notifier 오류 주입
14-32PM notifier는 `/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error`에서 제어합니다.
실패시킬 수 있는 event는 `PM_HIBERNATION_PREPARE`, `PM_SUSPEND_PREPARE`, `PM_RESTORE_PREPARE`입니다.
예제는 `PM_SUSPEND_PREPARE/error`에 `-12`(`-ENOMEM`)를 쓰고 `/sys/power/state`에 `mem`을 요청합니다. Suspend 준비 callback이 강제로 실패하므로 shell은 `Cannot allocate memory` write error를 받습니다.
준비 notifier의 반환값을 설정한 뒤 실제 power-state 전환을 요청합니다.
PM notifier error injection module
----------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
Possible PM notifier events to be failed are:
* PM_HIBERNATION_PREPARE
* PM_SUSPEND_PREPARE
* PM_RESTORE_PREPARE
Example: Inject PM suspend error (-12 = -ENOMEM)::
# cd /sys/kernel/debug/notifier-error-inject/pm/
# echo -12 > actions/PM_SUSPEND_PREPARE/error
# echo mem > /sys/power/state
bash: echo: write error: Cannot allocate memory
Memory hotplug notifier 오류 주입
33-50Memory hotplug notifier는 `/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error`에서 제어하며 `MEM_GOING_ONLINE`과 `MEM_GOING_OFFLINE` event를 실패시킬 수 있습니다.
예제는 `MEM_GOING_OFFLINE/error`에 `-12`를 쓰고 `/sys/devices/system/memory/memoryXXX/state`에 `offline`을 요청합니다. Callback이 `-ENOMEM`을 반환하므로 memory block의 offline 전환이 거부됩니다.
Memory hotplug notifier error injection module
----------------------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
Possible memory notifier events to be failed are:
* MEM_GOING_ONLINE
* MEM_GOING_OFFLINE
Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
# cd /sys/kernel/debug/notifier-error-inject/memory
# echo -12 > actions/MEM_GOING_OFFLINE/error
# echo offline > /sys/devices/system/memory/memoryXXX/state
bash: echo: write error: Cannot allocate memory
PowerPC pSeries 재구성 notifier
51-63pSeries reconfiguration notifier는 `/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error`에서 제어합니다.
`PSERIES_RECONFIG_ADD`·`PSERIES_RECONFIG_REMOVE`은 pSeries 구성 개체 추가·제거를, `PSERIES_DRCONF_MEM_ADD`·`PSERIES_DRCONF_MEM_REMOVE`은 dynamic reconfiguration memory 추가·제거를 시험합니다.
powerpc pSeries reconfig notifier error injection module
--------------------------------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
Possible pSeries reconfig notifier events to be failed are:
* PSERIES_RECONFIG_ADD
* PSERIES_RECONFIG_REMOVE
* PSERIES_DRCONF_MEM_ADD
* PSERIES_DRCONF_MEM_REMOVE
Netdevice notifier 오류 주입
64-88Netdevice notifier는 `/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error`에서 제어합니다.
실패 가능한 event는 `NETDEV_REGISTER`, `NETDEV_CHANGEMTU`, `NETDEV_CHANGENAME`, `NETDEV_PRE_UP`, `NETDEV_PRE_TYPE_CHANGE`, `NETDEV_POST_INIT`, `NETDEV_PRECHANGEMTU`, `NETDEV_PRECHANGEUPPER`, `NETDEV_CHANGEUPPER`입니다.
예제는 `NETDEV_CHANGEMTU/error`에 `-22`(`-EINVAL`)를 쓰고 `ip link set eth0 mtu 1024`를 실행합니다. Notifier가 요청을 거부하므로 rtnetlink는 `Invalid argument`를 반환합니다.
Netdevice notifier error injection module
----------------------------------------------
This feature is controlled through debugfs interface
/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
Netdevice notifier events which can be failed are:
* NETDEV_REGISTER
* NETDEV_CHANGEMTU
* NETDEV_CHANGENAME
* NETDEV_PRE_UP
* NETDEV_PRE_TYPE_CHANGE
* NETDEV_POST_INIT
* NETDEV_PRECHANGEMTU
* NETDEV_PRECHANGEUPPER
* NETDEV_CHANGEUPPER
Example: Inject netdevice mtu change error (-22 == -EINVAL)::
# cd /sys/kernel/debug/notifier-error-inject/netdev
# echo -22 > actions/NETDEV_CHANGEMTU/error
# ip link set eth0 mtu 1024
RTNETLINK answers: Invalid argument
CPU·memory hotplug selftest
89-98`tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh`와 `tools/testing/selftests/memory-hotplug/mem-on-off-test.sh`는 notifier error injection을 사용하는 추가 예제입니다.
두 script는 먼저 단순 online·offline 동작을 검증하고, notifier error injection module을 사용할 수 있으면 이어서 fault injection test를 실행합니다.
정상 경로를 먼저 확인한 뒤 오류 callback 경로를 시험합니다.
For more usage examples
-----------------------
There are tools/testing/selftests using the notifier error injection features
for CPU and memory notifiers.
* tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
* tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
These scripts first do simple online and offline tests and then do fault
injection tests if notifier error injection module is available.
요약·해설
notifier-error-inject.rst:1-98Notifier error injection은 PM, memory hotplug, pSeries reconfiguration, netdevice callback이 지정한 errno를 반환하게 만들어 드문 chain-failure 복구 경로를 시험합니다.
정상 전환과 강제 거부를 비교합니다.