From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC7848F60 for ; Tue, 12 Sep 2023 13:07:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BAD5C433C7; Tue, 12 Sep 2023 13:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694524035; bh=zc+anFrDxyaIxmTBk8RiH3yEVkBLLz+pPnUwEmsdLlo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qnw6Ai3INePJNahBUb/EPn0fFcc7gqV6/poTDmTeVc6g/wWqKUueEXpbqCqAQkAyS WdHNrvgJG+lcsbl7qY7Rcaea5ZOsQ1pTwpigB+Ira6DzXP60rL3zpfkIZLkXTAIH10 8AmASd73uAmJGa/1mDdOZxyuKq4AiJGqVfhBt77w8ZOHvOEz6v9ZRl6QJUjNOARKOG 7QBFOLN4vCuM4ZPRvvVoJPhncieIExi5UK6+nBV56DzzAuD37EYExcrOxgp2bjTByX nxQr/TG/cuQEER+WIbs43qxvCGwlNS+MKtCNC7SFeNxG64M8eVz/Sk8NRWEPS/vNxQ QIm9F1wfz/Meg== Received: from [104.132.96.100] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qg36m-00CGvE-Rr; Tue, 12 Sep 2023 14:07:13 +0100 Date: Tue, 12 Sep 2023 14:07:07 +0100 Message-ID: <87fs3j4k1w.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Xu Zhao Subject: Re: [PATCH 4/5] KVM: arm64: vgic-v3: Refactor GICv3 SGI generation In-Reply-To: <963a899d-d25a-368f-1465-851787c25959@linux.dev> References: <20230907100931.1186690-1-maz@kernel.org> <20230907100931.1186690-5-maz@kernel.org> <87ledd51tu.wl-maz@kernel.org> <963a899d-d25a-368f-1465-851787c25959@linux.dev> 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/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 104.132.96.100 X-SA-Exim-Rcpt-To: zenghui.yu@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, zhaoxu.35@bytedance.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 11 Sep 2023 16:57:39 +0100, Zenghui Yu wrote: > > On 2023/9/11 02:18, Marc Zyngier wrote: > > On Sun, 10 Sep 2023 17:25:36 +0100, > > Zenghui Yu wrote: > >> > >> Hi Marc, > >> > >> I asked because it seems that in kvm/arm64 we always use > >> kvm_get_vcpu(kvm, i) to obtain the kvm_vcpu pointer, even if *i* is > >> sometimes essentially provided by userspace.. > > > > Huh, this is incredibly dodgy. I had a go at a few occurrences (see > > below), but this is hardly a complete list. > > Another case is all kvm_get_vcpu(kvm, target_addr) in the vgic-its > emulation code. As we expose GITS_TYPER.PTA=0 to guest, which indicates > that the target address corresponds to the PE number specified by > GICR_TYPER.Processor_Number, which is now encoded as vcpu->vcpu_id. Yup, that's indeed missing. I'm going to hack kvmtool to generate stupid vcpu_ids and see what explodes... Thanks, M. -- Without deviation from the norm, progress is not possible. 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 AD7CACA0EC3 for ; Tue, 12 Sep 2023 13:07:49 +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=w21vwvewYgzxDBignKr0BYS5HiJCpTvEeB/j3d0Lvbg=; b=gQdTtAGJRjphIC XXhby0Xnt1ylRj7EVqUFiEJf8dPBXYfaaC6QoidvGMTO8GXglVaEEiVa+0ibCRSoEdIsZFNucyQru yImpvaZUe4jC969ggEy09iEqKBON0q/i/JwZQYhYAPbQYUymDZkivNWJ2U0W1tgeUup100XAoUGkA I627AaKCtNjYoYA95ElfuhLRY55MFswB5r5EHvs1WvDGjRraDT50nCXTOcITnYzXroeiu5dlJ9hg9 7061LM7RjuOt9wR+4VU4pQ2wsQyP5wEqYY5xNLDuwMuy0Lb+a2MWlj7l/MSyiX9pg/SxvCsyoDXq4 E/WMKBZra2AvsjDQ57gQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qg36u-003OMi-3A; Tue, 12 Sep 2023 13:07:20 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qg36s-003OM9-1z for linux-arm-kernel@lists.infradead.org; Tue, 12 Sep 2023 13:07:19 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D4408B81CF2; Tue, 12 Sep 2023 13:07:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BAD5C433C7; Tue, 12 Sep 2023 13:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694524035; bh=zc+anFrDxyaIxmTBk8RiH3yEVkBLLz+pPnUwEmsdLlo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qnw6Ai3INePJNahBUb/EPn0fFcc7gqV6/poTDmTeVc6g/wWqKUueEXpbqCqAQkAyS WdHNrvgJG+lcsbl7qY7Rcaea5ZOsQ1pTwpigB+Ira6DzXP60rL3zpfkIZLkXTAIH10 8AmASd73uAmJGa/1mDdOZxyuKq4AiJGqVfhBt77w8ZOHvOEz6v9ZRl6QJUjNOARKOG 7QBFOLN4vCuM4ZPRvvVoJPhncieIExi5UK6+nBV56DzzAuD37EYExcrOxgp2bjTByX nxQr/TG/cuQEER+WIbs43qxvCGwlNS+MKtCNC7SFeNxG64M8eVz/Sk8NRWEPS/vNxQ QIm9F1wfz/Meg== Received: from [104.132.96.100] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qg36m-00CGvE-Rr; Tue, 12 Sep 2023 14:07:13 +0100 Date: Tue, 12 Sep 2023 14:07:07 +0100 Message-ID: <87fs3j4k1w.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Xu Zhao Subject: Re: [PATCH 4/5] KVM: arm64: vgic-v3: Refactor GICv3 SGI generation In-Reply-To: <963a899d-d25a-368f-1465-851787c25959@linux.dev> References: <20230907100931.1186690-1-maz@kernel.org> <20230907100931.1186690-5-maz@kernel.org> <87ledd51tu.wl-maz@kernel.org> <963a899d-d25a-368f-1465-851787c25959@linux.dev> 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/28.2 (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: 104.132.96.100 X-SA-Exim-Rcpt-To: zenghui.yu@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, zhaoxu.35@bytedance.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-20230912_060718_791450_894291AF X-CRM114-Status: GOOD ( 18.47 ) 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 On Mon, 11 Sep 2023 16:57:39 +0100, Zenghui Yu wrote: > > On 2023/9/11 02:18, Marc Zyngier wrote: > > On Sun, 10 Sep 2023 17:25:36 +0100, > > Zenghui Yu wrote: > >> > >> Hi Marc, > >> > >> I asked because it seems that in kvm/arm64 we always use > >> kvm_get_vcpu(kvm, i) to obtain the kvm_vcpu pointer, even if *i* is > >> sometimes essentially provided by userspace.. > > > > Huh, this is incredibly dodgy. I had a go at a few occurrences (see > > below), but this is hardly a complete list. > > Another case is all kvm_get_vcpu(kvm, target_addr) in the vgic-its > emulation code. As we expose GITS_TYPER.PTA=0 to guest, which indicates > that the target address corresponds to the PE number specified by > GICR_TYPER.Processor_Number, which is now encoded as vcpu->vcpu_id. Yup, that's indeed missing. I'm going to hack kvmtool to generate stupid vcpu_ids and see what explodes... Thanks, M. -- 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