Re: [PATCH 11/23] KVM: PPC: Book3S PR: Allocate kvm_vcpu structs from kvm_vcpu_cache

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

 



Paul Mackerras <paulus@xxxxxxxxx> writes:

> This makes PR KVM allocate its kvm_vcpu structs from the kvm_vcpu_cache
> rather than having them embedded in the kvmppc_vcpu_book3s struct,
> which is allocated with vzalloc.  The reason is to reduce the
> differences between PR and HV KVM in order to make is easier to have
> them coexist in one kernel binary.
>
> With this, the kvm_vcpu struct has a pointer to the kvmppc_vcpu_book3s
> struct.  The pointer to the kvmppc_book3s_shadow_vcpu struct has moved
> from the kvmppc_vcpu_book3s struct to the kvm_vcpu struct.
>
> Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>
> ---
>  arch/powerpc/include/asm/kvm_book3s.h    |  4 +---
>  arch/powerpc/include/asm/kvm_book3s_32.h |  2 +-
>  arch/powerpc/include/asm/kvm_host.h      |  5 +++++
>  arch/powerpc/kvm/book3s_32_mmu.c         |  8 ++++----
>  arch/powerpc/kvm/book3s_64_mmu.c         | 11 +++++------
>  arch/powerpc/kvm/book3s_pr.c             | 29 ++++++++++++++++++-----------
>  6 files changed, 34 insertions(+), 25 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index 322b539..1b32f6c 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -70,8 +70,6 @@ struct hpte_cache {
>  };
>  
>  struct kvmppc_vcpu_book3s {
> -	struct kvm_vcpu vcpu;
> -	struct kvmppc_book3s_shadow_vcpu *shadow_vcpu;
>  	struct kvmppc_sid_map sid_map[SID_MAP_NUM];
>  	struct {
>  		u64 esid;
> @@ -192,7 +190,7 @@ extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
>  
>  static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu)
>  {
> -	return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu);
> +	return vcpu->arch.book3s;
>  }
>  
>  extern void kvm_return_point(void);
> diff --git a/arch/powerpc/include/asm/kvm_book3s_32.h b/arch/powerpc/include/asm/kvm_book3s_32.h
> index ce0ef6c..c720e0b 100644
> --- a/arch/powerpc/include/asm/kvm_book3s_32.h
> +++ b/arch/powerpc/include/asm/kvm_book3s_32.h
> @@ -22,7 +22,7 @@
>  
>  static inline struct kvmppc_book3s_shadow_vcpu *svcpu_get(struct kvm_vcpu *vcpu)
>  {
> -	return to_book3s(vcpu)->shadow_vcpu;
> +	return vcpu->arch.shadow_vcpu;
>  }
>  
>  static inline void svcpu_put(struct kvmppc_book3s_shadow_vcpu *svcpu)
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index c37207f..4d83972 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -91,6 +91,9 @@ struct lppaca;
>  struct slb_shadow;
>  struct dtl_entry;
>  
> +struct kvmppc_vcpu_book3s;
> +struct kvmppc_book3s_shadow_vcpu;
> +
>  struct kvm_vm_stat {
>  	u32 remote_tlb_flush;
>  };
> @@ -409,6 +412,8 @@ struct kvm_vcpu_arch {
>  	int slb_max;		/* 1 + index of last valid entry in slb[] */
>  	int slb_nr;		/* total number of entries in SLB */
>  	struct kvmppc_mmu mmu;
> +	struct kvmppc_vcpu_book3s *book3s;
> +	struct kvmppc_book3s_shadow_vcpu *shadow_vcpu;
>  #endif

can the *shadow_vcpu be within  #ifdef CONFIG_PPC_BOOK3S_32 ? Rest of
the code access the variable under  #ifdef CONFIG_PPC_BOOK3S_32



-aneesh

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux