[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: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Jane Malalane <Jane.Malalane@xxxxxxxxxx>
  • Date: Tue, 8 Mar 2022 14:31:31 +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=5fPvnwHyyFCD4wNyDl2CbyychIUceVDLqAVs7pZXZ1A=; b=NYskjZ+T21KYuJ9dG1va/uJCmrcVaWoSAeGLIbWwR83dcQTOF1BmWNjkl1n9pmYVjWLA7L5B8I8p4pkjuzFrYSm7voUJfiq90xPPX4hW+17jth9ehia/sDpOK4c0M0Gy9e3kDmBAFiRLE+qHd8b49GXcTIHEmVduH3sZlvLOj5IY87zJ9IiMiemrw0hgmsm5J0TCSDs/RyPpGxadL9RSOmWVTSSBkYlog+FjxFXJJAYEtHI4ePb+Yitf1fT8RPtuq+NRoSRn9D8c14oSWUy8TYfUx3ib7VTKqsHQSjV0w0BYqm4ystzY7FSdksxddhtIx8nhTjeUim2feWSqYassyw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yi5HuH5UMk6s3usnOeHigcQu+FNB3kyptKhYH3eZrAIOXRFBXfWqMwdumwwkFGqRt8l+nbo2MRLA4GCTmAjK2yAIVmhXaCdO5/AbUWGnPEEudCxxrPKiL0xI3ABuvSuUZnLGkwSsMyQM7lJt3vw+oSOkPjo+dLK4OFjmm0arNFnreyZnvEq/CxdBgndYgdYAGSd1ga3Q8NvvgX6T2d93tyKKQQqFxPMfRHJMoXNgL4lEzU8WZqChI3dyUIoqi3tM9hkYIWlr6lNDQqBfmhDJK7SSF3b7FcMEx8PhsvW47pCKAYaVD/QqRtrTjUq9FZtrNOICVc3UQWjJCX1jY1MNcg==
  • Authentication-results: esa6.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>
  • Delivery-date: Tue, 08 Mar 2022 14:31:46 +0000
  • Ironport-data: A9a23:2GvGFaivVyoPXlr+J/7ZhqhqX161mBAKZh0ujC45NGQN5FlHY01je htvUGiDM6zYZ2DzLtEgaYy38RhUu8Pcz9YwTFNuqi8wEnwb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M78wIFqtQw24LhWFvd4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YQQgF4LUqOUtaEgCMChDHJVh1/zNPEHq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883azPL+GyVG8b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P0E/e +nl7N6Tk2bCBIqh6qAdxw4dtmGg+eOuIPtYBYACRJiwhKJlymU5LnzFAXd9gsCUhtUqI1SsV Ttokjc3OGOovu7whjT2yv49JJNgubszdNFGYilltUVEDPxkQylDb4RGIFq/QpF4t1H2mxa1O UkkC1QePibLEmhOF1dlCGdnjUIFgxeskMKh2Xo2UcL6vaJOg7SQ/Ax9L6xNCGpsXbI9esMoJ 5jziaXsYFaAgjHmzm479/UVwtynk7xunY6l/UP5kYvGrf2RYUh5LD3xnklWKvo3RiKnLwPAa 1rFoXR9fxWeVSVYzTQuXRu2sWlWjA2Eg2dSkYPt8SJ23wO9UoJgncw1YgahDMN5Zg9Q55L66 DNNblpjqhHSosTYbhmDOkMTMOrAijGQA7KMmiVPVP7fZt3cU7lutry+vE49euqcJsHwN87n4 nASkpRsSood0fnGaS1ret2G9D2MRKAtBjWu7NjDsJCy87BrZLQQFi+dGw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYMjUEaMoAwzVpzE69n4F8Ciyydqy1XcmAgAAMr4CAAAJqgIAAIRgA
  • Thread-topic: [PATCH v5 2/2] x86/xen: Allow per-domain usage of hardware virtualized APIC

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;
     }

I agree with all the other comments and have made the approp changes for 
v6. Thanks a lot.

Jane.

 


Rackspace

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