Talking with Intel, they told me that updating code that might be running on another CPU is dangerous. Even in my tests, I found that the other CPU would take an GPF if it was executing code that changed.
Basically they told me "don't do that". Modifying code on the fly is out of the question. Luckily we do not need to do that anymore. The nop patching is now done on system boot up before SMP is even initialized. The dynamic code now only updates .text section that never leaves once it is there (except for module unloading). In the case of module unloading, we now have a hook to remove the references in the ftrace table.
We still check on code patching if what we modify is what we expect. If we fail here, we print a nasty warning and disable the function tracer. So far in my testing, I have not hit this warning. If anyone sees a warning coming out of the ftrace code, I hope they report it ASAP. And please CC me (rostedt@goodmis.org).
Note: Some of this code is still in queue to be pulled.
Posted Nov 2, 2008 17:37 UTC (Sun) by kasperd (guest, #11842)
[Link]
Do you check the pointers for validity before they are inserted in the table? If the pointer is not from the static kernel code or from module code, then it is worth investigating.