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

Re: [Xen-devel] [PATCH 01/16] VMX: reduce number of posted-interrupt hooks


  • To: Jan Beulich <JBeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Thu, 19 Jul 2018 01:51:15 +0000
  • Accept-language: en-US
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>
  • Delivery-date: Thu, 19 Jul 2018 01:51:56 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.0.200.100
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHUGRpZfqAVQjCJ6UWM5SGKM+Y0eKSV0zTg
  • Thread-topic: [PATCH 01/16] VMX: reduce number of posted-interrupt hooks

> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: Wednesday, July 11, 2018 9:23 PM
> 
> Three of the four hooks are not exposed outside of vmx.c, and all of
> them have only a single possible non-NULL value. So there's no reason to
> use hooks here - a simple set of flag indicators is sufficient (and we
> don't even need a flag for the VM entry one, as it's always
> (de-)activated together the the vCPU blocking hook, which needs to
> remain an actual function pointer). This is the more that with the
> Spectre v2 workarounds indirect calls have become more expensive.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -78,6 +78,10 @@ static int vmx_msr_write_intercept(unsig
>  static void vmx_invlpg(struct vcpu *v, unsigned long vaddr);
>  static int vmx_vmfunc_intercept(struct cpu_user_regs *regs);
> 
> +/* Values for domain's ->arch.hvm_domain.pi_ops.flags. */
> +#define PI_CSW_FROM (1u << 0)
> +#define PI_CSW_TO   (1u << 1)
> +
>  struct vmx_pi_blocking_vcpu {
>      struct list_head     list;
>      spinlock_t           lock;
> @@ -330,8 +334,7 @@ void vmx_pi_hooks_assign(struct domain *
>       * This can make sure the PI (especially the NDST feild) is
>       * in proper state when we call vmx_vcpu_block().
>       */
> -    d->arch.hvm_domain.pi_ops.switch_from = vmx_pi_switch_from;
> -    d->arch.hvm_domain.pi_ops.switch_to = vmx_pi_switch_to;
> +    d->arch.hvm_domain.pi_ops.flags = PI_CSW_FROM | PI_CSW_TO;
> 
>      for_each_vcpu ( d, v )
>      {
> @@ -347,7 +350,6 @@ void vmx_pi_hooks_assign(struct domain *
>      }
> 
>      d->arch.hvm_domain.pi_ops.vcpu_block = vmx_vcpu_block;
> -    d->arch.hvm_domain.pi_ops.do_resume = vmx_pi_do_resume;
>  }
> 
>  /* This function is called when pcidevs_lock is held */
> @@ -384,8 +386,7 @@ void vmx_pi_hooks_deassign(struct domain
>       * 'switch_to' hook function.
>       */
>      d->arch.hvm_domain.pi_ops.vcpu_block = NULL;
> -    d->arch.hvm_domain.pi_ops.switch_from = NULL;
> -    d->arch.hvm_domain.pi_ops.do_resume = NULL;
> +    d->arch.hvm_domain.pi_ops.flags = PI_CSW_FROM;

Doesn't it bring functional change ('from' hook was cleared but now
you still get the flag set)?

Thanks
Kevin

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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