[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 15:56:35 +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=n49CLlnGx1Eql7D+zfFAn81RE9wbOo6xdqNpSM7mI4U=; b=QgFQ1F9p4Yq+sPkPFjTiBmXt5Yg7iWBxiUsBMkj0T0BHdZJ8kbdfehrDa1Eqd/ZCT63rWJIhlpNzMIa9yjOtyuRp7ywiNnfuEazmTTV/BpexIK2n5pDXUd7D1pQNX3cgnWrC7kWk1F0jo8eD+wMNGj6zFRJIXg8FM1xkIlI9X3+i6y2yoCk6y5lbUXE8tuH5hS3O20k60y+iM6wgCY0hLKEXOLDjAb/a2f+JTJ358yCAsvFZMzgPQsaxFEMg05hAc+NbPTUTXeML5XNtj/cre5fmgap6cO5OhmRuYHUC4wDLPV22kAhQiK9d+OTzKKVd6iPmPVc+HpvzGTas2sgM8g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=njteJXv6B+x81+B8VW0eUtx29Pj5aPMOonsS+Tecbt9X0G6vUTH52XMD6ixsB0SSd4tGDhKDEGUN7LBwdDovyBS41NbuOdUAYxKFP7q76P4Y0TpeMxHCXMtqB5aXmTPF/LSYlJedraq+3uF4k9U9WhlzBcO7oGN4Dtks+tRxmU/ypcOFsmEFzQeMyhpTtkgmAHBHyZTnryGTvXIvTlMvSjw3k2AeU9ehU89kgfg/nR53pxBsHHwaixb06aXJgjgfIwtVAzldP9ece6cDyo6UXUr7Sn2DJwpNBSMXxWnUgdZ5Gqh2Y6zsr1SsyS/ItCJjFvRIMM9lrpn8A+9La/2Mdg==
  • Authentication-results: esa5.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 15:56:48 +0000
  • Ironport-data: A9a23:OIPwLqhOkinivDxvZo9UCQo8X161mBAKZh0ujC45NGQN5FlHY01je htvCGqBPKqCZjSgKdlwYNjg9UMD7Z+BzdJlTFY9/y5mFygb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M78wIFqtQw24LhWFvc4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YSowIrCWvedHahZ/TRAjMJBh4+XYB0Hq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883az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KDwMeOAvP+tgKH P23Lsim9PUQwVwUi3NPAhjYwGsnayoqLvWJTo9QzI34giHij2lrJTgFQKD4xsYWzRThZ8/7G nsiWXCl+SemsD+7iWZ+37Y7pxQltek4MBEHtawhs8cLSipohq0Zb5mR6aJsFkO0aGSARcR4Z rxSiUbToFOAkDqDyWISNzWqk7dOQMVmj3fIJmj8D3eSILCNWsH4oF69P1km1PimjQdVZdHof l2NiuixutqJAKFkyLn69fSURZ20kKyvHo5iOYWy2dSSI0EddZq3MQiFW5uYeE99RjBmcka+S hVfbThzecTdUnfY2HSv2FpztDpVnMvHg2eSkxHvsCOyTBZkH1w0kNdnaUk7z093YN4T4MB6/ XPM6xumr0LRsgKbbhlDONERcesEGTCTR/FLWrXK1X6E6MMPW7LtvfMkf4IzfDvfIZNwIo5mZ zHXl8dvWkue1j2AcnLx5FP+gClehTLYd0s8LAr23FUgMyOeFOwC1zydLkHqbrTn8ki
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYMjUEaMoAwzVpzE69n4F8Ciyydqy1XcmAgAAMr4CAAAJqgIAAIRgAgAAC1QCAAadGgA==
  • Thread-topic: [PATCH v5 2/2] x86/xen: Allow per-domain usage of hardware virtualized APIC

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?

Thanks,

Jane.

 


Rackspace

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