#!/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 <paulmck@linux.vnet.ibm.com> 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 ='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>sound</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/aoa?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>aoa</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/aoa/core?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>core</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'> <tr><th>author</th><td>Cihangir Akturk <cakturk@gmail.com></td><td class='right'>2016-12-17 19:42:17 +0200</td></tr> <tr><th>committer</th><td>Jonathan Corbet <corbet@lwn.net></td><td class='right'>2016-12-27 13:08:42 -0700</td></tr> <tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/aoa/core?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75</a> (<a href='/cgit.cgi/linux/net-next.git/patch/sound/aoa/core?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>patch</a>)</td></tr> <tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>d79b8821d94660c65279378b04474e23f2e01b22</a> /<a href='/cgit.cgi/linux/net-next.git/tree/sound/aoa/core?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>sound/aoa/core</a></td></tr> <tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/aoa/core?id=66115335fbb411365c23349b2fbe7e041eabbaf2'>66115335fbb411365c23349b2fbe7e041eabbaf2</a> (<a href='/cgit.cgi/linux/net-next.git/diff/sound/aoa/core?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75&id2=66115335fbb411365c23349b2fbe7e041eabbaf2'>diff</a>)</td></tr></table> <div class='commit-subject'>Documentation/unaligned-memory-access.txt: fix incorrect comparison operator</div><div class='commit-msg'>In the actual implementation ether_addr_equal function tests for equality to 0 when returning. It seems in commit 0d74c4 it is somehow overlooked to change this operator to reflect the actual function. Signed-off-by: Cihangir Akturk <cakturk@gmail.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> </div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?id=36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75'>Diffstat</a> (limited to 'sound/aoa/core')</div><table summary='diffstat' class='diffstat'>