On Wed, 3 Mar 2021 18:48:50 +0100
Cédric Le Goater <c...@kaod.org> wrote:

> The 'chip_id' field of the XIVE CPU structure is used to choose a
> target for a source located on the same chip when possible. This field
> is assigned on the PowerNV platform using the "ibm,chip-id" property
> on pSeries under KVM when NUMA nodes are defined but it is undefined

This sentence seems to have a syntax problem... like it is missing an
'and' before 'on pSeries'.

> under PowerVM. The XIVE source structure has a similar field
> 'src_chip' which is only assigned on the PowerNV platform.
> 
> cpu_to_node() returns a compatible value on all platforms, 0 being the
> default node. It will also give us the opportunity to set the affinity
> of a source on pSeries when we can localize them.
> 

IIUC this relies on the fact that the NUMA node id is == to chip id
on PowerNV, i.e. xc->chip_id which is passed to OPAL remain stable
with this change.

On the other hand, you have the pSeries case under PowerVM that
doesn't xc->chip_id, which isn't passed to any hcall AFAICT. It
looks like the chip id is only used for localization purpose in
this case, right ?

In this case, what about doing this change for pSeries only,
somewhere in spapr.c ?

> Signed-off-by: Cédric Le Goater <c...@kaod.org>
> ---
>  arch/powerpc/sysdev/xive/common.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/xive/common.c 
> b/arch/powerpc/sysdev/xive/common.c
> index 595310e056f4..b8e456da28aa 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -1335,16 +1335,11 @@ static int xive_prepare_cpu(unsigned int cpu)
>  
>       xc = per_cpu(xive_cpu, cpu);
>       if (!xc) {
> -             struct device_node *np;
> -
>               xc = kzalloc_node(sizeof(struct xive_cpu),
>                                 GFP_KERNEL, cpu_to_node(cpu));
>               if (!xc)
>                       return -ENOMEM;
> -             np = of_get_cpu_node(cpu, NULL);
> -             if (np)
> -                     xc->chip_id = of_get_ibm_chip_id(np);
> -             of_node_put(np);
> +             xc->chip_id = cpu_to_node(cpu);
>               xc->hw_ipi = XIVE_BAD_IRQ;
>  
>               per_cpu(xive_cpu, cpu) = xc;

Reply via email to