驱动测试错误集锦

1,加载驱动报错

“insmod:error inserting './dcache.ko': -1 Cannot allocate memory

是因为你原来可能已经存在一个这样的驱动了,需要卸载掉。

2,卸载过程

* Remove a cache:

  Assuming your cache is named "fo o", run commands:

  umount /dev/mapper/foo
  dmsetup remove foo
  rmmod dcache
  lsmod
  insmod dcache

3,error: invalid storage class for function

就是因为少了一个“}”

4创建一个dcache硬件设备

fdisk -l
fdisk /dev/vdb
n,e,ent,ent,ent,w
blockdev --getsize /dev/vdc
echo 0 62914560 cache /dev/sdc /dev/sdb 0 8 65536 256 1 | dmsetup create dcache

报错

root@demo-2:~# echo 0 62914560 dcache /dev/vdc /dev/vdb 0 8 65536 256 1 | dmsetup create dcache

Message from syslogd@demo-2 at Dec  3 07:47:05 ...
 kernel:[951389.165407] Kernel panic - not syncing: VERIFY: assertion (spin_is_locked(&dmc->lock)) failed at /root/cc-threadpool/test3/dcache.c (227)

Message from syslogd@demo-2 at Dec  3 07:47:05 ...
 kernel:[951389.165408]

5,挂载

echo 0 62914560 dcache /dev/vdc /dev/vdb | dmsetup create dcache
cd /dev/mapper/


6,卸载驱动

root@demo-2:~# sudo umount /dev/mapper/dcache 
sudo: unable to resolve host demo-2
umount: /mnt/dmcache: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
root@demo-2:~# fuser -m /mnt/dmcache/
/mnt/dmcache:        10375c
root@demo-2:~# ps aux|grep 10375c
root     11539  0.0  0.0   7832   880 pts/1    R+   07:08   0:00 grep 10375c
root@demo-2:~# kill -9 10375

你可能感兴趣的:(驱动测试错误集锦)