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

Re: [Xen-devel] [PATCH for 4.9 2/6] x86/hvm: Correct long mode predicate



>>> On 31.03.17 at 21:50, <andrew.cooper3@xxxxxxxxxx> wrote:
> @@ -1154,13 +1154,13 @@ static void virtual_vmentry(struct cpu_user_regs 
> *regs)
>      /*
>       * EFER handling:
>       * hvm_set_efer won't work if CR0.PG = 1, so we change the value
> -     * directly to make hvm_long_mode_enabled(v) work in L2.
> +     * directly to make hvm_long_mode_active(v) work in L2.
>       * An additional update_paging_modes is also needed if
>       * there is 32/64 switch. v->arch.hvm_vcpu.guest_efer doesn't
>       * need to be saved, since its value on vmexit is determined by
>       * L1 exit_controls
>       */
> -    lm_l1 = !!hvm_long_mode_enabled(v);
> +    lm_l1 = !!hvm_long_mode_active(v);

Mind dropping the now stray !! here and ...

> @@ -1359,7 +1359,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
>      nvcpu->nv_vmexit_pending = 0;
>      nvcpu->nv_vmswitch_in_progress = 1;
>  
> -    lm_l2 = !!hvm_long_mode_enabled(v);
> +    lm_l2 = !!hvm_long_mode_active(v);

... here?

> --- a/xen/arch/x86/mm/hap/hap.c
> +++ b/xen/arch/x86/mm/hap/hap.c
> @@ -690,10 +690,10 @@ static void hap_update_cr3(struct vcpu *v, int 
> do_locking)
>  const struct paging_mode *
>  hap_paging_get_mode(struct vcpu *v)
>  {
> -    return !hvm_paging_enabled(v)   ? &hap_paging_real_mode :
> -        hvm_long_mode_enabled(v) ? &hap_paging_long_mode :
> -        hvm_pae_enabled(v)       ? &hap_paging_pae_mode  :
> -                                   &hap_paging_protected_mode;
> +    return !hvm_paging_enabled(v) ? &hap_paging_real_mode :
> +        hvm_long_mode_active(v)   ? &hap_paging_long_mode :
> +        hvm_pae_enabled(v)        ? &hap_paging_pae_mode  :
> +                                    &hap_paging_protected_mode;

If you fiddle with alignment of fields here already, I think it would
be nice if you also made the control expressions align:

    return !hvm_paging_enabled(v)  ? &hap_paging_real_mode :
           hvm_long_mode_active(v) ? &hap_paging_long_mode :
           hvm_pae_enabled(v)      ? &hap_paging_pae_mode  :
                                     &hap_paging_protected_mode;

With that
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

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®.