From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2A01C433F5 for ; Fri, 25 Feb 2022 15:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242178AbiBYPhk (ORCPT ); Fri, 25 Feb 2022 10:37:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242174AbiBYPhj (ORCPT ); Fri, 25 Feb 2022 10:37:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B258B21EBAA for ; Fri, 25 Feb 2022 07:37:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A3B461890 for ; Fri, 25 Feb 2022 15:37:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACED8C340E7; Fri, 25 Feb 2022 15:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645803426; bh=SiyBeYhls8/kz1YvQqn0t9gFcAOpmUd7OBXO0BWM8ck=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iW215UkmDi1NpBBJ6pJstgL/K6ct++CQLRyzZeGOKAQBTK41VGm2L/z+tik6wrGzB HdGq5l7wbeDjeO5uiqfubRKbjmH25YDruQMNkFzgwCHUruZz2B5mGPlzJyEdzl1rEi rPpxaZDpsSsRcbQPEjfHdjc7pAZKENlBBzRhD+dvblbwhY/yGuk3pt7yai5/l8ViV+ lJZA4poUGjdLOX1z4w3k+URBaRKv2X8R7HbHkyfSXK2TsRCYzNGB08N+J51RIbMWcb o9QXwBdGHYNDMeTCQ/iR64NYdZ68KvUTk7dCIwB+AnZYXe1QO03cfkQFnXwbZETsC4 kfWq5MvmEqAyQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nNceW-00AZ0Q-C0; Fri, 25 Feb 2022 15:37:04 +0000 Date: Fri, 25 Feb 2022 15:37:03 +0000 Message-ID: <87h78n2c0w.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Anup Patel , Atish Patra , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, Peter Shier , Reiji Watanabe , Ricardo Koller , Raghavendra Rao Ananta , Jing Zhang Subject: Re: [PATCH v3 06/19] KVM: arm64: Track vCPU power state using MP state values In-Reply-To: References: <20220223041844.3984439-1-oupton@google.com> <20220223041844.3984439-7-oupton@google.com> <87y2202y8f.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oupton@google.com, kvmarm@lists.cs.columbia.edu, pbonzini@redhat.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, anup@brainfault.org, atishp@atishpatra.org, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, pshier@google.com, reijiw@google.com, ricarkol@google.com, rananta@google.com, jingzhangos@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, 24 Feb 2022 22:08:15 +0000, Oliver Upton wrote: > > Hi Marc, > > On Thu, Feb 24, 2022 at 01:25:04PM +0000, Marc Zyngier wrote: > > [...] > > > > @@ -190,7 +190,7 @@ static void kvm_prepare_system_event(struct kvm_vcpu *vcpu, u32 type) > > > * re-initialized. > > > */ > > > kvm_for_each_vcpu(i, tmp, vcpu->kvm) > > > - tmp->arch.power_off = true; > > > + tmp->arch.mp_state = KVM_MP_STATE_STOPPED; > > > kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_SLEEP); > > > > > > memset(&vcpu->run->system_event, 0, sizeof(vcpu->run->system_event)); > > > > You also may want to initialise the mp_state to RUNNABLE by default in > > kvm_arch_vcpu_create(). We are currently relying on power_off to be > > false thanks to the vcpu struct being zeroed, but we may as well make > > it clearer (RUNNABLE is also 0, so there is no actual bug here). > > We unconditionally initialize power_off in > kvm_arch_vcpu_ioctl_vcpu_init(), and do the same in this patch for mp_state, > depending on if KVM_ARM_VCPU_POWER_OFF is set. Ah, I missed that. Thanks for the heads up. > Any objections to leaving that as-is? I can move the RUNNABLE case into > kvm_arch_vcpu_create() as you've suggested, too. No, that's just a brain fart on my part. Leave it as is. Thanks, M. -- Without deviation from the norm, progress is not possible.