From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754743Ab2FWO64 (ORCPT ); Sat, 23 Jun 2012 10:58:56 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:54163 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754355Ab2FWO6y (ORCPT ); Sat, 23 Jun 2012 10:58:54 -0400 From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Akinobu Mita , Pavel Machek , "Rafael J. Wysocki" , linux-pm@lists.linux-foundation.org, Greg KH , linux-mm@kvack.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, =?UTF-8?q?Am=C3=A9rico=20Wang?= , Michael Ellerman Subject: [PATCH -v4 0/6] notifier error injection Date: Sat, 23 Jun 2012 23:58:16 +0900 Message-Id: <1340463502-15341-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.7.10.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This provides kernel modules that can be used to test the error handling of notifier call chain failures by injecting artifical errors to the following notifier chain callbacks. * CPU notifier * PM notifier * memory hotplug notifier * powerpc pSeries reconfig notifier Example: Inject CPU offline error (-1 == -EPERM) # cd /sys/kernel/debug/notifier-error-inject/cpu # echo -1 > actions/CPU_DOWN_PREPARE/error # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted There are also handy shell scripts to test CPU and memory hotplug notifier. Note that these tests didn't detect error handling bugs on my machine but I still think this feature is usefull to test the code path which is rarely executed. Changelog: * v4 (It is about 11 months since v3) - prefix all APIs with notifier_err_inject_* - rearrange debugfs interface (e.g. $DEBUGFS/cpu-notifier-error-inject/CPU_DOWN_PREPARE --> $DEBUGFS/notifier-error-inject/cpu/actions/CPU_DOWN_PREPARE/error) - update modules to follow new interface - add -r option for memory-notifier.sh to specify percent of offlining memory blocks * v3 - rewrite to be kernel modules instead of initializing at late_initcall()s (it makes the diffstat look different but most code remains unchanged) - export err_inject_notifier_block_{init,cleanup} for modules - export pSeries_reconfig_notifier_{,un}register symbols for a module - notifier priority can be specified as a module parameter - add testing scripts in tools/testing/fault-injection * v2 - "PM: Improve error code of pm_notifier_call_chain()" is now in -next - "debugfs: add debugfs_create_int" is dropped - put a comment in err_inject_notifier_block_init() - only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0) - improve Kconfig help text - make CONFIG_PM_NOTIFIER_ERROR_INJECTION visible even if PM_DEBUG is disabled - make CONFIG_PM_NOTIFIER_ERROR_INJECTION default if PM_DEBUG is enabled Akinobu Mita (6): fault-injection: notifier error injection cpu: rewrite cpu-notifier-error-inject module PM: PM notifier error injection module memory: memory notifier error injection module powerpc: pSeries reconfig notifier error injection module fault-injection: add notifier error injection testing scripts lib/Kconfig.debug | 91 ++++++++++- lib/Makefile | 5 + lib/cpu-notifier-error-inject.c | 63 +++----- lib/memory-notifier-error-inject.c | 48 ++++++ lib/notifier-error-inject.c | 112 ++++++++++++++ lib/notifier-error-inject.h | 24 +++ lib/pSeries-reconfig-notifier-error-inject.c | 51 +++++++ lib/pm-notifier-error-inject.c | 49 ++++++ tools/testing/fault-injection/cpu-notifier.sh | 169 +++++++++++++++++++++ tools/testing/fault-injection/memory-notifier.sh | 176 ++++++++++++++++++++++ 10 files changed, 748 insertions(+), 40 deletions(-) create mode 100644 lib/memory-notifier-error-inject.c create mode 100644 lib/notifier-error-inject.c create mode 100644 lib/notifier-error-inject.h create mode 100644 lib/pSeries-reconfig-notifier-error-inject.c create mode 100644 lib/pm-notifier-error-inject.c create mode 100755 tools/testing/fault-injection/cpu-notifier.sh create mode 100755 tools/testing/fault-injection/memory-notifier.sh Cc: Pavel Machek Cc: "Rafael J. Wysocki" Cc: linux-pm@lists.linux-foundation.org Cc: Greg KH Cc: linux-mm@kvack.org Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Cc: Américo Wang Cc: Michael Ellerman -- 1.7.10.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Akinobu Mita Subject: [PATCH -v4 0/6] notifier error injection Date: Sat, 23 Jun 2012 23:58:16 +0900 Message-ID: <1340463502-15341-1-git-send-email-akinobu.mita@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Michael Ellerman , Greg KH , Akinobu Mita , linux-mm@kvack.org, Paul Mackerras , =?UTF-8?q?Am=C3=A9rico=20Wang?= , linux-pm@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org List-Id: linux-pm@vger.kernel.org This provides kernel modules that can be used to test the error handling of notifier call chain failures by injecting artifical errors to the following notifier chain callbacks. * CPU notifier * PM notifier * memory hotplug notifier * powerpc pSeries reconfig notifier Example: Inject CPU offline error (-1 =3D=3D -EPERM) # cd /sys/kernel/debug/notifier-error-inject/cpu # echo -1 > actions/CPU_DOWN_PREPARE/error # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted There are also handy shell scripts to test CPU and memory hotplug notifie= r. Note that these tests didn't detect error handling bugs on my machine but I still think this feature is usefull to test the code path which is rare= ly executed. Changelog: * v4 (It is about 11 months since v3) - prefix all APIs with notifier_err_inject_* - rearrange debugfs interface (e.g. $DEBUGFS/cpu-notifier-error-inject/CPU_DOWN_PREPARE --> $DEBUGFS/notifier-error-inject/cpu/actions/CPU_DOWN_PREPARE/error= ) - update modules to follow new interface - add -r option for memory-notifier.sh to specify percent of offlining memory blocks * v3 - rewrite to be kernel modules instead of initializing at late_initcall()= s (it makes the diffstat look different but most code remains unchanged) - export err_inject_notifier_block_{init,cleanup} for modules - export pSeries_reconfig_notifier_{,un}register symbols for a module - notifier priority can be specified as a module parameter - add testing scripts in tools/testing/fault-injection * v2 - "PM: Improve error code of pm_notifier_call_chain()" is now in -next - "debugfs: add debugfs_create_int" is dropped - put a comment in err_inject_notifier_block_init() - only allow valid errno to be injected (-MAX_ERRNO <=3D errno <=3D 0) - improve Kconfig help text - make CONFIG_PM_NOTIFIER_ERROR_INJECTION visible even if PM_DEBUG is dis= abled - make CONFIG_PM_NOTIFIER_ERROR_INJECTION default if PM_DEBUG is enabled Akinobu Mita (6): fault-injection: notifier error injection cpu: rewrite cpu-notifier-error-inject module PM: PM notifier error injection module memory: memory notifier error injection module powerpc: pSeries reconfig notifier error injection module fault-injection: add notifier error injection testing scripts lib/Kconfig.debug | 91 ++++++++++- lib/Makefile | 5 + lib/cpu-notifier-error-inject.c | 63 +++----- lib/memory-notifier-error-inject.c | 48 ++++++ lib/notifier-error-inject.c | 112 ++++++++++++++ lib/notifier-error-inject.h | 24 +++ lib/pSeries-reconfig-notifier-error-inject.c | 51 +++++++ lib/pm-notifier-error-inject.c | 49 ++++++ tools/testing/fault-injection/cpu-notifier.sh | 169 ++++++++++++++++= +++++ tools/testing/fault-injection/memory-notifier.sh | 176 ++++++++++++++++= ++++++ 10 files changed, 748 insertions(+), 40 deletions(-) create mode 100644 lib/memory-notifier-error-inject.c create mode 100644 lib/notifier-error-inject.c create mode 100644 lib/notifier-error-inject.h create mode 100644 lib/pSeries-reconfig-notifier-error-inject.c create mode 100644 lib/pm-notifier-error-inject.c create mode 100755 tools/testing/fault-injection/cpu-notifier.sh create mode 100755 tools/testing/fault-injection/memory-notifier.sh Cc: Pavel Machek Cc: "Rafael J. Wysocki" Cc: linux-pm@lists.linux-foundation.org Cc: Greg KH Cc: linux-mm@kvack.org Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Cc: Am=C3=A9rico Wang Cc: Michael Ellerman --=20 1.7.10.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx204.postini.com [74.125.245.204]) by kanga.kvack.org (Postfix) with SMTP id 413536B02B7 for ; Sat, 23 Jun 2012 10:58:55 -0400 (EDT) Received: by pbbrp2 with SMTP id rp2so5902422pbb.14 for ; Sat, 23 Jun 2012 07:58:54 -0700 (PDT) From: Akinobu Mita Subject: [PATCH -v4 0/6] notifier error injection Date: Sat, 23 Jun 2012 23:58:16 +0900 Message-Id: <1340463502-15341-1-git-send-email-akinobu.mita@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Akinobu Mita , Pavel Machek , "Rafael J. Wysocki" , linux-pm@lists.linux-foundation.org, Greg KH , linux-mm@kvack.org, Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, =?UTF-8?q?Am=C3=A9rico=20Wang?= , Michael Ellerman This provides kernel modules that can be used to test the error handling of notifier call chain failures by injecting artifical errors to the following notifier chain callbacks. * CPU notifier * PM notifier * memory hotplug notifier * powerpc pSeries reconfig notifier Example: Inject CPU offline error (-1 == -EPERM) # cd /sys/kernel/debug/notifier-error-inject/cpu # echo -1 > actions/CPU_DOWN_PREPARE/error # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted There are also handy shell scripts to test CPU and memory hotplug notifier. Note that these tests didn't detect error handling bugs on my machine but I still think this feature is usefull to test the code path which is rarely executed. Changelog: * v4 (It is about 11 months since v3) - prefix all APIs with notifier_err_inject_* - rearrange debugfs interface (e.g. $DEBUGFS/cpu-notifier-error-inject/CPU_DOWN_PREPARE --> $DEBUGFS/notifier-error-inject/cpu/actions/CPU_DOWN_PREPARE/error) - update modules to follow new interface - add -r option for memory-notifier.sh to specify percent of offlining memory blocks * v3 - rewrite to be kernel modules instead of initializing at late_initcall()s (it makes the diffstat look different but most code remains unchanged) - export err_inject_notifier_block_{init,cleanup} for modules - export pSeries_reconfig_notifier_{,un}register symbols for a module - notifier priority can be specified as a module parameter - add testing scripts in tools/testing/fault-injection * v2 - "PM: Improve error code of pm_notifier_call_chain()" is now in -next - "debugfs: add debugfs_create_int" is dropped - put a comment in err_inject_notifier_block_init() - only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0) - improve Kconfig help text - make CONFIG_PM_NOTIFIER_ERROR_INJECTION visible even if PM_DEBUG is disabled - make CONFIG_PM_NOTIFIER_ERROR_INJECTION default if PM_DEBUG is enabled Akinobu Mita (6): fault-injection: notifier error injection cpu: rewrite cpu-notifier-error-inject module PM: PM notifier error injection module memory: memory notifier error injection module powerpc: pSeries reconfig notifier error injection module fault-injection: add notifier error injection testing scripts lib/Kconfig.debug | 91 ++++++++++- lib/Makefile | 5 + lib/cpu-notifier-error-inject.c | 63 +++----- lib/memory-notifier-error-inject.c | 48 ++++++ lib/notifier-error-inject.c | 112 ++++++++++++++ lib/notifier-error-inject.h | 24 +++ lib/pSeries-reconfig-notifier-error-inject.c | 51 +++++++ lib/pm-notifier-error-inject.c | 49 ++++++ tools/testing/fault-injection/cpu-notifier.sh | 169 +++++++++++++++++++++ tools/testing/fault-injection/memory-notifier.sh | 176 ++++++++++++++++++++++ 10 files changed, 748 insertions(+), 40 deletions(-) create mode 100644 lib/memory-notifier-error-inject.c create mode 100644 lib/notifier-error-inject.c create mode 100644 lib/notifier-error-inject.h create mode 100644 lib/pSeries-reconfig-notifier-error-inject.c create mode 100644 lib/pm-notifier-error-inject.c create mode 100755 tools/testing/fault-injection/cpu-notifier.sh create mode 100755 tools/testing/fault-injection/memory-notifier.sh Cc: Pavel Machek Cc: "Rafael J. Wysocki" Cc: linux-pm@lists.linux-foundation.org Cc: Greg KH Cc: linux-mm@kvack.org Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Cc: AmA(C)rico Wang Cc: Michael Ellerman -- 1.7.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E996BB6F6E for ; Sun, 24 Jun 2012 00:58:56 +1000 (EST) Received: by pbbrp16 with SMTP id rp16so5712159pbb.38 for ; Sat, 23 Jun 2012 07:58:54 -0700 (PDT) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH -v4 0/6] notifier error injection Date: Sat, 23 Jun 2012 23:58:16 +0900 Message-Id: <1340463502-15341-1-git-send-email-akinobu.mita@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Greg KH , Akinobu Mita , "Rafael J. Wysocki" , linux-mm@kvack.org, Paul Mackerras , Pavel Machek , =?UTF-8?q?Am=C3=A9rico=20Wang?= , linux-pm@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , This provides kernel modules that can be used to test the error handling of notifier call chain failures by injecting artifical errors to the following notifier chain callbacks. * CPU notifier * PM notifier * memory hotplug notifier * powerpc pSeries reconfig notifier Example: Inject CPU offline error (-1 == -EPERM) # cd /sys/kernel/debug/notifier-error-inject/cpu # echo -1 > actions/CPU_DOWN_PREPARE/error # echo 0 > /sys/devices/system/cpu/cpu1/online bash: echo: write error: Operation not permitted There are also handy shell scripts to test CPU and memory hotplug notifier. Note that these tests didn't detect error handling bugs on my machine but I still think this feature is usefull to test the code path which is rarely executed. Changelog: * v4 (It is about 11 months since v3) - prefix all APIs with notifier_err_inject_* - rearrange debugfs interface (e.g. $DEBUGFS/cpu-notifier-error-inject/CPU_DOWN_PREPARE --> $DEBUGFS/notifier-error-inject/cpu/actions/CPU_DOWN_PREPARE/error) - update modules to follow new interface - add -r option for memory-notifier.sh to specify percent of offlining memory blocks * v3 - rewrite to be kernel modules instead of initializing at late_initcall()s (it makes the diffstat look different but most code remains unchanged) - export err_inject_notifier_block_{init,cleanup} for modules - export pSeries_reconfig_notifier_{,un}register symbols for a module - notifier priority can be specified as a module parameter - add testing scripts in tools/testing/fault-injection * v2 - "PM: Improve error code of pm_notifier_call_chain()" is now in -next - "debugfs: add debugfs_create_int" is dropped - put a comment in err_inject_notifier_block_init() - only allow valid errno to be injected (-MAX_ERRNO <= errno <= 0) - improve Kconfig help text - make CONFIG_PM_NOTIFIER_ERROR_INJECTION visible even if PM_DEBUG is disabled - make CONFIG_PM_NOTIFIER_ERROR_INJECTION default if PM_DEBUG is enabled Akinobu Mita (6): fault-injection: notifier error injection cpu: rewrite cpu-notifier-error-inject module PM: PM notifier error injection module memory: memory notifier error injection module powerpc: pSeries reconfig notifier error injection module fault-injection: add notifier error injection testing scripts lib/Kconfig.debug | 91 ++++++++++- lib/Makefile | 5 + lib/cpu-notifier-error-inject.c | 63 +++----- lib/memory-notifier-error-inject.c | 48 ++++++ lib/notifier-error-inject.c | 112 ++++++++++++++ lib/notifier-error-inject.h | 24 +++ lib/pSeries-reconfig-notifier-error-inject.c | 51 +++++++ lib/pm-notifier-error-inject.c | 49 ++++++ tools/testing/fault-injection/cpu-notifier.sh | 169 +++++++++++++++++++++ tools/testing/fault-injection/memory-notifier.sh | 176 ++++++++++++++++++++++ 10 files changed, 748 insertions(+), 40 deletions(-) create mode 100644 lib/memory-notifier-error-inject.c create mode 100644 lib/notifier-error-inject.c create mode 100644 lib/notifier-error-inject.h create mode 100644 lib/pSeries-reconfig-notifier-error-inject.c create mode 100644 lib/pm-notifier-error-inject.c create mode 100755 tools/testing/fault-injection/cpu-notifier.sh create mode 100755 tools/testing/fault-injection/memory-notifier.sh Cc: Pavel Machek Cc: "Rafael J. Wysocki" Cc: linux-pm@lists.linux-foundation.org Cc: Greg KH Cc: linux-mm@kvack.org Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Cc: Américo Wang Cc: Michael Ellerman -- 1.7.10.2