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

Re: [Xen-devel] [PATCH] HAP: Add global enable/disable command line option



>>> On 25.01.13 at 18:48, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
> Also, correct a copy&paste error in the documentation.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> ---
> 
> This patch has been in the XenServer patch queue for a long time.  It is 
> more
> for debugging purposes than anything else, but is still proving to be 
> valuable
> for tracking down bugs with HVM paging operations.
> 
> diff -r 5af4f2ab06f3 -r e6ec5b2b717f docs/misc/xen-command-line.markdown
> --- a/docs/misc/xen-command-line.markdown
> +++ b/docs/misc/xen-command-line.markdown
> @@ -521,6 +521,14 @@ more importance will be printed.
>  The optional `<rate-limited level>` option instructs which severities
>  should be rate limited.
>  
> +### hap
> +> `= <boolean>`
> +
> +> Default: `true`
> +
> +Flag to globally enable or disable support for Hardware Assisted
> +Paging (HAP)
> +
>  ### hap\_1gb
>  > `= <boolean>`
>  
> @@ -534,7 +542,7 @@ Paging (HAP).
>  
>  > Default: `true`
>  
> -Flag to enable 1 GB host page table support for Hardware Assisted
> +Flag to enable 2 MB host page table support for Hardware Assisted
>  Paging (HAP).
>  
>  ### hpetbroadcast
> diff -r 5af4f2ab06f3 -r e6ec5b2b717f xen/arch/x86/hvm/hvm.c
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -78,6 +78,10 @@ struct hvm_function_table hvm_funcs __re
>  unsigned long __attribute__ ((__section__ (".bss.page_aligned")))
>      hvm_io_bitmap[3*PAGE_SIZE/BYTES_PER_LONG];
>  
> +/* Xen command-line option to enable HAP */
> +static int opt_hap_enabled = 1;

bool_t __initdata

> +boolean_param("hap", opt_hap_enabled);
> +
>  static int cpu_callback(
>      struct notifier_block *nfb, unsigned long action, void *hcpu)
>  {
> @@ -125,14 +129,23 @@ static int __init hvm_enable(void)
>      printk("HVM: %s enabled\n", hvm_funcs.name);
>      if ( hvm_funcs.hap_supported )
>      {
> -        printk("HVM: Hardware Assisted Paging (HAP) detected\n");
> -        printk("HVM: HAP page sizes: 4kB");
> -        if ( hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_2MB )
> -            printk(", 2MB%s", opt_hap_2mb ? "" : " [disabled]");
> -        if ( hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_1GB )
> -            printk(", 1GB%s", opt_hap_1gb ? "" : " [disabled]");
> -        printk("\n");
> +        hvm_funcs.hap_supported = hvm_funcs.hap_supported && opt_hap_enabled;
> +
> +        if ( hvm_funcs.hap_supported )
> +        {
> +            printk("HVM: Hardware Assisted Paging (HAP) detected\n");
> +            printk("HVM: HAP page sizes: 4kB");
> +            if ( hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_2MB )
> +                printk(", 2MB%s", opt_hap_2mb ? "" : " [disabled]");
> +            if ( hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_1GB )
> +                printk(", 1GB%s", opt_hap_1gb ? "" : " [disabled]");
> +            printk("\n");
> +        }
> +        else
> +            printk("HVM: Hardware Assisted Paging (HAP) detected but 
> disabled\n");
>      }
> +    else
> +        printk("HVM: Hardware Assisted Paging (HAP) not detected\n");

Also, with a suitable if/else-if sequence you could reduce the
churn (and the level of indentation):

    if ( !hvm_funcs.hap_supported )
    ...
    else if ( !opt_hap_enabled )
    ...
    else

Jan

>  
>      /*
>       * Allow direct access to the PC debug ports 0x80 and 0xed (they are




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


 


Rackspace

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