public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Yang, Sheng" <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] Enable memory mapped TPR shadow(FlexPriority)
Date: Wed, 24 Oct 2007 11:10:10 +0200	[thread overview]
Message-ID: <471F0BF2.3040901@qumranet.com> (raw)
In-Reply-To: <DB3BD37E3533EE46BED2FBA80995557F9BE63D-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>

Yang, Sheng wrote:
> >From ac4dd1782b9f0f51e0c366a1b8db4515d6828df8 Mon Sep 17 00:00:00 2001
> From: Sheng Yang <sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Date: Tue, 23 Oct 2007 12:34:42 +0800
> Subject: [PATCH] Enable memory mapped TPR shadow(FlexPriority)
>
> This patch based on CR8/TPR patch before, and enable the TPR
> shadow(FlexPriority) for 32bit Windows. Since TPR is accessed
> very frequently by 32bit Windows, especially SMP guest, with
> FlexPriority enabled, we saw significant performance gain.
>   

For the benefit of users, can you detail which processors have this feature?

>  
>  static inline struct kvm_pic *pic_irqchip(struct kvm *kvm)
> @@ -503,6 +504,11 @@ void kvm_mmu_slot_remove_write_access(struct kvm
> *kvm, int slot);
>  void kvm_mmu_zap_all(struct kvm *kvm);
>  void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int
> kvm_nr_mmu_pages);
>  
> +int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
> +				  struct
> +				  kvm_userspace_memory_region *mem,
> +				  int user_alloc);
> +
>   

Exporting an ioctl handler isn't very pretty.  Izik is working on a 
patch that also requires an internal memory slot, so he will add an API 
for it.

> --- a/drivers/kvm/kvm_main.c
> +++ b/drivers/kvm/kvm_main.c
> @@ -643,10 +643,10 @@ EXPORT_SYMBOL_GPL(fx_init);
>   *
>   * Discontiguous memory is allowed, mostly for framebuffers.
>   */
> -static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
> -					  struct
> -					  kvm_userspace_memory_region
> *mem,
> -					  int user_alloc)
> +int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
> +				  struct
> +				  kvm_userspace_memory_region *mem,
> +				  int user_alloc)
>  {
>  	int r;
>  	gfn_t base_gfn;
> @@ -776,6 +776,7 @@ out_unlock:
>  out:
>  	return r;
>  }
> +EXPORT_SYMBOL_GPL(kvm_vm_ioctl_set_memory_region);
>   

The internal memory slot needs to be hidden from userspace.  Hopefully 
Izik's API will add that too.

> +
> +	/* For APIC access vmexit */
> +	if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE)
> +		goto mmio;
>   

What if the guest changes the apic base address?

> @@ -1610,13 +1675,15 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
>  
>  	vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0);  /* 22.2.1 */
>  
> -#ifdef CONFIG_X86_64
>  	vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, 0);
>   

I think the #ifdef is for a reason... probably Core processors which 
don't support x86_64 (and therefore cr8) don't have this.

Please check.

>  /*
>   * Interruption-information format
> diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
> index f858c01..d24166e 100644
> --- a/drivers/kvm/x86_emulate.c
> +++ b/drivers/kvm/x86_emulate.c
> @@ -845,6 +845,11 @@ modrm_done:
>  			c->src.type = OP_REG;
>  			break;
>  		}
> +		if (((ctxt->cmd_type & EMULCMD_DECODE_ADDR) != 0) &&
> +		    (c->modrm_ea == 0)) {
> +			ctxt->cr2 = insn_fetch(u32, c->src.bytes,
> c->eip);
> +			c->eip -= c->src.bytes;
> +		}
>   

Please explain this.  Is this for mov eax, abs?  If so, it's much 
needed, and should be in a separate patch.  I don't think 
EMULCMD_DECODE_ADDR is necessary.

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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

  parent reply	other threads:[~2007-10-24  9:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24  2:55 [PATCH] Enable memory mapped TPR shadow(FlexPriority) Yang, Sheng
     [not found] ` <DB3BD37E3533EE46BED2FBA80995557F9BE63D-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-24  9:10   ` Avi Kivity [this message]
     [not found]     ` <471F0BF2.3040901-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-24 10:02       ` Yang, Sheng
     [not found]         ` <DB3BD37E3533EE46BED2FBA80995557F9BE830-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-25 18:55           ` Avi Kivity
2007-10-24 12:48   ` Izik Eidus
  -- strict thread matches above, loose matches on Subject: below --
2007-10-24  3:01 Yang, Sheng
     [not found] ` <DB3BD37E3533EE46BED2FBA80995557F9BE64A-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-24  9:13   ` Avi Kivity
     [not found]     ` <471F0CCA.7060108-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-24 10:02       ` Yang, Sheng
     [not found]         ` <DB3BD37E3533EE46BED2FBA80995557F9BE831-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-24 10:15           ` Avi Kivity
     [not found]             ` <471F1B4A.8070600-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-24 10:18               ` Yang, Sheng
     [not found]                 ` <DB3BD37E3533EE46BED2FBA80995557F9BE834-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-24 10:19                   ` Avi Kivity
     [not found]                     ` <471F1C49.4010609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-24 13:08                       ` Yang, Sheng
     [not found]                         ` <DB3BD37E3533EE46BED2FBA80995557F9BE84F-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-24 13:16                           ` 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=471F0BF2.3040901@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=sheng.yang-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