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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jane Malalane <Jane.Malalane@xxxxxxxxxx>
  • Date: Wed, 9 Mar 2022 17:02:07 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=k6ztCehjza+bcXw/T2UboJZpoS3IioKINFvKfcxm1RE=; b=PeS7ZlN7XGI74Rzjh4diF/q1iyxpJZCViGRjeR3p44tu9kIGX1XCHD4h78g+ayvuJQbnWmPKLRIjxDWhN3/mMkkwfSpOBDCOHB7I5hIWpFwgMLP97CK4XTJnElHNLC0n8DFrVPn3dTCVAFUpq5mOQmCIj8PA1oIs5nZ+pRRQhiklGOvCtmodKzIVXZ/bJTgCfxUXLRO4gqDuBoPm+m1QKpCellEnknTFVYqbhVFf6lpBLGQOi7Mt0j5HNHsVmPnQ6Sn27Q5p1WlT+0SfWpMN3aeRluvGnlXpCXPuRelqkuaoexiSAE6QdhBJ6MkWcLmiv6IXUSwFvgzN+dn/PIjfUA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NbyAfnltEMh0Qg/HZyZaGgmvbgEChxFZFhPwAs6aUKT3a+05gMvrTTyNsfT1pPdW4BWXxgdd41dFkIjc/tN1qdyK/GRFx2eftrgu/sAfFVuZ3XpyNFadJD1W1mGdI3P5UuOVjmDHfmuN9kVN/sAiNTxhaQq0+AXwsXc1zyNax7c9GrgA9Y6ZJvK3YxoeORfIrQnGVJW/6iKztbpT2S2Ay0Cz0oPG50ZMX1eJR11g3YzTrRLtsOYpoivNW4G4lR33QIkT10YT3usFJvpk91QVXWL+ws1MPTaKX2mZyTDTp+9098Vn5otcdWITedhamGD+YO4l+OEEotas04CZmE9DNA==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.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>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 09 Mar 2022 17:02:37 +0000
  • Ironport-data: A9a23:bsseNKnJeIAJO2wKAEZhw/To5gx5JkRdPkR7XQ2eYbSJt1+Wr1Gzt xIXCjqFM/mPYzahe9wkOoW+900CusOGydc3TQU9qSlnRiMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EoLd9IR2NYy24DiW1LV4 7senuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYEFwLboOTxbgnVgBDHhwuMoh8+7TqPi3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD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vUi3NPAhiYwGsnayvqLvWJTo9QzI34giHij2lrJTgFQKD4xsYWzRThZ8/7G nsiWXCl+WemsD+7iWZ+37Y7pxQltek4MBEHtawhs8cLSipohq0Zb5mR6aJsFkO0aKSARcR4Z vxSiUbToBOAkDqDyaISNzWqk/dOQMVmjrfIJmj8CLeSILCNWoH4oF69Pxkm1PimjsdVZdHof h2NiuixupqJAKFkyLn69fSURZ20kKyvHo5iOYWy2dSSI0EddZq3MciFW5uYd499RjBmcga+S hVfbXhzecTdUnfY2HSv2FpztDpVnMvHg2eSkxHvsCOyTBZkH1w0kNdnaUk7zo93YN4T4MB6/ XPM6xumr0LRsgKbbhlDONERcesEGTCTR/FLWrXK1X6E6MMPW7LtvfMkf8IzfDvfIZNwIo5mZ zHXl8dvWkue1j2AcnLx5FP+gClehTKYd0s8LAo23FUgMyPeFOwC1zxdLkHqbrUn8ki
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYMjUEaMoAwzVpzE69n4F8Ciyydqy1XcmAgAAMr4CAAAJqgIAAIRgAgAAC1QCAAadGgIAAD0GAgAADBgA=
  • Thread-topic: [PATCH v5 2/2] x86/xen: Allow per-domain usage of hardware virtualized APIC

