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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEDC3C433EF for ; Wed, 9 Feb 2022 12:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Pw95+0r4Hw3UPDr1LuBDgJqyiihP1t+Fg6m56J+/gbU=; b=cJWe+hhjglWKxo +/xLvAMycQARIHGlOq9POtOVqODkuKsE6KVySww3DKy4A+TOrU97lCaczZB3YP/Pgx8aj537sjjFK 8uUR2r3Et2EpyJXrZMagjmsBtZLu463UG4rCP1ZaSs9TQRjzWVFrZCtuJb/UGWKluuc6U3br8tkHb xNr4l4EDCn5qotSvh4mMXGWYyC5ys4xOiggCOpz5wRm4KcQAr6pwGnrbRk0TQbHIYneITPeI9SgNY /m0nhdBMYYAfVcqsnakPBFkqTFJfWp1qQ5IQzEbP0wCIZKoxW4FqyT/EXFx1T/bL1mm0LTV4vTJlq 9Ax0JETEospTtx4EoaBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHliH-00HY2w-5O; Wed, 09 Feb 2022 12:04:45 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHliD-00HY1m-C1 for linux-arm-kernel@lists.infradead.org; Wed, 09 Feb 2022 12:04:42 +0000 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 5E3A3616E7; Wed, 9 Feb 2022 12:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 301CEC340EF; Wed, 9 Feb 2022 12:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644408280; bh=X3JslEcts3201WhkIsOB99xq0WjL+sdJPjqwAwvB/GM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=auMFBMIykaOHfvoauJj/NIr2wF7cNLi5UIVz2VN/IJU18jra87XpEWCDWuoiZX973 EK61tfJW86VSmprbpkN1ID0T99CV7/txtPJmvS1e+FGRC7BaQCeSpbNmghg9h16UIo KfS3Jdml8NOApQDxYBDfhszZLRj4Pfu4EBwKGZoMgyfDU6YqsED9oi679t5pHT2ojK ObUrk9sJdiw2WFP/OQsJIOFu5U4EXuJ9NFi7Tk9u9q/mppphaM06s1/N9LlbGdthgu TTvnp3BthD7vamWqes9g06zNHljN8MteT755QGNJEBXIG8FO3dvCmEDl/H9lecjMr3 5q8DHRn9hNa4w== 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 1nHli9-006bcc-Rn; Wed, 09 Feb 2022 12:04:38 +0000 Date: Wed, 09 Feb 2022 12:04:37 +0000 Message-ID: <875ypo5jqi.wl-maz@kernel.org> From: Marc Zyngier To: Reiji Watanabe Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Linux ARM , James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Will Deacon , Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata Subject: Re: [PATCH v2 1/2] KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs In-Reply-To: References: <20220118041923.3384602-1-reijiw@google.com> <87a6f15skj.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") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: reijiw@google.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, pbonzini@redhat.com, will@kernel.org, pshier@google.com, ricarkol@google.com, oupton@google.com, jingzhangos@google.com, rananta@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_040441_525187_255AC5D6 X-CRM114-Status: GOOD ( 26.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Reiji, On Wed, 09 Feb 2022 05:32:36 +0000, Reiji Watanabe wrote: > > Hi Marc, > > On Tue, Feb 8, 2022 at 6:41 AM Marc Zyngier wrote: > > > > In [1], I suggested another approach that didn't require extra state, > > and moved the existing checks under the kvm lock. What was wrong with > > that approach? > > With that approach, even for a vcpu that has a broken set of features, > which leads kvm_reset_vcpu() to fail for the vcpu, the vcpu->arch.features > are checked by other vCPUs' vcpu_allowed_register_width() until the > vcpu->arch.target is set to -1. > Due to this, I would think some or possibly all vCPUs' kvm_reset_vcpu() > may or may not fail (e.g. if userspace tries to configure vCPU#0 with > 32bit EL1, and vCPU#1 and #2 with 64 bit EL1, KVM_ARM_VCPU_INIT > for either vCPU#0, or both vCPU#1 and #2 should fail. But, with that > approach, it doesn't always work that way. Instead, KVM_ARM_VCPU_INIT > for all vCPUs could fail or KVM_ARM_VCPU_INIT for vCPU#0 and #1 could > fail while the one for CPU#2 works). > Also, even after the first KVM_RUN for vCPUs are already done, > (the first) KVM_ARM_VCPU_INIT for another vCPU could cause the > kvm_reset_vcpu() for those vCPUs to fail. > > I would think those behaviors are odd, and I wanted to avoid them. OK, fair enough. But then you need to remove most of the uses of KVM_ARM_VCPU_EL1_32BIT so that it is only used as a userspace interface and maybe not carried as part of the vcpu feature flag anymore. Also, we really should turn all these various bits in the kvm struct into a set of flags. I have a patch posted there[1] for this, feel free to pick it up. Thanks, M. [1] https://lore.kernel.org/r/20211004174849.2831548-2-maz@kernel.org -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel