public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "He, Qing" <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] vmx: enable io bitmaps to avoid IO port 0x80 VMEXITs
Date: Sun, 29 Apr 2007 11:40:46 +0300	[thread overview]
Message-ID: <46345A0E.3060608@qumranet.com> (raw)
In-Reply-To: <37E52D09333DE2469A03574C88DBF40F048D9E-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>

He, Qing wrote:
> This patch enables IO bitmaps control on vmx and unmask the 0x80 port to
> avoid VMEXITs caused by accessing port 0x80. 0x80 is used as delays (see
> include/asm/io.h), and handling VMEXITs on its access is unnecessary but
> slows things down. This patch improves kernel build test at around
> 3%~5%.
>   

It's quite surprising to see such a large speedup!


> +
>  #ifdef CONFIG_X86_64
>  #define HOST_IS_64 1
>  #else
> @@ -1127,8 +1129,8 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
>  	vmcs_write32(GUEST_PENDING_DBG_EXCEPTIONS, 0);
>  
>  	/* I/O */
> -	vmcs_write64(IO_BITMAP_A, 0);
> -	vmcs_write64(IO_BITMAP_B, 0);
> +	vmcs_write64(IO_BITMAP_A, (unsigned long) __pa(vmx_io_bitmap));
> +	vmcs_write64(IO_BITMAP_B, (unsigned long) __pa(vmx_io_bitmap +
> PAGE_SIZE));
>   

Unnecessary casts.

> +	r = kvm_init_arch(&vmx_arch_ops, THIS_MODULE);
> +	if (r) {
> +		goto out1;
> +	}
>   

No braces around single statements in kernel code, please.

> +
> +	return 0;
> +
> +out1:
> +	free_pages((unsigned long) vmx_io_bitmap, 1);
> +out:
> +	return r;
>  }
>  
>  static void __exit vmx_exit(void)
>  {
> +	if (vmx_io_bitmap)
> +		free_pages((unsigned long) vmx_io_bitmap, 1);
>   

The if is unnecessary, since we can't get here with a NULL vmx_io_bitmap 
(also free_pages() checks for NULL).

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-04-29  8:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-29  5:33 [PATCH] vmx: enable io bitmaps to avoid IO port 0x80 VMEXITs He, Qing
     [not found] ` <37E52D09333DE2469A03574C88DBF40F048D9E-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-04-29  6:35   ` Neo Jia
     [not found]     ` <5d649bdb0704282335h2ac4ac8cn77b2b32366cd7015-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-04-29  6:55       ` He, Qing
2007-04-29  8:40   ` Avi Kivity [this message]
2007-04-29  9:23   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46345A0E.3060608@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox