From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VECuv-0008Pb-AH for qemu-devel@nongnu.org; Tue, 27 Aug 2013 02:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VECuo-00079J-0B for qemu-devel@nongnu.org; Tue, 27 Aug 2013 02:38:17 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:60420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VECun-00076a-Pq for qemu-devel@nongnu.org; Tue, 27 Aug 2013 02:38:09 -0400 Received: by mail-pa0-f47.google.com with SMTP id kl13so4415426pab.34 for ; Mon, 26 Aug 2013 23:38:08 -0700 (PDT) Message-ID: <521C4942.9060402@ozlabs.ru> Date: Tue, 27 Aug 2013 16:37:54 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1377257435-27714-1-git-send-email-aik@ozlabs.ru> <20130826152902.GB9120@voom.fritz.box> In-Reply-To: <20130826152902.GB9120@voom.fritz.box> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spapr: support CPU hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-ppc@nongnu.org, Paul Mackerras , Alexander Graf , qemu-devel@nongnu.org On 08/27/2013 01:29 AM, David Gibson wrote: > On Mon, Aug 26, 2013 at 02:24:49PM +0200, Alexander Graf wrote: >> >> On 23.08.2013, at 13:30, Alexey Kardashevskiy wrote: >> >>> PAPR+ requires two RTAS calls to be supported by the hypervisor in >>> order to allow hotplugging VCPUs from the guest. The "start-cpu" RTAS >>> call was already there but "stop-self" was not. >>> >>> This adds the "stop-self" RTAS call. >>> >>> Signed-off-by: Alexey Kardashevskiy >>> --- >>> hw/ppc/spapr_rtas.c | 14 ++++++++++++++ >>> 1 file changed, 14 insertions(+) >>> >>> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c >>> index 394ce05..8a4cfa0 100644 >>> --- a/hw/ppc/spapr_rtas.c >>> +++ b/hw/ppc/spapr_rtas.c >>> @@ -202,6 +202,19 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr, >>> rtas_st(rets, 0, -3); >>> } >>> >>> +static void rtas_stop_self(PowerPCCPU *cpu, sPAPREnvironment *spapr, >>> + uint32_t token, uint32_t nargs, >>> + target_ulong args, >>> + uint32_t nret, target_ulong rets) >>> +{ >>> + CPUState *cs = CPU(cpu); >>> + CPUPPCState *env = &cpu->env; >>> + >>> + cs->halted = 1; >>> + env->msr = 0; >> >> 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 :). >> >>> + cs->exit_request = 1; >> >> This should probably be qemu_cpu_kick_self(). > > 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. 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? -- Alexey