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 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03847C433E0 for ; Wed, 27 May 2020 08:41:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6B342073B for ; Wed, 27 May 2020 08:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590568890; bh=E378D1wkdmQfMiop/fBX66cdxZ0b9zhjf0U/fYZnvBk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=JPhYbo2y+nCuSElGk53yPylHMs2IihPg/oCA5Xi7FSy5en9+/krRErQOWuaHfoVS/ lxA1OibLdxHTtLYq45+5Jn2LQ8GXwwFBR4Th+fNUopHP7YTvs55yD68IF5x+rhnipB 4G6ID/2GBwi8Z68yBh9HylqtsLS9xJk6C7zToxPQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388070AbgE0Ila (ORCPT ); Wed, 27 May 2020 04:41:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:43436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387858AbgE0Il3 (ORCPT ); Wed, 27 May 2020 04:41:29 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF36120723; Wed, 27 May 2020 08:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590568888; bh=E378D1wkdmQfMiop/fBX66cdxZ0b9zhjf0U/fYZnvBk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nmjnrOt6WgNE82CBCmt4ZJ8pDHHi6T+/y6D/ivIGYua+SXBSlKOrfbiEBriENHmGv xWvu55Jfjl8GQN0O46HWurgC/PJfj3r1bBcFfphCXq2Z8Y+FzkWo58iaQdFLBFaQbu aEHmcEhuDX/LU957RhGmlO3saI7YCobglXKif+mM= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jdrct-00Fe3b-6m; Wed, 27 May 2020 09:41:27 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 27 May 2020 09:41:27 +0100 From: Marc Zyngier To: Alexandru Elisei Cc: James Morse , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Dave Martin , Jintack Lim , George Cherian , "Zengtao (B)" , Will Deacon , Catalin Marinas , Mark Rutland , Julien Thierry , Suzuki K Poulose Subject: Re: [PATCH 03/26] KVM: arm64: Factor out stage 2 page table data from struct kvm In-Reply-To: <6518439c-65b7-1e87-a21d-a053d75c0514@arm.com> References: <20200422120050.3693593-1-maz@kernel.org> <20200422120050.3693593-4-maz@kernel.org> <76d811eb-b304-c49f-1f21-fe9d95112a28@arm.com> <6518439c-65b7-1e87-a21d-a053d75c0514@arm.com> User-Agent: Roundcube Webmail/1.4.4 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, Dave.Martin@arm.com, jintack@cs.columbia.edu, gcherian@marvell.com, prime.zeng@hisilicon.com, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Alex, On 2020-05-12 17:53, Alexandru Elisei wrote: > Hi, > > On 5/12/20 12:17 PM, James Morse wrote: >> Hi Alex, Marc, >> >> (just on this last_vcpu_ran thing...) >> >> On 11/05/2020 17:38, Alexandru Elisei wrote: >>> On 4/22/20 1:00 PM, Marc Zyngier wrote: >>>> From: Christoffer Dall >>>> >>>> As we are about to reuse our stage 2 page table manipulation code >>>> for >>>> shadow stage 2 page tables in the context of nested virtualization, >>>> we >>>> are going to manage multiple stage 2 page tables for a single VM. >>>> >>>> This requires some pretty invasive changes to our data structures, >>>> which moves the vmid and pgd pointers into a separate structure and >>>> change pretty much all of our mmu code to operate on this structure >>>> instead. >>>> >>>> The new structure is called struct kvm_s2_mmu. >>>> >>>> There is no intended functional change by this patch alone. >>>> diff --git a/arch/arm64/include/asm/kvm_host.h >>>> b/arch/arm64/include/asm/kvm_host.h >>>> index 7dd8fefa6aecd..664a5d92ae9b8 100644 >>>> --- a/arch/arm64/include/asm/kvm_host.h >>>> +++ b/arch/arm64/include/asm/kvm_host.h >>>> @@ -63,19 +63,32 @@ struct kvm_vmid { >>>> u32 vmid; >>>> }; >>>> >>>> -struct kvm_arch { >>>> +struct kvm_s2_mmu { >>>> struct kvm_vmid vmid; >>>> >>>> - /* stage2 entry level table */ >>>> - pgd_t *pgd; >>>> - phys_addr_t pgd_phys; >>>> - >>>> - /* VTCR_EL2 value for this VM */ >>>> - u64 vtcr; >>>> + /* >>>> + * stage2 entry level table >>>> + * >>>> + * Two kvm_s2_mmu structures in the same VM can point to the same >>>> pgd >>>> + * here. This happens when running a non-VHE guest hypervisor >>>> which >>>> + * uses the canonical stage 2 page table for both vEL2 and for >>>> vEL1/0 >>>> + * with vHCR_EL2.VM == 0. >>> It makes more sense to me to say that a non-VHE guest hypervisor will >>> use the >>> canonical stage *1* page table when running at EL2 >> Can KVM say anything about stage1? Its totally under the the guests >> control even at vEL2... > > It just occurred to me that "canonical stage 2 page table" refers to > the L0 > hypervisor stage 2, not to the L1 hypervisor stage 2. If you don't mind > my > suggestion, perhaps the comment can be slightly improved to avoid any > confusion? > Maybe something along the lines of "[..] This happens when running a > non-VHE guest > hypervisor, in which case we use the canonical stage 2 page table for > both vEL2 > and for vEL1/0 with vHCR_EL2.VM == 0". If the confusion stems from the lack of guest stage-2, how about: "This happens when running a guest using a translation regime that isn't affected by its own stage-2 translation, such as a non-VHE hypervisor running at vEL2, or for vEL1/EL0 with vHCR_EL2.VM == 0. In that case, we use the canonical stage-2 page tables." instead? Does this lift the ambiguity? Thanks, M. -- Jazz is not dead. It just smells funny... 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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0D0EC433DF for ; Wed, 27 May 2020 08:41:33 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 9CA9D20723 for ; Wed, 27 May 2020 08:41:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="nmjnrOt6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CA9D20723 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 407674B1A1; Wed, 27 May 2020 04:41:33 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OJ37GNJoZl61; Wed, 27 May 2020 04:41:31 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EE0424B1BB; Wed, 27 May 2020 04:41:31 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 09EDE4B17B for ; Wed, 27 May 2020 04:41:31 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gtKbkAXRQA+m for ; Wed, 27 May 2020 04:41:30 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id C9CEA4B172 for ; Wed, 27 May 2020 04:41:29 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF36120723; Wed, 27 May 2020 08:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590568888; bh=E378D1wkdmQfMiop/fBX66cdxZ0b9zhjf0U/fYZnvBk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nmjnrOt6WgNE82CBCmt4ZJ8pDHHi6T+/y6D/ivIGYua+SXBSlKOrfbiEBriENHmGv xWvu55Jfjl8GQN0O46HWurgC/PJfj3r1bBcFfphCXq2Z8Y+FzkWo58iaQdFLBFaQbu aEHmcEhuDX/LU957RhGmlO3saI7YCobglXKif+mM= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jdrct-00Fe3b-6m; Wed, 27 May 2020 09:41:27 +0100 MIME-Version: 1.0 Date: Wed, 27 May 2020 09:41:27 +0100 From: Marc Zyngier To: Alexandru Elisei Subject: Re: [PATCH 03/26] KVM: arm64: Factor out stage 2 page table data from struct kvm In-Reply-To: <6518439c-65b7-1e87-a21d-a053d75c0514@arm.com> References: <20200422120050.3693593-1-maz@kernel.org> <20200422120050.3693593-4-maz@kernel.org> <76d811eb-b304-c49f-1f21-fe9d95112a28@arm.com> <6518439c-65b7-1e87-a21d-a053d75c0514@arm.com> User-Agent: Roundcube Webmail/1.4.4 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, Dave.Martin@arm.com, jintack@cs.columbia.edu, gcherian@marvell.com, prime.zeng@hisilicon.com, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kvm@vger.kernel.org, Andre Przywara , Dave Martin , George Cherian , "Zengtao \(B\)" , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Alex, On 2020-05-12 17:53, Alexandru Elisei wrote: > Hi, > > On 5/12/20 12:17 PM, James Morse wrote: >> Hi Alex, Marc, >> >> (just on this last_vcpu_ran thing...) >> >> On 11/05/2020 17:38, Alexandru Elisei wrote: >>> On 4/22/20 1:00 PM, Marc Zyngier wrote: >>>> From: Christoffer Dall >>>> >>>> As we are about to reuse our stage 2 page table manipulation code >>>> for >>>> shadow stage 2 page tables in the context of nested virtualization, >>>> we >>>> are going to manage multiple stage 2 page tables for a single VM. >>>> >>>> This requires some pretty invasive changes to our data structures, >>>> which moves the vmid and pgd pointers into a separate structure and >>>> change pretty much all of our mmu code to operate on this structure >>>> instead. >>>> >>>> The new structure is called struct kvm_s2_mmu. >>>> >>>> There is no intended functional change by this patch alone. >>>> diff --git a/arch/arm64/include/asm/kvm_host.h >>>> b/arch/arm64/include/asm/kvm_host.h >>>> index 7dd8fefa6aecd..664a5d92ae9b8 100644 >>>> --- a/arch/arm64/include/asm/kvm_host.h >>>> +++ b/arch/arm64/include/asm/kvm_host.h >>>> @@ -63,19 +63,32 @@ struct kvm_vmid { >>>> u32 vmid; >>>> }; >>>> >>>> -struct kvm_arch { >>>> +struct kvm_s2_mmu { >>>> struct kvm_vmid vmid; >>>> >>>> - /* stage2 entry level table */ >>>> - pgd_t *pgd; >>>> - phys_addr_t pgd_phys; >>>> - >>>> - /* VTCR_EL2 value for this VM */ >>>> - u64 vtcr; >>>> + /* >>>> + * stage2 entry level table >>>> + * >>>> + * Two kvm_s2_mmu structures in the same VM can point to the same >>>> pgd >>>> + * here. This happens when running a non-VHE guest hypervisor >>>> which >>>> + * uses the canonical stage 2 page table for both vEL2 and for >>>> vEL1/0 >>>> + * with vHCR_EL2.VM == 0. >>> It makes more sense to me to say that a non-VHE guest hypervisor will >>> use the >>> canonical stage *1* page table when running at EL2 >> Can KVM say anything about stage1? Its totally under the the guests >> control even at vEL2... > > It just occurred to me that "canonical stage 2 page table" refers to > the L0 > hypervisor stage 2, not to the L1 hypervisor stage 2. If you don't mind > my > suggestion, perhaps the comment can be slightly improved to avoid any > confusion? > Maybe something along the lines of "[..] This happens when running a > non-VHE guest > hypervisor, in which case we use the canonical stage 2 page table for > both vEL2 > and for vEL1/0 with vHCR_EL2.VM == 0". If the confusion stems from the lack of guest stage-2, how about: "This happens when running a guest using a translation regime that isn't affected by its own stage-2 translation, such as a non-VHE hypervisor running at vEL2, or for vEL1/EL0 with vHCR_EL2.VM == 0. In that case, we use the canonical stage-2 page tables." instead? Does this lift the ambiguity? Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D9FC433E0 for ; Wed, 27 May 2020 08:41:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BB8002073B for ; Wed, 27 May 2020 08:41:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cJa2Xcap"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="nmjnrOt6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB8002073B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ONrg8AT0jquMIEzlgDaUkncrgHa+MlPNulLj7uWfJ2s=; b=cJa2XcapKlzP/d2g6LfybVEn+ XD0A7bJpKZ4ubit02ElUodKsxtYVoDTav2PlDxkEj9HChdHRcH2HU1h3LMlZUdSsImDL7663Nskg8 ES0++r4hXp+CPDiI5OvS+TuETlHz0jOhDRFEslE9DT5yK1Pa4FyovX77kY7LFPzlbLjNCV2U6h4Xm PKwU0H/rWvq/iQ4k9CBI/KFzLxgtCVTkUby4m/DKKRV9OLYV9j6QZt7TOx+O3eoTOjuv9pKD1yi16 HAE3tT7VJppGa605xh+XSA0lcfyrcCTOxAFAr9ToVWrwbx/VmZ4+Ammlrlp3rumKW/x0i7l82QLUk zz6yzP3CA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdrcy-0006Ru-Fv; Wed, 27 May 2020 08:41:32 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdrcv-0006RX-Dm for linux-arm-kernel@lists.infradead.org; Wed, 27 May 2020 08:41:30 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF36120723; Wed, 27 May 2020 08:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590568888; bh=E378D1wkdmQfMiop/fBX66cdxZ0b9zhjf0U/fYZnvBk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nmjnrOt6WgNE82CBCmt4ZJ8pDHHi6T+/y6D/ivIGYua+SXBSlKOrfbiEBriENHmGv xWvu55Jfjl8GQN0O46HWurgC/PJfj3r1bBcFfphCXq2Z8Y+FzkWo58iaQdFLBFaQbu aEHmcEhuDX/LU957RhGmlO3saI7YCobglXKif+mM= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jdrct-00Fe3b-6m; Wed, 27 May 2020 09:41:27 +0100 MIME-Version: 1.0 Date: Wed, 27 May 2020 09:41:27 +0100 From: Marc Zyngier To: Alexandru Elisei Subject: Re: [PATCH 03/26] KVM: arm64: Factor out stage 2 page table data from struct kvm In-Reply-To: <6518439c-65b7-1e87-a21d-a053d75c0514@arm.com> References: <20200422120050.3693593-1-maz@kernel.org> <20200422120050.3693593-4-maz@kernel.org> <76d811eb-b304-c49f-1f21-fe9d95112a28@arm.com> <6518439c-65b7-1e87-a21d-a053d75c0514@arm.com> User-Agent: Roundcube Webmail/1.4.4 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, Dave.Martin@arm.com, jintack@cs.columbia.edu, gcherian@marvell.com, prime.zeng@hisilicon.com, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.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-20200527_014129_499318_2E39CBEC X-CRM114-Status: GOOD ( 17.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kvm@vger.kernel.org, Suzuki K Poulose , Jintack Lim , Andre Przywara , Christoffer Dall , Dave Martin , George Cherian , James Morse , Julien Thierry , "Zengtao \(B\)" , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Alex, On 2020-05-12 17:53, Alexandru Elisei wrote: > Hi, > > On 5/12/20 12:17 PM, James Morse wrote: >> Hi Alex, Marc, >> >> (just on this last_vcpu_ran thing...) >> >> On 11/05/2020 17:38, Alexandru Elisei wrote: >>> On 4/22/20 1:00 PM, Marc Zyngier wrote: >>>> From: Christoffer Dall >>>> >>>> As we are about to reuse our stage 2 page table manipulation code >>>> for >>>> shadow stage 2 page tables in the context of nested virtualization, >>>> we >>>> are going to manage multiple stage 2 page tables for a single VM. >>>> >>>> This requires some pretty invasive changes to our data structures, >>>> which moves the vmid and pgd pointers into a separate structure and >>>> change pretty much all of our mmu code to operate on this structure >>>> instead. >>>> >>>> The new structure is called struct kvm_s2_mmu. >>>> >>>> There is no intended functional change by this patch alone. >>>> diff --git a/arch/arm64/include/asm/kvm_host.h >>>> b/arch/arm64/include/asm/kvm_host.h >>>> index 7dd8fefa6aecd..664a5d92ae9b8 100644 >>>> --- a/arch/arm64/include/asm/kvm_host.h >>>> +++ b/arch/arm64/include/asm/kvm_host.h >>>> @@ -63,19 +63,32 @@ struct kvm_vmid { >>>> u32 vmid; >>>> }; >>>> >>>> -struct kvm_arch { >>>> +struct kvm_s2_mmu { >>>> struct kvm_vmid vmid; >>>> >>>> - /* stage2 entry level table */ >>>> - pgd_t *pgd; >>>> - phys_addr_t pgd_phys; >>>> - >>>> - /* VTCR_EL2 value for this VM */ >>>> - u64 vtcr; >>>> + /* >>>> + * stage2 entry level table >>>> + * >>>> + * Two kvm_s2_mmu structures in the same VM can point to the same >>>> pgd >>>> + * here. This happens when running a non-VHE guest hypervisor >>>> which >>>> + * uses the canonical stage 2 page table for both vEL2 and for >>>> vEL1/0 >>>> + * with vHCR_EL2.VM == 0. >>> It makes more sense to me to say that a non-VHE guest hypervisor will >>> use the >>> canonical stage *1* page table when running at EL2 >> Can KVM say anything about stage1? Its totally under the the guests >> control even at vEL2... > > It just occurred to me that "canonical stage 2 page table" refers to > the L0 > hypervisor stage 2, not to the L1 hypervisor stage 2. If you don't mind > my > suggestion, perhaps the comment can be slightly improved to avoid any > confusion? > Maybe something along the lines of "[..] This happens when running a > non-VHE guest > hypervisor, in which case we use the canonical stage 2 page table for > both vEL2 > and for vEL1/0 with vHCR_EL2.VM == 0". If the confusion stems from the lack of guest stage-2, how about: "This happens when running a guest using a translation regime that isn't affected by its own stage-2 translation, such as a non-VHE hypervisor running at vEL2, or for vEL1/EL0 with vHCR_EL2.VM == 0. In that case, we use the canonical stage-2 page tables." instead? Does this lift the ambiguity? Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel