#!/bin/bash # # NAME # failcmd.sh - run a command with injecting slab/page allocation failures # # SYNOPSIS # failcmd.sh --help # failcmd.sh [] command [arguments] # # DESCRIPTION # Run command with injecting slab/page allocation failures by fault # injection. # # NOTE: you need to run this script as root. # usage() { cat >&2 <&2 exit 1 fi DEBUGFS=`mount -t debugfs | head -1 | awk '{ print $3}'` if [ ! -d "$DEBUGFS" ]; then echo debugfs is not mounted >&2 exit 1 fi FAILCMD_TYPE=${FAILCMD_TYPE:-failslab} FAULTATTR=$DEBUGFS/$FAILCMD_TYPE if [ ! -d $FAULTATTR ]; then echo $FAILCMD_TYPE is not available >&2 exit 1 fi LONGOPTS=probability:,interval:,times:,space:,verbose:,task-filter: LONGOPTS=$LONGOPTS,stacktrace-depth:,require-start:,require-end: LONGOPTS=$LONGOPTS,reject-start:,reject-end:,oom-kill-allocating-task:,help if [ $FAILCMD_TYPE = failslab ]; then LONGOPTS=$LONGOPTS,ignore-gfp-wait:,cache-filter: elif [ $FAILCMD_TYPE = fail_page_alloc ]; then LONGOPTS=$LONGOPTS,ignore-gfp-wait:,ignore-gfp-highmem:,min-order: fi TEMP=`getopt -o p:i:t:s:v:h --long $LONGOPTS -n 'failcmd.sh' -- "$@"` if [ $? != 0 ]; then usage exit 1 fi eval set -- "$TEMP" fault_attr_default() { echo N > $FAULTATTR/task-filter echo 0 > $FAULTATTR/probability echo 1 > $FAULTATTR/times } fault_attr_default oom_kill_allocating_task_saved=`cat /proc/sys/vm/oom_kill_allocating_task` restore_values() { fault_attr_default echo $oom_kill_allocating_task_saved \ > /proc/sys/vm/oom_kill_allocating_task } # # Default options # declare -i oom_kill_allocating_task=1 declare task_filter=Y declare -i probability=1 declare -i times=1 while true; do case "$1" in -p|--probability) probability=$2 shift 2 ;; -i|--interval) echo $2 > $FAULTATTR/interval shift 2 ;; -t|--times) times=$2 shift 2 ;; -s|--space) echo $2 > $FAULTATTR/space shift 2 ;; -v|--verbose) echo $2 > $FAULTATTR/verbose shift 2 ;; --task-filter) task_filter=$2 shift 2 ;; --stacktrace-depth) echo $2 > $FAULTATTR/stacktrace-depth shift 2 ;; --require-start) echo $2 > $FAULTATTR/require-start shift 2 ;; --require-end) echo $2 > $FAULTATTR/require-end shift 2 ;; --reject-start) echo $2 > $FAULTATTR/reject-start shift 2 ;; --reject-end) echo $2 > $FAULTATTR/reject-end shift 2 ;; --oom-kill-allocating-task) oom_kill_allocating_task=$2 shift 2 ;; --ignore-gfp-wait) echo $2 > $FAULTATTR/ignore-gfp-wait shift 2 ;; --cache-filter) echo $2 > $FAULTATTR/cache_filter shift 2 ;; --ignore-gfp-highmem) echo $2 > $FAULTATTR/ignore-gfp-highmem shift 2 ;; --min-order) echo $2 > $FAULTATTR/min-order shift 2 ;; -h|--help) usage exit 0 shift ;; --) shift break ;; esac done [ -z "$1" ] && exit 0 echo $oom_kill_allocating_task > /proc/sys/vm/oom_kill_allocating_task echo $task_filter > $FAULTATTR/task-filter echo $probability > $FAULTATTR/probability echo $times > $FAULTATTR/times trap "restore_values" SIGINT SIGTERM EXIT cmd="echo 1 > /proc/self/make-it-fail && exec $@" bash -c "$cmd" >space:mode:
authorThomas Gleixner <tglx@linutronix.de>2017-01-31 09:37:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2017-01-31 21:47:58 +0100
commit0becc0ae5b42828785b589f686725ff5bc3b9b25 (patch)
treebe6d0e1f37c38ed0a7dd5da2d4b1e93f0fb43101 /drivers/usb/gadget/udc/lpc32xx_udc.c
parent24c2503255d35c269b67162c397a1a1c1e02f6ce (diff)
x86/mce: Make timer handling more robust
Erik reported that on a preproduction hardware a CMCI storm triggers the BUG_ON in add_timer_on(). The reason is that the per CPU MCE timer is started by the CMCI logic before the MCE CPU hotplug callback starts the timer with add_timer_on(). So the timer is already queued which triggers the BUG. Using add_timer_on() is pretty pointless in this code because the timer is strictlty per CPU, initialized as pinned and all operations which arm the timer happen on the CPU to which the timer belongs. Simplify the whole machinery by using mod_timer() instead of add_timer_on() which avoids the problem because mod_timer() can handle already queued timers. Use __start_timer() everywhere so the earliest armed expiry time is preserved. Reported-by: Erik Veijola <erik.veijola@intel.com> Tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@alien8.de> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701310936080.3457@nanos Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/usb/gadget/udc/lpc32xx_udc.c')