Hi, I was attempting to get the VTune driver running on Fedora Core 6 on P4-HT (i686; kernel: 2.6.18-1.2849.fc6). I was able to successfully compile the driver. When I tried to install the module, I got the following error: # insmod vtune_drv-x32-2.6.18-1.2849.fc6smp.ko insmod: error inserting 'vtune_drv-x32-2.6.18-1.2849.fc6smp.ko': -1 Unknown symbol in module The dmesg indicates that unknown symbol is "tasklist_lock". vtune_drv: Unknown symbol tasklist_lock
It is proposed that read_lock and read_unlock be replaced with rcu_read_lock() and rcu_read_unlock(). However I did not find an alternative call for read_trylock() which is being used in vtune.c (function: get_tgid_trylock). This function uses TGID_TRY and TGID_RELEASE macros (defined in vtprotos.h). I was considering replacing this with rcu_read_lock and rcu_read_unlock, since I dont know an alternative technique. However the comments in the code indicate: // Since we want the interrupt handler to avoid possible deadlock // due to a spin on the tasklist_lock, we will use the read_trylock() // call when it is available, but when it isn't we'll use the more // heavy handed write_trylock() which is available on all the kernels // we support...
I modified the driver, compiled it and loaded it. There does not seem to be any errors so far. Since I am not a kernel programmer and have no familiarity with Linux kernel, this needs some more investigation from the more knowledgable ones. Can someone give me some guidance on this?
You could replace all references to read_lock(&tasklist) by rcu_read_lock and similiarly for read_unlock.
Now try_lock tries to get a lock before 10,000 spins or retire; If you think a lock can be acquires within lesser spins, you CAN use a rcu_read_lock in place. (and the release part is a rcu_read_unlock)