The patch looks mostly fine. Except I would move the checks for the availability of the acceleration function inside the LockExclusiveAccess() and UnlockExclusiveAccess() blocks. The reason being that there is a race condition if you don't.
I wanted to hold the lock for as little as a time as possible, I'll search through the mode-switching code to see if maybe there is a safe way to safe-guard against a race or if the situation is even possible... I'm thinking it isn't an issue, I'm just doing the prep work without causing any external changes. I don't think the accelerant can change while app_server is running... if it can, then I do seriously need to lock earlier! Otherwise, I assumed we'd train app_server to be restartable for changing drivers...
--The loon