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

Re: [Xen-devel] [PATCH 2/2] x86/shadow: Move shadow pagetable fields into struct shadow_vcpu



>>> On 30.01.17 at 18:26, <andrew.cooper3@xxxxxxxxxx> wrote:
> @@ -1680,7 +1688,7 @@ static mfn_t emulate_gva_to_mfn(struct vcpu *v, 
> unsigned long vaddr,
>      mfn = page_to_mfn(page);
>      ASSERT(mfn_valid(mfn));
>  
> -    v->arch.paging.last_write_was_pt = !!sh_mfn_is_a_page_table(mfn);
> +    v->arch.paging.shadow.last_write_was_pt = !!sh_mfn_is_a_page_table(mfn);

Please drop the now unnecessary !! (and use true/false instead of
1/0 in other places).

> @@ -797,15 +797,15 @@ static inline unsigned long vtlb_lookup(struct vcpu *v,
>      unsigned long frame_number = gfn_x(INVALID_GFN);
>      int i = vtlb_hash(page_number);
>  
> -    spin_lock(&v->arch.paging.vtlb_lock);
> -    if ( v->arch.paging.vtlb[i].pfec != 0
> -         && v->arch.paging.vtlb[i].page_number == page_number
> +    spin_lock(&v->arch.paging.shadow.vtlb_lock);
> +    if ( v->arch.paging.shadow.vtlb[i].pfec != 0
> +         && v->arch.paging.shadow.vtlb[i].page_number == page_number
>           /* Any successful walk that had at least these pfec bits is OK */
> -         && (v->arch.paging.vtlb[i].pfec & pfec) == pfec )
> +         && (v->arch.paging.shadow.vtlb[i].pfec & pfec) == pfec )
>      {
> -        frame_number = v->arch.paging.vtlb[i].frame_number;
> +        frame_number = v->arch.paging.shadow.vtlb[i].frame_number;
>      }
> -    spin_unlock(&v->arch.paging.vtlb_lock);
> +    spin_unlock(&v->arch.paging.shadow.vtlb_lock);
>      return frame_number;
>  }

Since you need to touch all these vtlb_lock accessing lines anyway,
would it perhaps make sense to switch to an r/w lock at once?

> --- a/xen/include/asm-x86/domain.h
> +++ b/xen/include/asm-x86/domain.h
> @@ -147,7 +147,16 @@ struct shadow_vcpu {
>          unsigned long off[SHADOW_OOS_FIXUPS];
>      } oos_fixup[SHADOW_OOS_PAGES];
>  
> -    bool_t pagetable_dying;
> +    /* Translated guest: virtual TLB */
> +    struct shadow_vtlb *vtlb;
> +    spinlock_t          vtlb_lock;
> +
> +    /* HVM guest: last emulate was to a pagetable */
> +    bool last_write_was_pt;
> +    /* HVM guest: last write emulation succeeds */
> +    bool last_write_emul_ok;
> +
> +    bool pagetable_dying;

Perhaps make all of these bools bit fields?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.