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

Re: [PATCH v2 4/6] xen/cpupool: Create different cpupools at boot time


  • To: Juergen Gross <jgross@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Fri, 11 Mar 2022 11:29:50 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=vsCeOcSuwjMD2fsHQeMAY1oXQKKExhxDi1howaZ3RIM=; b=BLhFjxDxn5a4ejgkFsXfoBM0whd/JYOH1erEkoCOKkI5VECbZc6FpdNDf63UY86vPZElC07oFiqtF3sZDWqlPOm7yFDCIx/FU+GaTFx9uwUTnh6PhjnV4NE52cv90XN3GL80XcDVwvCfnatiazAY7Q2NRUHl4y/wjwyO4zQXwJM60ZvvLdyYbw6IPD0/6jkBJmiywJQ1weRwa7+KH27lm1jBGxyg6qBmJzgY0Mnh5XM0VbP3pNtIwLHXXd050D29eyqWV+eH4CaxRZ0lnlZtz40+9X5uHK7YNwKOEmRmMgXRhlIJGdqrEFeiGOie1OaxdZx8TtOSgUetoQGD97v1Qg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPW2VEBUKFryUTt9UVuowxNHO8kc2xUdj6YTO/Fne6y7RDjf6kdJyUZT6FAKUn0e54xSKT+XVuWapoRf/iOHQ04OZlTZbpgba/i+1ee8aSQsRy05/BlTmgGXBGQcZQ6upazR91NEOuH4X3JYhTwIqSWZVQIuhuiFNvj6i+S27dZpszY1I2vrhHxbjZncjr5wxijfZxGTbar1TY92VEMr57mMTqZsdClCyPoc7xbI0AOQmK7UJCvMru55TzXSQ74i1UXFSIXS7uf2aLIBPO5vfRLUTs+CWLVBk7JS1LWl84uSG8QixSarlx2QfkVDMJJQhThIe9SJ0hLHpmNePD1dYA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>
  • Delivery-date: Fri, 11 Mar 2022 11:30:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYNKHSvTK6bj2+f02v/DWZHCtE9qy51VEAgAANLYCAAAlQgIAABMeAgAAIuQCAABQSAA==
  • Thread-topic: [PATCH v2 4/6] xen/cpupool: Create different cpupools at boot time


> On 11 Mar 2022, at 10:18, Juergen Gross <jgross@xxxxxxxx> wrote:
> 
> On 11.03.22 10:46, Jan Beulich wrote:
>> On 11.03.2022 10:29, Juergen Gross wrote:
>>> On 11.03.22 09:56, Luca Fancellu wrote:
>>>>> On 11 Mar 2022, at 08:09, Juergen Gross <jgross@xxxxxxxx> wrote:
>>>>> On 10.03.22 18:10, Luca Fancellu wrote:
>>>>>> --- /dev/null
>>>>>> +++ b/xen/common/boot_cpupools.c
>>>>>> @@ -0,0 +1,212 @@
>>>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>>>> +/*
>>>>>> + * xen/common/boot_cpupools.c
>>>>>> + *
>>>>>> + * Code to create cpupools at boot time for arm architecture.
>>>>> 
>>>>> Please drop the arm reference here.
>>>>> 
>>>>>> + *
>>>>>> + * Copyright (C) 2022 Arm Ltd.
>>>>>> + */
>>>>>> +
>>>>>> +#include <xen/sched.h>
>>>>>> +
>>>>>> +#define BTCPUPOOLS_DT_NODE_NO_REG     (-1)
>>>>>> +#define BTCPUPOOLS_DT_NODE_NO_LOG_CPU (-2)
>>>>> 
>>>>> Move those inside the #ifdef below, please
>>>>> 
>>>>>> +
>>>>>> +struct pool_map {
>>>>>> +    int pool_id;
>>>>>> +    int sched_id;
>>>>>> +    struct cpupool *pool;
>>>>>> +};
>>>>>> +
>>>>>> +static struct pool_map __initdata pool_cpu_map[NR_CPUS] =
>>>>>> +    { [0 ... NR_CPUS-1] = {.pool_id = -1, .sched_id = -1, .pool = NULL} 
>>>>>> };
>>>>>> +static unsigned int __initdata next_pool_id;
>>>>>> +
>>>>>> +#ifdef CONFIG_ARM
>>>>> 
>>>>> Shouldn't this be CONFIG_HAS_DEVICE_TREE?
>>>> 
>>>> Yes, the only problem is that in get_logical_cpu_from_hw_id I use the arm 
>>>> specific
>>>> cpu_logical_map(…), so what do you think it’s the better way here?
>>>> Do you think I should have everything under CONFIG_HAS_DEVICE_TREE
>>>> and get_logical_cpu_from_hw_id under CONFIG_ARM like in this way below?
>>> 
>>> Hmm, what is the hwid used for on Arm? I guess this could be similar
>>> to the x86 acpi-id?
>> Since there's going to be only one of DT or ACPI, if anything this could
>> be the APIC ID and then ...
>>> So I'd rather put get_logical_cpu_from_hw_id() into Arm specific code
>>> and add a related x86 function to x86 code. Depending on the answer to
>>> above question this could either be get_cpu_id(), or maybe an identity
>>> function.
>> ... a lookup loop over x86_cpu_to_apicid[] (I thought we had a function
>> doing so, but right now I can't find one).
> 
> It is the second half of get_cpu_id().

I was going to say, maybe I can do something like this:

#ifdef CONFIG_ARM
#define hwid_from_logical_cpu_id(x) cpu_logical_map(x)
#elif defined(CONFIG_X86)
#define hwid_from_logical_cpu_id(x) x86_cpu_to_apicid(x)
#else
#define hwid_from_logical_cpu_id(x) (-1)
#end

static int __init get_logical_cpu_from_hw_id(unsigned int hwid)
{
    unsigned int i;

    for ( i = 0; i < nr_cpu_ids; i++ )
        if ( hwid_from_logical_cpu_id(i) == hwid )
            return i;

    return -1;
}

Do you think it is acceptable?

I see the current get_cpu_id(…) from x86 code is starting from an acpi id to
lookup the apicid and then it is looking for the logical cpu number.
In the x86 context, eventually, the reg property of a cpu node would hold an
Acpi id or an apicid? I would have say the last one but I’m not sure now.

Cheers,
Luca

> 
> 
> Juergen
> <OpenPGP_0xB0DE9DD628BF132F.asc>


 


Rackspace

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