On 09/03/2022 16:51, Jan Beulich wrote:
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments 
> unless you have verified the sender and know the content is safe.
> 
> On 09.03.2022 16:56, Jane Malalane wrote:
>> On 08/03/2022 14:41, Jan Beulich wrote:
>>> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open attachments 
>>> unless you have verified the sender and know the content is safe.
>>>
>>> On 08.03.2022 15:31, Jane Malalane wrote:
>>>> On 08/03/2022 12:33, Roger Pau Monné wrote:
>>>>> On Tue, Mar 08, 2022 at 01:24:23PM +0100, Jan Beulich wrote:
>>>>>> On 08.03.2022 12:38, Roger Pau Monné wrote:
>>>>>>> On Mon, Mar 07, 2022 at 03:06:09PM +0000, Jane Malalane wrote:
>>>>>>>> @@ -685,13 +687,31 @@ int arch_sanitise_domain_config(struct 
>>>>>>>> xen_domctl_createdomain *config)
>>>>>>>>             }
>>>>>>>>         }
>>>>>>>>     
>>>>>>>> -    if ( config->arch.misc_flags & ~XEN_X86_MSR_RELAXED )
>>>>>>>> +    if ( config->arch.misc_flags & ~(XEN_X86_MSR_RELAXED |
>>>>>>>> +                                     XEN_X86_ASSISTED_XAPIC |
>>>>>>>> +                                     XEN_X86_ASSISTED_X2APIC) )
>>>>>>>>         {
>>>>>>>>             dprintk(XENLOG_INFO, "Invalid arch misc flags %#x\n",
>>>>>>>>                     config->arch.misc_flags);
>>>>>>>>             return -EINVAL;
>>>>>>>>         }
>>>>>>>>     
>>>>>>>> +    if ( (assisted_xapic || assisted_x2apic) && !hvm )
>>>>>>>> +    {
>>>>>>>> +        dprintk(XENLOG_INFO,
>>>>>>>> +                "Interrupt Controller Virtualization not supported 
>>>>>>>> for PV\n");
>>>>>>>> +        return -EINVAL;
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    if ( (assisted_xapic && !assisted_xapic_available) ||
>>>>>>>> +         (assisted_x2apic && !assisted_x2apic_available) )
>>>>>>>> +    {
>>>>>>>> +        dprintk(XENLOG_INFO,
>>>>>>>> +                "Hardware assisted x%sAPIC requested but not 
>>>>>>>> available\n",
>>>>>>>> +                assisted_xapic && !assisted_xapic_available ? "" : 
>>>>>>>> "2");
>>>>>>>> +        return -EINVAL;
>>>>>>>
>>>>>>> I think for those two you could return -ENODEV if others agree.
>>>>>>
>>>>>> If by "two" you mean the xAPIC and x2APIC aspects here (and not e.g. this
>>>>>> and the earlier if()), then I agree. I'm always in favor of using 
>>>>>> distinct
>>>>>> error codes when possible and at least halfway sensible.
>>>>>
>>>>> I would be fine by using it for the !hvm if also. IMO it makes sense
>>>>> as PV doesn't have an APIC 'device' at all, so ENODEV would seem
>>>>> fitting. EINVAL is also fine as the caller shouldn't even attempt that
>>>>> in the first place.
>>>>>
>>>>> So let's use it for the last if only.
>>>> Wouldn't it make more sense to use -ENODEV particularly for the first? I
>>>> agree that -ENODEV should be reported in the first case because it
>>>> doesn't make sense to request acceleration of something that doesn't
>>>> exist and I should have put that. But having a look at the hap code
>>>> (since it resembles the second case), it returns -EINVAL when it is not
>>>> available, unless you deem this to be different or, in retrospective,
>>>> that the hap code should too have been coded to return -ENODEV.
>>>>
>>>> if ( hap && !hvm_hap_supported() )
>>>>        {
>>>>            dprintk(XENLOG_INFO, "HAP requested but not available\n");
>>>>            return -EINVAL;
>>>>        }
>>>
>>> This is just one of the examples where using -ENODEV as you suggest
>>> would introduce an inconsistency. We use -EINVAL also for other
>>> purely guest-type dependent checks.
>>>
>>> Jan
>> Hi Jan, so here I was comparing the hap implementation with the second
>> case, i.e.
>>
>> if ( (assisted_xapic && !assisted_xapic_available) ||
>>        (assisted_x2apic && !assisted_x2apic_available) )
>>
>> and you seem to agree that using -ENODEV would be inconsistent? Have I
>> misinterpreted this?
> 
> Not exactly. I'm comparing existing hap / hvm / !hap / !hvm uses with
> what you add.
> 
> Jan
> 
Okay, I wil swap the error codes then, thank you.

Jane.

 


Rackspace

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