On 3 February 2015 at 09:37, Frederic Konrad <fred.kon...@greensocs.com> wrote: > Actually, what we want to do is remove exit_requested global because when it > exits > the loop in tcg_exec_all it does exit_requested = 0, and other vcpu doesn't > exit. > > This is not clear to me why we have both exit_requested global and > exit_request in CPUState.
Well, it's not totally clear, but there are two interlinked reasons: (1) historical/accidental (2) setting a global flag from a signal handler to be tested by a main loop is a standard pattern for avoiding race conditions and other nastiness that can otherwise occur, because "set flag" is always atomic. So to clean this up you need to establish what the current code/ data structures are doing and therefore what you can replace them with. > Maybe we can just make exit_request thread local this might work. Almost certainly not the *only* thing you need to do. Analyse the problem first, and the correct fix will follow :-) Also, the fact that KVM doesn't use the exit_request global at all suggests that the better approach might be to delete it entirely, if you can do it safely. > Also, we need to be able to exit VCPU we want from a TCG thread. > eg: We want to flush all the tlb we need to exit all cpus but one.. Compare the linux-user code for getting all CPUs out of their execution loop... -- PMM