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

Re: [PATCH v2] x86/x2apic: introduce a mixed physical/cluster mode


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 3 Nov 2023 13:51:13 +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=qGzGem3z0ZFDtL5rxeh0XSvIPLjEeOCyiB4G39LHwr4=; b=c5TOeBaiC1fMovqMrn0uR5mMooFQtaz44BVW4sGC57/Xc8V65hPjacGQyzANG7Uv+Xmq4xkyogOnM99fUfuqOV7g7H14H++yhS1rCq9ucrBOfvD5gVm6Jli3M92eblrLUt5BSvdaNUK3taMX8u7pP0NmLHXaHkOePwtr3vl5uCzX6Op//moiaM2tlLGWQLFHNOHdu0/zWdgPjxQGjk3Qklxl7AStTsd4DiI4RLQmOh5FQj6XaJuRCsDU2YulN8ay5J6ePdgB1VztAcoYx5GYAhm5rkHH1/4NRNXw+A4q6NPqcz9llkJxsNzOsKHDGJYTlevf+zh09Jz0N3hVLjXskA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nf6JNwdhffJXiaz2pTj7yHVFH6wxq7zweObUpga949c8Sp8CQg4gewWPpgIQGOuwsLdcYgtm0PPZYqMQGQinIrge8hiI1HS6L/umekHjwoXmbfeTx7mGHXg91BC4LQoAOmOuVTUCtTv0Kt9P1ZZj3UuGuyachU3RIBCeCFrog04yW4GS2nvQ9trxY7zy1Q09Hdb0sNmtzJ4PYZ5fSxiDicRu4LMcmAX4wqqfH1vvdsi+0gwF9Snm4Hb6a9tUJcUqVU5P1f9Itv9o5hyEb3RvQ1leSomQ63agD2BwV3fGQBew0c/+DWZr1MdgE4/wKiQI/VY8VSYCDjV+iFbScu282Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Henry Wang <Henry.Wang@xxxxxxx>, Community Manager <community.manager@xxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 03 Nov 2023 12:51:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.11.2023 13:48, Roger Pau Monné wrote:
> On Thu, Nov 02, 2023 at 02:38:09PM +0100, Jan Beulich wrote:
>> On 31.10.2023 15:52, Roger Pau Monne wrote:
>>> --- a/xen/arch/x86/genapic/x2apic.c
>>> +++ b/xen/arch/x86/genapic/x2apic.c
>>> @@ -180,6 +180,29 @@ static const struct genapic __initconstrel 
>>> apic_x2apic_cluster = {
>>>      .send_IPI_self = send_IPI_self_x2apic
>>>  };
>>>  
>>> +/*
>>> + * Mixed x2APIC mode: use physical for external (device) interrupts, and
>>> + * cluster for inter processor interrupts.  Such mode has the benefits of 
>>> not
>>> + * sharing the vector space with all CPUs on the cluster, while still 
>>> allowing
>>> + * IPIs to be more efficiently delivered by not having to perform an ICR 
>>> write
>>> + * for each target CPU.
>>> + */
>>> +static const struct genapic __initconstrel apic_x2apic_mixed = {
>>> +    APIC_INIT("x2apic_mixed", NULL),
>>> +    /*
>>> +     * NB: IPIs use the send_IPI_{mask,self} hooks only, other fields are
>>> +     * exclusively used by external interrupts and hence are set to use
>>> +     * Physical destination mode handlers.
>>> +     */
>>> +    .int_delivery_mode = dest_Fixed,
>>> +    .int_dest_mode = 0 /* physical delivery */,
>>> +    .init_apic_ldr = init_apic_ldr_x2apic_cluster,
>>> +    .vector_allocation_cpumask = vector_allocation_cpumask_phys,
>>> +    .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
>>> +    .send_IPI_mask = send_IPI_mask_x2apic_cluster,
>>> +    .send_IPI_self = send_IPI_self_x2apic
>>> +};
>>
>> I'm afraid the comment is still misleading in one respect: The .init_apic_ldr
>> hook is also set to its Clustered mode handler (and validly so). As before my
>> suggestion would be to leverage that we're using dedicated initializers here
>> and have a Physical mode portion and a Clustered mode one, each clarifying in
>> a brief leading comment where/how the handlers are used.
> 
> I've split this as:
> 
> /*
>  * Mixed x2APIC mode: use physical for external (device) interrupts, and
>  * cluster for inter processor interrupts.  Such mode has the benefits of not
>  * sharing the vector space with all CPUs on the cluster, while still allowing
>  * IPIs to be more efficiently delivered by not having to perform an ICR write
>  * for each target CPU.
>  */
> static const struct genapic __initconstrel apic_x2apic_mixed = {
>     APIC_INIT("x2apic_mixed", NULL),
>     /*
>      * The following fields are exclusively used by external interrupts and
>      * hence are set to use Physical destination mode handlers.
>      */
>     .int_delivery_mode = dest_Fixed,
>     .int_dest_mode = 0 /* physical delivery */,
>     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
>     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
>     /*
>      * The following fields are exclusively used by IPIs and hence are set to
>      * use Cluster Logical destination mode handlers.  Note that init_apic_ldr
>      * is not used by IPIs,

Not quite correct, I think: This is setting up the receive side of the IPIs
(iirc LDR needs to be set for logical delivery mode to be usable). Beyond
that lgtm, fwiw.

Jan

> but the per-CPU fields it initializes are only used
>      * by the IPI hooks.
>      */
>     .init_apic_ldr = init_apic_ldr_x2apic_cluster,
>     .send_IPI_mask = send_IPI_mask_x2apic_cluster,
>     .send_IPI_self = send_IPI_self_x2apic
> };
> 
> Pending whether the usage of some of the fields in connect_bsp_APIC()
> can be removed.
> 
> Thanks, Roger.




 


Rackspace

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