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

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


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jane Malalane <jane.malalane@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 14 Feb 2022 15:29:14 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=0DhAdFIRQ7//ueyN6KriKfgTlylAZvihmnGTOEt9kgU=; b=HJkneKkhVppQJm0BZ63/R3F55vpd9i6kGyGZJ3ekE7LTdcbDj/saRYM2acWWVcke3NVPP0a3AwTeMlS2zYje/VpacAev9/y5oh3nzqztgtbLbd5InDIgiP/4okDYOS/DHr1flfkxnP6zMHwBYDHr5j15K6sTv9Ul/c5Db45XZOj0R6XiQWBSJQq/E0Q3jLs5oap5fzWEZ0mFDthKb6/qvQxsaeZ9+cG/SngrE3YcMEgS6vc+GAx4pGhB19TsbtSrt2Wv0MQwvVdoPuImbSIBIJdTBbDuy0T92+WA1ijOVjmjyBxy9gKzfbDB1C/mKIFZ+X3ZRJNdwxcCYB6224lKAw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asbXfbwqwnNaR9QDxNPrtDzF1TLBrXk5UrYpE01kO5OKkSuDgi392zsNWcbvz8HvPrDv/rOgj37Zr0061Z/yKh7Qvknl0Xdce313rAi9Lzisf6MnlbOEWykLDpXbuaqd3sb66Zjqy6z2xHufxnuT1Ba/NWat+tPkh9DWoUmSSnRMYMAIF8nc6QmRwUyQoIyq6ssLqsWrkwlQdwvhZMl2ZKO8M1WqSYUfinupOG1Pfe61jFKK2HSYdULYi1cMTCEvfb7JnYvhnqfbAZ3Apr520Q5m5Lyci+vylP01NlIz1bmT6gpW0L7pIpXMHooRAzTeXRwdHPyNQV35hMQrmJTSPA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, 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>
  • Delivery-date: Mon, 14 Feb 2022 14:29:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.02.2022 17:17, Roger Pau Monné wrote:
> On Mon, Feb 07, 2022 at 06:21:01PM +0000, Jane Malalane wrote:
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -1115,7 +1115,8 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, 
>> uint32_t leaf,
>>          if ( !is_hvm_domain(d) || subleaf != 0 )
>>              break;
>>  
>> -        if ( cpu_has_vmx_apic_reg_virt )
>> +        if ( cpu_has_vmx_apic_reg_virt &&
> 
> You can drop the cpu_has_vmx_apic_reg_virt check here, if
> cpu_has_vmx_apic_reg_virt is false assisted_xapic won't be set to true.

Along these lines ...

>> +             v->domain->arch.hvm.assisted_xapic )
>>              res->a |= XEN_HVM_CPUID_APIC_ACCESS_VIRT;
>>  
>>          /*
>> @@ -1124,9 +1125,8 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, 
>> uint32_t leaf,
>>           * and wrmsr in the guest will run without VMEXITs (see
>>           * vmx_vlapic_msr_changed()).
>>           */
>> -        if ( cpu_has_vmx_virtualize_x2apic_mode &&
>> -             cpu_has_vmx_apic_reg_virt &&
>> -             cpu_has_vmx_virtual_intr_delivery )
>> +        if ( (cpu_has_vmx_apic_reg_virt && 
>> cpu_has_vmx_virtual_intr_delivery) &&
>                 ^ unneeded parentheses

... this also wants simplifying to just v->domain->arch.hvm.assisted_x2apic:
The apparently stray parentheses were, I think, added in reply to me pointing
out that the check here isn't in line with that put in place by patch 1 in
vmx_init_vmcs_config(). I.e. the inner && really was meant to be || as it
looks. Yet once the two are in line, the same simplification as above is
possible.

Jan




 


Rackspace

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