From: Hillf Danton Subject: [RFC] drm/amdkfd: Use logical cpu id for building vcrat Date: Tue, 16 Apr 2019 10:39:59 +0800 Message-ID: <20190416071201.109E98961D@gabe.freedesktop.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0880515967==" Return-path: List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" Cc: "Mark Nutter " , "Arnd Bergmann " , "Catalin Marinas " , "Felix Kuehling " , "Alex Deucher " , "Christian Koenig " --===============0880515967== Content-Type: multipart/alternative; boundary="_D8351805-A468-40BD-AC85-85920FD01267_" --_D8351805-A468-40BD-AC85-85920FD01267_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hi folks In commit d1c234e2cd, arm64 is granted to build kfd. Currently, it is physi= cal cpu id that is used for building the x86_64 vcrat, but logical cpu id is us= ed instead for arm64, though the function name requires apicid. Can we use the physical id for both arches if it really has an up-hand over the logical on= e, as the following tiny diff represents? --- linux-5.1-rc4/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 2019-04-16 07:5= 5:56.611685400 +0800 +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 2019-04-16 09:16:50.5061266= 00 +0800 @@ -1405,11 +1405,7 @@ static int kfd_cpumask_to_apic_id(const first_cpu_of_numa_node =3D cpumask_first(cpumask); if (first_cpu_of_numa_node >=3D nr_cpu_ids) return -1; -#ifdef CONFIG_X86_64 - return cpu_data(first_cpu_of_numa_node).apicid; -#else - return first_cpu_of_numa_node; -#endif + return cpu_physical_id(first_cpu_of_numa_node); } /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical pro= cessor -- Or is logical cpu id enough to do the work, with some cosmetic applied to t= he=20 function names(not included in the following simple diff yet)? thanks Hillf --- linux-5.1-rc4/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 2019-04-16 07:5= 5:56.611685400 +0800 +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 2019-04-16 09:18:24.5465784= 00 +0800 @@ -1405,11 +1405,7 @@ static int kfd_cpumask_to_apic_id(const first_cpu_of_numa_node =3D cpumask_first(cpumask); if (first_cpu_of_numa_node >=3D nr_cpu_ids) return -1; -#ifdef CONFIG_X86_64 - return cpu_data(first_cpu_of_numa_node).apicid; -#else return first_cpu_of_numa_node; -#endif } /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical pro= cessor -- --_D8351805-A468-40BD-AC85-85920FD01267_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Hi folks

 

In commit d1c234e2cd, arm64 is granted to build kfd. Currently, it is = physical

cpu id that is u= sed for building the x86_64 vcrat, but logical cpu id is used

instead for arm64, though the function= name requires apicid. Can we use the

physical id for both arches if it really has an up-hand over t= he logical one,

as the fo= llowing tiny diff represents?

 

--= - linux-5.1-rc4/drivers/gpu/drm/amd/amdkfd/kfd_topology.c=C2=A0=C2=A0=C2=A0= 2019-04-16 07:55:56.611685400 +0800

+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 2019-04-16 09:1= 6:50.506126600 +0800

@@ -= 1405,11 +1405,7 @@ static int kfd_cpumask_to_apic_id(const

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 firs= t_cpu_of_numa_node =3D cpumask_first(cpumask);

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (first_cpu_of= _numa_node >=3D nr_cpu_ids)

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 return -1;

-#ifdef CO= NFIG_X86_64

-=C2=A0=C2=A0= =C2=A0=C2=A0 return cpu_data(first_cpu_of_numa_node).apicid;

-#else

<= span lang=3DEN-US>-=C2=A0=C2=A0=C2=A0=C2=A0 return first_cpu_of_numa_node;<= /span>

-#endif

+=C2=A0=C2=A0=C2=A0 return cpu_physical_id= (first_cpu_of_numa_node);

}

/* kfd_numa_node_to_a= pic_id - Returns the APIC ID of the first logical processor

--

 

 

O= r is logical cpu id enough to do the work, with some cosmetic applied to th= e

function names(not inc= luded in the following simple diff yet)?

 

thanks

Hillf

 

=

 

--- linux-5.1-rc4/drivers/gpu/drm/amd/amdk= fd/kfd_topology.c=C2=A0=C2=A0=C2=A0 2019-04-16 07:55:56.611685400 +0800

+++ b/drivers/gpu/drm/amd/am= dkfd/kfd_topology.c 2019-04-16 09:18:24.546578400 +0800

@@ -1405,11 +1405,7 @@ static int kfd_cpuma= sk_to_apic_id(const

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 first_cpu_of_numa_node =3D cpumask_first(= cpumask);

=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 if (first_cpu_of_numa_node >=3D nr_cpu_ids)=

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -1;

-#ifdef CONFIG_X86_64

-=C2=A0=C2=A0=C2=A0=C2=A0 return cpu_data(first_c= pu_of_numa_node).apicid;

= -#else

=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 return first_cpu_of_numa_node;

-#endif

}

/* kfd_numa_n= ode_to_apic_id - Returns the APIC ID of the first logical processor<= /p>

--

 

= --_D8351805-A468-40BD-AC85-85920FD01267_-- --===============0880515967== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4 --===============0880515967==--