From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: [PATCH] arm: KVM: Don't return PSCI_INVAL if waitqueue is inactive Date: Wed, 20 Nov 2013 11:21:02 -0800 Message-ID: <20131120192102.GF9314@cbox> References: <1384973499-30659-1-git-send-email-christoffer.dall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "kvmarm@lists.cs.columbia.edu" , arm-mail-list , kvm-devel , Marc Zyngier To: Peter Maydell Return-path: Received: from mail-pa0-f45.google.com ([209.85.220.45]:50394 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754193Ab3KTTTh (ORCPT ); Wed, 20 Nov 2013 14:19:37 -0500 Received: by mail-pa0-f45.google.com with SMTP id kp14so4577787pab.4 for ; Wed, 20 Nov 2013 11:19:36 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Nov 20, 2013 at 07:12:42PM +0000, Peter Maydell wrote: > On 20 November 2013 18:51, Christoffer Dall wrote: > > Therefore, set the pause flag on the vcpu at VCPU init time (which can > > reasonably be expected to be completed for all CPUs by user space before > > running any VCPUs) and clear both this flag and the feature (in case the > > feature can somehow get set again in the future) and ping the waitqueue > > on turning on a VCPU using PSCI. > > Tangential, but your phrasing prompted me to ask: how does > the "start in PSCI power-off" boot protocol work for system reset? > Since the kernel doesn't currently provide a "reset this v CPU" > ioctl userspace has to do reset manually[*]; how do we say "take > this vCPU which has started up and run once, and put it back > into PSCI power-off" ? > > [*] this is pretty tedious, since it involves reading every CPU > register on the vCPU before first run in order to feed the kernel > back a bunch of info it already knows about the reset state of > a vCPU. > So, from looking at the code and the API specification calling KVM_ARM_VCPU_INIT does exactly this and also resets all core and cp15 registers for you - you would here be able to set the power-off flag and pause those CPUs so PSCI can wake them up again. Am I missing something here? This makes me wonder if it's worth adding to Documentation/virtual/kvm/api.txt that KVM_ARM_VCPU_INIT should be called on all VCPUs before running any of the VCPUs... -Christoffer