Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RCU updates from Ingo Molnar:
"The biggest RCU changes in this cycle were:
- Convert RCU's BUG_ON() and similar calls to WARN_ON() and similar.
- Replace calls of RCU-bh and RCU-sched update-side functions to
their vanilla RCU counterparts. This series is a step towards
complete removal of the RCU-bh and RCU-sched update-side functions.
( Note that some of these conversions are going upstream via their
respective maintainers. )
- Documentation updates, including a number of flavor-consolidation
updates from Joel Fernandes.
- Miscellaneous fixes.
- Automate generation of the initrd filesystem used for rcutorture
testing.
- Convert spin_is_locked() assertions to instead use lockdep.
( Note that some of these conversions are going upstream via their
respective maintainers. )
- SRCU updates, especially including a fix from Dennis Krein for a
bag-on-head-class bug.
- RCU torture-test updates"
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (112 commits)
rcutorture: Don't do busted forward-progress testing
rcutorture: Use 100ms buckets for forward-progress callback histograms
rcutorture: Recover from OOM during forward-progress tests
rcutorture: Print forward-progress test age upon failure
rcutorture: Print time since GP end upon forward-progress failure
rcutorture: Print histogram of CB invocation at OOM time
rcutorture: Print GP age upon forward-progress failure
rcu: Print per-CPU callback counts for forward-progress failures
rcu: Account for nocb-CPU callback counts in RCU CPU stall warnings
rcutorture: Dump grace-period diagnostics upon forward-progress OOM
rcutorture: Prepare for asynchronous access to rcu_fwd_startat
torture: Remove unnecessary "ret" variables
rcutorture: Affinity forward-progress test to avoid housekeeping CPUs
rcutorture: Break up too-long rcu_torture_fwd_prog() function
rcutorture: Remove cbflood facility
torture: Bring any extra CPUs online during kernel startup
rcutorture: Add call_rcu() flooding forward-progress tests
rcutorture/formal: Replace synchronize_sched() with synchronize_rcu()
tools/kernel.h: Replace synchronize_sched() with synchronize_rcu()
net/decnet: Replace rcu_barrier_bh() with rcu_barrier()
...
This commit is contained in:
@@ -194,6 +194,14 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$TORTURE_INITRD" || tools/testing/selftests/rcutorture/bin/mkinitrd.sh
|
||||
then
|
||||
:
|
||||
else
|
||||
echo No initrd and unable to create one, aborting test >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG
|
||||
|
||||
if test -z "$configs"
|
||||
|
||||
136
tools/testing/selftests/rcutorture/bin/mkinitrd.sh
Executable file
136
tools/testing/selftests/rcutorture/bin/mkinitrd.sh
Executable file
@@ -0,0 +1,136 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Create an initrd directory if one does not already exist.
|
||||
#
|
||||
# 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, 2013
|
||||
#
|
||||
# Author: Connor Shu <Connor.Shu@ibm.com>
|
||||
|
||||
D=tools/testing/selftests/rcutorture
|
||||
|
||||
# Prerequisite checks
|
||||
[ -z "$D" ] && echo >&2 "No argument supplied" && exit 1
|
||||
if [ ! -d "$D" ]; then
|
||||
echo >&2 "$D does not exist: Malformed kernel source tree?"
|
||||
exit 1
|
||||
fi
|
||||
if [ -s "$D/initrd/init" ]; then
|
||||
echo "$D/initrd/init already exists, no need to create it"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
T=${TMPDIR-/tmp}/mkinitrd.sh.$$
|
||||
trap 'rm -rf $T' 0 2
|
||||
mkdir $T
|
||||
|
||||
cat > $T/init << '__EOF___'
|
||||
#!/bin/sh
|
||||
# Run in userspace a few milliseconds every second. This helps to
|
||||
# exercise the NO_HZ_FULL portions of RCU.
|
||||
while :
|
||||
do
|
||||
q=
|
||||
for i in \
|
||||
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
|
||||
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
|
||||
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
|
||||
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
|
||||
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
|
||||
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
|
||||
do
|
||||
q="$q $i"
|
||||
done
|
||||
sleep 1
|
||||
done
|
||||
__EOF___
|
||||
|
||||
# Try using dracut to create initrd
|
||||
if command -v dracut >/dev/null 2>&1
|
||||
then
|
||||
echo Creating $D/initrd using dracut.
|
||||
# Filesystem creation
|
||||
dracut --force --no-hostonly --no-hostonly-cmdline --module "base" $T/initramfs.img
|
||||
cd $D
|
||||
mkdir -p initrd
|
||||
cd initrd
|
||||
zcat $T/initramfs.img | cpio -id
|
||||
cp $T/init init
|
||||
chmod +x init
|
||||
echo Done creating $D/initrd using dracut
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# No dracut, so create a C-language initrd/init program and statically
|
||||
# link it. This results in a very small initrd, but might be a bit less
|
||||
# future-proof than dracut.
|
||||
echo "Could not find dracut, attempting C initrd"
|
||||
cd $D
|
||||
mkdir -p initrd
|
||||
cd initrd
|
||||
cat > init.c << '___EOF___'
|
||||
#ifndef NOLIBC
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
volatile unsigned long delaycount;
|
||||
|
||||
int main(int argc, int argv[])
|
||||
{
|
||||
int i;
|
||||
struct timeval tv;
|
||||
struct timeval tvb;
|
||||
|
||||
for (;;) {
|
||||
sleep(1);
|
||||
/* Need some userspace time. */
|
||||
if (gettimeofday(&tvb, NULL))
|
||||
continue;
|
||||
do {
|
||||
for (i = 0; i < 1000 * 100; i++)
|
||||
delaycount = i * i;
|
||||
if (gettimeofday(&tv, NULL))
|
||||
break;
|
||||
tv.tv_sec -= tvb.tv_sec;
|
||||
if (tv.tv_sec > 1)
|
||||
break;
|
||||
tv.tv_usec += tv.tv_sec * 1000 * 1000;
|
||||
tv.tv_usec -= tvb.tv_usec;
|
||||
} while (tv.tv_usec < 1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
___EOF___
|
||||
|
||||
# build using nolibc on supported archs (smaller executable) and fall
|
||||
# back to regular glibc on other ones.
|
||||
if echo -e "#if __x86_64__||__i386__||__i486__||__i586__||__i686__" \
|
||||
"||__ARM_EABI__||__aarch64__\nyes\n#endif" \
|
||||
| ${CROSS_COMPILE}gcc -E -nostdlib -xc - \
|
||||
| grep -q '^yes'; then
|
||||
# architecture supported by nolibc
|
||||
${CROSS_COMPILE}gcc -fno-asynchronous-unwind-tables -fno-ident \
|
||||
-nostdlib -include ../bin/nolibc.h -lgcc -s -static -Os \
|
||||
-o init init.c
|
||||
else
|
||||
${CROSS_COMPILE}gcc -s -static -Os -o init init.c
|
||||
fi
|
||||
|
||||
rm init.c
|
||||
echo "Done creating a statically linked C-language initrd"
|
||||
|
||||
exit 0
|
||||
2197
tools/testing/selftests/rcutorture/bin/nolibc.h
Normal file
2197
tools/testing/selftests/rcutorture/bin/nolibc.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,12 @@
|
||||
This document describes one way to create the initrd directory hierarchy
|
||||
in order to allow an initrd to be built into your kernel. The trick
|
||||
here is to steal the initrd file used on your Linux laptop, Ubuntu in
|
||||
this case. There are probably much better ways of doing this.
|
||||
The rcutorture scripting tools automatically create the needed initrd
|
||||
directory using dracut. Failing that, this tool will create an initrd
|
||||
containing a single statically linked binary named "init" that loops
|
||||
over a very long sleep() call. In both cases, this creation is done
|
||||
by tools/testing/selftests/rcutorture/bin/mkinitrd.sh.
|
||||
|
||||
That said, here are the commands:
|
||||
However, if you are attempting to run rcutorture on a system that does
|
||||
not have dracut installed, and if you don't like the notion of static
|
||||
linking, you might wish to press an existing initrd into service:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
cd tools/testing/selftests/rcutorture
|
||||
@@ -11,22 +14,7 @@ zcat /initrd.img > /tmp/initrd.img.zcat
|
||||
mkdir initrd
|
||||
cd initrd
|
||||
cpio -id < /tmp/initrd.img.zcat
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Another way to create an initramfs image is using "dracut"[1], which is
|
||||
available on many distros, however the initramfs dracut generates is a cpio
|
||||
archive with another cpio archive in it, so an extra step is needed to create
|
||||
the initrd directory hierarchy.
|
||||
|
||||
Here are the commands to create a initrd directory for rcutorture using
|
||||
dracut:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
dracut --no-hostonly --no-hostonly-cmdline --module "base bash shutdown" /tmp/initramfs.img
|
||||
cd tools/testing/selftests/rcutorture
|
||||
mkdir initrd
|
||||
cd initrd
|
||||
/usr/lib/dracut/skipcpio /tmp/initramfs.img | zcat | cpio -id < /tmp/initramfs.img
|
||||
# Manually verify that initrd contains needed binaries and libraries.
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Interestingly enough, if you are running rcutorture, you don't really
|
||||
@@ -39,75 +27,12 @@ with 0755 mode.
|
||||
------------------------------------------------------------------------
|
||||
#!/bin/sh
|
||||
|
||||
[ -d /dev ] || mkdir -m 0755 /dev
|
||||
[ -d /root ] || mkdir -m 0700 /root
|
||||
[ -d /sys ] || mkdir /sys
|
||||
[ -d /proc ] || mkdir /proc
|
||||
[ -d /tmp ] || mkdir /tmp
|
||||
mkdir -p /var/lock
|
||||
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
|
||||
mount -t proc -o nodev,noexec,nosuid proc /proc
|
||||
# Some things don't work properly without /etc/mtab.
|
||||
ln -sf /proc/mounts /etc/mtab
|
||||
|
||||
# Note that this only becomes /dev on the real filesystem if udev's scripts
|
||||
# are used; which they will be, but it's worth pointing out
|
||||
if ! mount -t devtmpfs -o mode=0755 udev /dev; then
|
||||
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
|
||||
mount -t tmpfs -o mode=0755 udev /dev
|
||||
[ -e /dev/console ] || mknod --mode=600 /dev/console c 5 1
|
||||
[ -e /dev/kmsg ] || mknod --mode=644 /dev/kmsg c 1 11
|
||||
[ -e /dev/null ] || mknod --mode=666 /dev/null c 1 3
|
||||
fi
|
||||
|
||||
mkdir /dev/pts
|
||||
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
|
||||
mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run
|
||||
mkdir /run/initramfs
|
||||
# compatibility symlink for the pre-oneiric locations
|
||||
ln -s /run/initramfs /dev/.initramfs
|
||||
|
||||
# Export relevant variables
|
||||
export ROOT=
|
||||
export ROOTDELAY=
|
||||
export ROOTFLAGS=
|
||||
export ROOTFSTYPE=
|
||||
export IP=
|
||||
export BOOT=
|
||||
export BOOTIF=
|
||||
export UBIMTD=
|
||||
export break=
|
||||
export init=/sbin/init
|
||||
export quiet=n
|
||||
export readonly=y
|
||||
export rootmnt=/root
|
||||
export debug=
|
||||
export panic=
|
||||
export blacklist=
|
||||
export resume=
|
||||
export resume_offset=
|
||||
export recovery=
|
||||
|
||||
for i in /sys/devices/system/cpu/cpu*/online
|
||||
do
|
||||
case $i in
|
||||
'/sys/devices/system/cpu/cpu0/online')
|
||||
;;
|
||||
'/sys/devices/system/cpu/cpu*/online')
|
||||
;;
|
||||
*)
|
||||
echo 1 > $i
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
while :
|
||||
do
|
||||
sleep 10
|
||||
done
|
||||
------------------------------------------------------------------------
|
||||
|
||||
References:
|
||||
[1]: https://dracut.wiki.kernel.org/index.php/Main_Page
|
||||
[2]: http://blog.elastocloud.org/2015/06/rapid-linux-kernel-devtest-with-qemu.html
|
||||
[3]: https://www.centos.org/forums/viewtopic.php?t=51621
|
||||
This approach also allows most of the binaries and libraries in the
|
||||
initrd filesystem to be dispensed with, which can save significant
|
||||
space in rcutorture's "res" directory.
|
||||
|
||||
@@ -131,8 +131,8 @@ struct hlist_node {
|
||||
* weird ABI and we need to ask it explicitly.
|
||||
*
|
||||
* The alignment is required to guarantee that bits 0 and 1 of @next will be
|
||||
* clear under normal conditions -- as long as we use call_rcu(),
|
||||
* call_rcu_bh(), call_rcu_sched(), or call_srcu() to queue callback.
|
||||
* clear under normal conditions -- as long as we use call_rcu() or
|
||||
* call_srcu() to queue callback.
|
||||
*
|
||||
* This guarantee is important for few reasons:
|
||||
* - future call_rcu_lazy() will make use of lower bits in the pointer;
|
||||
|
||||
Reference in New Issue
Block a user