Received: from eggs.gnu.org ([2001:4830:134:3::10]:47017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEF2n-000339-FT for qemu-devel@nongnu.org; Tue, 27 Aug 2013 04:54:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEF2g-0005OG-5k for qemu-devel@nongnu.org; Tue, 27 Aug 2013 04:54:33 -0400 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=koi8-r From: Alexander Graf In-Reply-To: <521C5845.80509@ozlabs.ru> Date: Tue, 27 Aug 2013 10:54:22 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1377257435-27714-1-git-send-email-aik@ozlabs.ru> <20130826152902.GB9120@voom.fritz.box> <521C4942.9060402@ozlabs.ru> <521C4EF0.9090405@redhat.com> <521C5845.80509@ozlabs.ru> Subject: Re: [Qemu-devel] [PATCH] spapr: support CPU hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Paolo Bonzini , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Paul Mackerras , David Gibson On 27.08.2013, at 09:41, Alexey Kardashevskiy wrote: > On 08/27/2013 05:02 PM, Paolo Bonzini wrote: >> Il 27/08/2013 08:37, Alexey Kardashevskiy ha scritto: >>>>> So this is here to make sure we don't accidentally get out of = halted state by an interrupt on that vcpu. Could you please somehow make = that part obvious? Either by adding a comment or by only explicitly = masking DEC and EE and a comment :). >>>>>=20 >>>>>> + cs->exit_request =3D 1; >>>>>=20 >>>>> This should probably be qemu_cpu_kick_self(). >>>>=20 >>>> Uh, no, I don't think so. This is there purely to make sure we = exit >>>> the inner loop, and actually test cpu_can_run() which will test >>>> halted. AFAICT qemu_cpu_kick_self() won't do anything similar. >>>=20 >>> rtas_stop_self() eventually returns to kvm_cpu_exec() which calls >>> qemu_cpu_kick_self() and resets cs->exit_request before return so I = do not >>> really see the difference in behaviour. And actually both ways CPU = stops in >>> exactly the same way. What do I miss? >>=20 >> What about TCG? >=20 > Oh. Right. TCG :( >=20 > qemu_cpu_kick_self() crashes the guest and cs->exit_request works = fine. >=20 > Why? Both should work? What is the expected behavior here? Thanks. Hrm. To me exit_request always was an internal piece of state that the = inner loop uses to find out whether to exit, but not something we should = randomly set from a device (and hypercalls / rtas calls are very similar = to devices). So I would like to not have any code in hw/ that modifies = it. However, we need the functionality of breaking out of the main loop, I = agree. Maybe what you are really looking for is = cpu_interrupt(CPU_INTERRUPT_HALT). That sets halted =3D 1 and exits the = main loop, because it's an interrupt. Alex