#!/bin/bash # # Alternate sleeping and spinning on randomly selected CPUs. The purpose # of this script is to inflict random OS jitter on a concurrently running # test. # # Usage: jitter.sh me duration [ sleepmax [ spinmax ] ] # # me: Random-number-generator seed salt. # duration: Time to run in seconds. # sleepmax: Maximum microseconds to sleep, defaults to one second. # spinmax: Maximum microseconds to spin, defaults to one millisecond. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # # Copyright (C) IBM Corporation, 2016 # # Authors: Paul E. McKenney me=$(($1 * 1000)) duration=$2 sleepmax=${3-1000000} spinmax=${4-1000} n=1 starttime=`awk 'BEGIN { print systime(); }' < /dev/null` while : do # Check for done. t=`awk -v s=$starttime 'BEGIN { print systime() - s; }' < /dev/null` if test "$t" -gt "$duration" then exit 0; fi # Set affinity to randomly selected CPU cpus=`ls /sys/devices/system/cpu/*/online | sed -e 's,/[^/]*$,,' -e 's/^[^0-9]*//' | grep -v '^0*$'` cpumask=`awk -v cpus="$cpus" -v me=$me -v n=$n 'BEGIN { srand(n + me + systime()); ncpus = split(cpus, ca); curcpu = ca[int(rand() * ncpus + 1)]; mask = lshift(1, curcpu); if (mask + 0 <= 0) mask = 1; printf("%#x\n", mask); }' < /dev/null` n=$(($n+1)) if ! taskset -p $cpumask $$ > /dev/null 2>&1 then echo taskset failure: '"taskset -p ' $cpumask $$ '"' exit 1 fi # Sleep a random duration sleeptime=`awk -v me=$me -v n=$n -v sleepmax=$sleepmax 'BEGIN { srand(n + me + systime()); printf("%06d", int(rand() * sleepmax)); }' < /dev/null` n=$(($n+1)) sleep .$sleeptime # Spin a random duration limit=`awk -v me=$me -v n=$n -v spinmax=$spinmax 'BEGIN { srand(n + me + systime()); printf("%06d", int(rand() * spinmax)); }' < /dev/null` n=$(($n+1)) for i in {1..$limit} do echo > /dev/null done done exit 1 name='q' value=''/>
path: root/sound/usb/caiaq/audio.c
elected'>3
AgeCommit message (Expand)AuthorFilesLines
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:05:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:05:56 -0800
commitb272f732f888d4cf43c943a40c9aaa836f9b7431 (patch)
treeda9cac6b9d12b83592c16d3503c0e3f2f00f146f /sound/isa/wavefront
parent10bbe7599e2755d3f3e100103967788b8b5a4bce (diff)
parent008b69e4d52f2cbee3ed0d0502edd78155000b1a (diff)
Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull SMP hotplug notifier removal from Thomas Gleixner: "This is the final cleanup of the hotplug notifier infrastructure. The series has been reintgrated in the last two days because there came a new driver using the old infrastructure via the SCSI tree. Summary: - convert the last leftover drivers utilizing notifiers - fixup for a completely broken hotplug user - prevent setup of already used states - removal of the notifiers - treewide cleanup of hotplug state names - consolidation of state space There is a sphinx based documentation pending, but that needs review from the documentation folks" * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: irqchip/armada-xp: Consolidate hotplug state space irqchip/gic: Consolidate hotplug state space coresight/etm3/4x: Consolidate hotplug state space cpu/hotplug: Cleanup state names cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions staging/lustre/libcfs: Convert to hotplug state machine scsi/bnx2i: Convert to hotplug state machine scsi/bnx2fc: Convert to hotplug state machine cpu/hotplug: Prevent overwriting of callbacks x86/msr: Remove bogus cleanup from the error path bus: arm-ccn: Prevent hotplug callback leak perf/x86/intel/cstate: Prevent hotplug callback leak ARM/imx/mmcd: Fix broken cpu hotplug handling scsi: qedi: Convert to hotplug state machine
Diffstat (limited to 'sound/isa/wavefront')