aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-02-18 17:06:24 (GMT)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-02-18 17:06:24 (GMT)
commit647e6bcbe891e98b2df528246ae6f6d181209d03 (patch)
treecd752ebfaf4addb0f3247719a6ea655fcd42052f
parentf15d1b2a66376a03cf2aad9a3d435618debd14d9 (diff)
test-media: replace rmmod by separate unbind and rmmod
If kobjects are delayed-released, then when using rmmod the module memory can be freed before the kobject release function is called, which might be in that freed memory. As far as I can tell there is no protection for this, and so errors due to this are not a bug in the driver, but a consequence of enabling this debug option. So use unbind to check for issues with delayed release. And run rmmod once all those objects are safely released. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rwxr-xr-xcontrib/test/test-media82
1 files changed, 62 insertions, 20 deletions
diff --git a/contrib/test/test-media b/contrib/test/test-media
index f1fd366..4f2e4f9 100755
--- a/contrib/test/test-media
+++ b/contrib/test/test-media
@@ -12,6 +12,15 @@ cecpwr=--skip-test-standby-resume
kmemleak=0
dmesg=0
unload=0
+unbind_time=1
+rmmod_time=1
+
+if [ -f /proc/config.gz ]; then
+ if cat /proc/config.gz | gunzip |grep -q CONFIG_DEBUG_KOBJECT_RELEASE=y ; then
+ unbind_time=10
+ rmmod_time=5
+ fi
+fi
cur_lvl=`cut -c 1-2 /proc/sys/kernel/printk`
dmesg -n notice
@@ -158,9 +167,18 @@ if [ $cec -eq 1 ]; then
vivid=1
fi
+echo
+echo unbind vivid
+echo
+echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
+sleep $unbind_time
+echo
+echo rmmod vivid
+echo
+rmmod vivid
+sleep $rmmod_time
+
if [ $kmemleak -eq 1 -a $vivid -eq 1 ]; then
- rmmod vivid
- sleep 10
echo
echo kmemleak results for vivid:
echo
@@ -169,23 +187,23 @@ if [ $kmemleak -eq 1 -a $vivid -eq 1 ]; then
echo
echo end of kmemleak results
echo
+fi
- modprobe vivid n_devs=3 multiplanar=1,2,2 #allocators=0,1,1
- sleep 1
+modprobe vivid n_devs=3 multiplanar=1,2,2 #allocators=0,1,1
+sleep 1
- v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
- v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16
+v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
+v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16
- echo clear >/sys/kernel/debug/kmemleak
- echo
- echo
- echo
- echo
- echo
- echo
- echo
- echo
-fi
+echo clear >/sys/kernel/debug/kmemleak
+echo
+echo
+echo
+echo
+echo
+echo
+echo
+echo
if [ $vim2m -eq 1 ]; then
modprobe vim2m
@@ -196,7 +214,6 @@ if [ $vim2m -eq 1 ]; then
echo
stdbuf -oL v4l2-compliance -m platform:vim2m -z platform:vivid-002 -e vivid-002-vid-cap -s10 -P -a 2>&1 | tee -a $tmp
echo
- rmmod vim2m
echo
echo
echo
@@ -205,8 +222,16 @@ if [ $vim2m -eq 1 ]; then
echo
echo
echo
+ echo unbind vim2m
+ echo
+ echo -n vim2m.0 >/sys/bus/platform/drivers/vim2m/unbind
+ sleep $unbind_time
+ echo
+ echo rmmod vim2m
+ echo
+ rmmod vim2m
+ sleep $rmmod_time
if [ $kmemleak -eq 1 ]; then
- sleep 10
echo
echo kmemleak results for vim2m:
echo
@@ -240,7 +265,6 @@ if [ $vimc -eq 1 ]; then
echo
stdbuf -oL v4l2-compliance -m platform:vimc -z platform:vivid-002 -e vivid-002-vid-cap -s10 -P -a 2>&1 | tee -a $tmp
echo
- rmmod vimc
echo
echo
echo
@@ -249,8 +273,17 @@ if [ $vimc -eq 1 ]; then
echo
echo
echo
+ echo
+ echo unbind vimc
+ echo
+ echo -n vimc.0 >/sys/bus/platform/drivers/vimc/unbind
+ sleep $unbind_time
+ echo
+ echo rmmod vimc
+ echo
+ rmmod vimc
+ sleep $rmmod_time
if [ $kmemleak -eq 1 ]; then
- sleep 10
echo
echo kmemleak results for vimc:
echo
@@ -270,7 +303,16 @@ if [ $vimc -eq 1 ]; then
fi
fi
+echo
+echo unbind vivid
+echo
+echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
+sleep $unbind_time
+echo
+echo rmmod vivid
+echo
rmmod vivid
+sleep $rmmod_time
echo
echo Summary:

Privacy Policy