Re: [PATCH v3 20/21] KVM: arm64: Remove unused 'pgd' field from 'struct kvm_s2_mmu'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-09-04 01:59, Gavin Shan wrote:
Hi Will,

On 9/4/20 2:50 AM, Will Deacon wrote:
On Thu, Sep 03, 2020 at 03:07:17PM +1000, Gavin Shan wrote:
On 8/25/20 7:39 PM, Will Deacon wrote:
The stage-2 page-tables are entirely encapsulated by the 'pgt' field of
'struct kvm_s2_mmu', so remove the unused 'pgd' field.

Cc: Marc Zyngier <maz@xxxxxxxxxx>
Cc: Quentin Perret <qperret@xxxxxxxxxx>
Signed-off-by: Will Deacon <will@xxxxxxxxxx>
---
   arch/arm64/include/asm/kvm_host.h | 1 -
   arch/arm64/kvm/mmu.c              | 2 --
   2 files changed, 3 deletions(-)


I think this might be folded into PATCH[18] as both patches are
simple enough. I'm not sure the changes introduced in PATCH[19]
prevent us doing this.

There is another question below.

Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>

diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 0b7c702b2151..41caf29bd93c 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -79,7 +79,6 @@ struct kvm_s2_mmu {
   	 * for vEL1/EL0 with vHCR_EL2.VM == 0.  In that case, we use the
   	 * canonical stage-2 page tables.
   	 */
-	pgd_t		*pgd;
   	phys_addr_t	pgd_phys;
   	struct kvm_pgtable *pgt;
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index ddeec0b03666..f28e03dcb897 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -384,7 +384,6 @@ int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu)
   	mmu->kvm = kvm;
   	mmu->pgt = pgt;
   	mmu->pgd_phys = __pa(pgt->pgd);
-	mmu->pgd = (void *)pgt->pgd;
   	mmu->vmid.vmid_gen = 0;
   	return 0;
@@ -470,7 +469,6 @@ void kvm_free_stage2_pgd(struct kvm_s2_mmu *mmu)
   	spin_lock(&kvm->mmu_lock);
   	pgt = mmu->pgt;
   	if (pgt) {
-		mmu->pgd = NULL;
   		mmu->pgd_phys = 0;
   		mmu->pgt = NULL;
   		free_percpu(mmu->last_vcpu_ran);


I guess mmu->pgd_phys might be removed either because kvm_get_vttbr()
is the only consumer.

Hmm, but kvm_get_vttbr() is still used after these patches, so I think
the pgd_phys field needs to stick around.


Yes, kvm_get_vttbr() is the only consumer. The corresponding physical
address can be figured out in the function, we needn't have the physical address and cache it in advance. However, it's not a big deal. I probably
post one patch to remove it after this series gets merged.

   baddr = __pa(mmu->pgt->pgd);

I'd rather you didn't. The NV patches need it for the AT emulation code,
so it might as well stay in place.

Thanks,

         M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux