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

Re: [PATCH v4 2/2] x86/xen: Allow per-domain usage of hardware virtualized APIC


  • To: Jane Malalane <jane.malalane@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 3 Mar 2022 13:00:05 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RPCtJp6SsAfzXa1EA1nDQxtaENxARcwoIX5QSmtNeNw=; b=MnljNddUwDbDqWaD0RT+ILYuelkB4yjrScs1PiDOx53yvryG+FfGOJV52E02P2fOlzs8yyC2DI5cZs5bdA6wMtwmWlz4mhuRdPyHbgM6on1HGeghsMeiS3xwTb7Gz6y6fVUGR5SCc5zBCME65FrROX6ws0FYUEqcFKjoYgtkn8aJn8hC+Szsyj9z8sKweoyF1wJMx2mYSX5Mixp2hzox46jyl21+y0aTLxKeCJ7mc/4cab2uUaBP+8ABR9v6PuFUeLDDOoJabdzCATOSLGxN+xwcOz+CjjZh0jj8PCX0shprHGaoVJx2UrQ8OBMie7zc9vTX+pX7iS6lXNOFZUfQEg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KoWUkZfdz00MVBQ+0bsUejQpLsOeZ5BWUMaWnibAU0wVSDXQq+uP4ODcd6pE8Kyoaicej6lRlEICy3U+kZ9EXkhg6Y2zuj8ZbWVS6Ltbokbczcmim+noKyuwUIRB0OxEDHemnzfplScGeu++eS57Ndtu/xB/avd92dD4d4ksY/1FtDHShvt0OM0Hu0OUN6kHfGNfES3q9FTxfTtFi0LmhaZ7G1L8u2yXpQiNZxJZxlDEBAfixE8pBnM3aBHVL5kYbZNN52iB89fMEhXT0MsBNm4XxokjXLtfT0SONJ9FhZpUJoUhfzAzoVZHtjuRPhPH8EvAXljJAvtzlxs2yvmmgQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Christian Lindig <christian.lindig@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 03 Mar 2022 12:00:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 02.03.2022 16:00, Jane Malalane wrote:
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3344,16 +3344,11 @@ static void vmx_install_vlapic_mapping(struct vcpu *v)
>  
>  void vmx_vlapic_msr_changed(struct vcpu *v)
>  {
> -    int virtualize_x2apic_mode;
>      struct vlapic *vlapic = vcpu_vlapic(v);
>      unsigned int msr;
>  
> -    virtualize_x2apic_mode = ( (cpu_has_vmx_apic_reg_virt ||
> -                                cpu_has_vmx_virtual_intr_delivery) &&
> -                               cpu_has_vmx_virtualize_x2apic_mode );
> -
> -    if ( !cpu_has_vmx_virtualize_apic_accesses &&
> -         !virtualize_x2apic_mode )
> +    if ( !has_assisted_xapic(v->domain) &&
> +         !has_assisted_x2apic(v->domain) )
>          return;

This is not an equivalent replacement: The earlier condition was not the
AND of all three sub-features. This is the reason for ...

> @@ -3363,28 +3358,24 @@ void vmx_vlapic_msr_changed(struct vcpu *v)
>      if ( !vlapic_hw_disabled(vlapic) &&
>           (vlapic_base_address(vlapic) == APIC_DEFAULT_PHYS_BASE) )
>      {
> -        if ( virtualize_x2apic_mode && vlapic_x2apic_mode(vlapic) )
> +        if ( has_assisted_x2apic(v->domain) && vlapic_x2apic_mode(vlapic) )
>          {
>              v->arch.hvm.vmx.secondary_exec_control |=
>                  SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
> -            if ( cpu_has_vmx_apic_reg_virt )
> -            {
> -                for ( msr = MSR_X2APIC_FIRST;
> -                      msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
> -                    vmx_clear_msr_intercept(v, msr, VMX_MSR_R);
>  
> -                vmx_set_msr_intercept(v, MSR_X2APIC_PPR, VMX_MSR_R);
> -                vmx_set_msr_intercept(v, MSR_X2APIC_TMICT, VMX_MSR_R);
> -                vmx_set_msr_intercept(v, MSR_X2APIC_TMCCT, VMX_MSR_R);
> -            }
> -            if ( cpu_has_vmx_virtual_intr_delivery )
> -            {
> -                vmx_clear_msr_intercept(v, MSR_X2APIC_TPR, VMX_MSR_W);
> -                vmx_clear_msr_intercept(v, MSR_X2APIC_EOI, VMX_MSR_W);
> -                vmx_clear_msr_intercept(v, MSR_X2APIC_SELF, VMX_MSR_W);
> -            }
> +            for ( msr = MSR_X2APIC_FIRST;
> +                  msr <= MSR_X2APIC_FIRST + 0xff; msr++ )
> +                vmx_clear_msr_intercept(v, msr, VMX_MSR_R);
> +
> +            vmx_set_msr_intercept(v, MSR_X2APIC_PPR, VMX_MSR_R);
> +            vmx_set_msr_intercept(v, MSR_X2APIC_TMICT, VMX_MSR_R);
> +            vmx_set_msr_intercept(v, MSR_X2APIC_TMCCT, VMX_MSR_R);
> +
> +            vmx_clear_msr_intercept(v, MSR_X2APIC_TPR, VMX_MSR_W);
> +            vmx_clear_msr_intercept(v, MSR_X2APIC_EOI, VMX_MSR_W);
> +            vmx_clear_msr_intercept(v, MSR_X2APIC_SELF, VMX_MSR_W);
>          }

... you wanting to make these adjustments, but at the same time it means
with certain feature combinations we would now intercept all x2APIC MSR
accesses when some don't need intercepting, which may slow things down
for guests.

Just to be clear - the main part of the discussion imo continues to be
needed on patch 1, to sort what dependencies on features we want where.
One that's clear, what's wanted here should be mostly straightforward.

Jan




 


Rackspace

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