On 6/15/07, Kieran Mansley <[EMAIL PROTECTED]> wrote:
The lock protects the use_count variable. The use_count variable prevents the plugin module unloading while it is being used. I couldn't just use the lock to prevent the module unloading as the hook function (i) might block (and holding a spin_lock would be rather antisocial) (ii) might call back into netfront and try to take the lock again, which would deadlock.
If the hook routine blocks on the other code path instead of tx/rx path, why not use a simple atomic reference count. When the reference count reachs zero, free it. Considering you can synchronzie on tx/rx path, the free will not happen under the critical code path. So the uninitialize work could be done inside the free routine even if it blocks.
I think that RCU would only work in this situation if the hook functions didn't block,.
I agree.
Kieran
-- best regards, hanzhu - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html