qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 09/10] cpu: remove exit_request global.


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC 09/10] cpu: remove exit_request global.
Date: Mon, 02 Feb 2015 11:03:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0


On 29/01/2015 16:52, Peter Maydell wrote:
>> > +    CPU_FOREACH(cpu) {
>> > +        cpu->exit_loop_request = 1;
>> > +    }
>> >  }
> You can't do this -- this code is a signal handler so it could
> get run at any time including while the list of CPUs is being
> updated. (This is why we have the exit_request flag in the
> first place rather than just setting the exit_request flag in
> each CPU...)

Actually you can do this if you are careful.

In particular, you can do it while you are under the big QEMU lock.  If
you are not, basically you have to treat the CPU list as RCU-protected,
and this is doable because the CPU object cannot be removed and added
back into the CPU list.

Unfortunately RCU doesn't support QTAILQ, at least not yet, so you'd
have to convert the CPU list to QLIST.  But the basic idea of this patch
can be done.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]