DragonFly BSD
DragonFly kernel List (threaded) for 2012-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: GSoC: Add SMT/HT awareness to DragonFlyBSD scheduler


From: Mihai Carabas <mihai.carabas@xxxxxxxxx>
Date: Sun, 3 Jun 2012 19:30:40 +0300

--14dae9340a6b294e9104c193f0d8
Content-Type: text/plain; charset=ISO-8859-1

Hello again,

I created a new branch on my repo [2] named "smt_usched_bsd4" where are all
my changes. At [1] are all my modifications made till now. Also I renamed
the the cpu_topology.c in subr_cpu_topology.c at Alex recomandation, to
be consistent with the current naming.

[1]  https://github.com/mihaicarabas/dragonfly/compare/smt_usched_bsd4
[2]  https://github.com/mihaicarabas/dragonfly

Mihai Carabas.

On Sun, Jun 3, 2012 at 2:00 PM, Mihai Carabas <mihai.carabas@gmail.com>wrote:

> Hello,
>
> This week, I managed to *dynamicly detect *the CPU topology of a
> platform. There are 2 components: platform depedent code which determines
> the mask_size within APICID for logical and core ids. For now, is available
> only for 64bit, intel and amd (I will make code available for 32bit soon).
> The code was written here [1], from line 1107.
>
> Another component, is the platform independent. I used the
> logical_CPU_bits and core_bits to determine the number of entities per
> level and build a topology tree (I tried to make all as general as
> possible). For this code I added a new file [2]. The init function is
> registered through SYSINIT to run before the initialization of the
> USCHED. All the topology information is available through sysctl.
>
> Here are outputs for 3 different topologies. Unfortunately, I don't have
> an AMD platform to test on. All tests are done on INTEL platforms.
>
> *1) two physical CPUs (emulated through VMWARE - yes vmware gives this
> posibility)*
>
> hw.cpu_topology.tree:
> \-PACKAGE MEMBERS: cpu0 cpu1
>   |-CHIP ID 0: cpu0
>   \-CHIP ID 1: cpu1
> hw.cpu_topology.members: cpu0 cpu1
>
> hw.cpu_topology.cpu0.physical_id: 0
> hw.cpu_topology.cpu0.physical_sibings: cpu0
>
> hw.cpu_topology.cpu1.physical_id: 1
> hw.cpu_topology.cpu1.physical_sibings: cpu1
>
>
> *2) two cores on one physical CPU*
>
> hw.cpu_topology.tree:
> \-PACKAGE MEMBERS: cpu0 cpu1
>   \-CHIP ID 0: cpu0 cpu1
>     |-CORE ID 0: cpu0
>     \-CORE ID 1: cpu1
> hw.cpu_topology.members: cpu0 cpu1
>
> hw.cpu_topology.cpu0.physical_id: 0
> hw.cpu_topology.cpu0.physical_sibings: cpu0 cpu1
> hw.cpu_topology.cpu0.core_id: 0
> hw.cpu_topology.cpu0.core_siblings: cpu0
>
> hw.cpu_topology.cpu1.physical_id: 0
> hw.cpu_topology.cpu1.physical_sibings: cpu0 cpu1
> hw.cpu_topology.cpu1.core_id: 1
> hw.cpu_topology.cpu1.core_siblings: cpu1
>
>
> *3) two cores on one physical CPU and two threads on each core.*
>
> hw.cpu_topology.tree:
> \-PACKAGE MEMBERS: cpu0 cpu1 cpu2 cpu3
>   \-CHIP ID 0: cpu0 cpu1 cpu2 cpu3
>     |-CORE ID 0: cpu0 cpu2
>     | |-THREAD ID 0: cpu0
>     | \-THREAD ID 1: cpu2
>     \-CORE ID 1: cpu1 cpu3
>       |-THREAD ID 0: cpu1
>       \-THREAD ID 1: cpu3
> hw.cpu_topology.members: cpu0 cpu1 cpu2 cpu3
>
> hw.cpu_topology.cpu0.physical_id: 0
> hw.cpu_topology.cpu0.physical_sibings: cpu0 cpu1 cpu2 cpu3
> hw.cpu_topology.cpu0.core_id: 0
> hw.cpu_topology.cpu0.core_siblings: cpu0 cpu2
>
> hw.cpu_topology.cpu1.physical_id: 0
> hw.cpu_topology.cpu1.physical_sibings: cpu0 cpu1 cpu2 cpu3
> hw.cpu_topology.cpu1.core_id: 1
> hw.cpu_topology.cpu1.core_siblings: cpu1 cpu3
>
> hw.cpu_topology.cpu2.physical_id: 0
> hw.cpu_topology.cpu2.physical_sibings: cpu0 cpu1 cpu2 cpu3
> hw.cpu_topology.cpu2.core_id: 0
> hw.cpu_topology.cpu2.core_siblings: cpu0 cpu2
>
> hw.cpu_topology.cpu3.physical_id: 0
> hw.cpu_topology.cpu3.physical_sibings: cpu0 cpu1 cpu2 cpu3
> hw.cpu_topology.cpu3.core_id: 1
> hw.cpu_topology.cpu3.core_siblings: cpu1 cpu3
>
> Now, every CPU, have in its own structure, the knowledge of the whole
> topology. The next step is to develop some meaningful tests and begin
> playing with scheduling decisions. Scheduling will take into account the
> load of the target's siblings cpu, too.
>
> For those who want to test this, they have to clone the repo [3]. May be
> next week, if you want, I will make a full patch with my code till now.
>
> Any feedback is welcome!
>
> Thanks,
> Mihai Carabas
>
> [1]
> https://github.com/mihaicarabas/dragonfly/blob/master/sys/platform/pc64/x86_64/mp_machdep.c
> [2]
> https://github.com/mihaicarabas/dragonfly/blob/master/sys/kern/cpu_topology.c
> [3] https://github.com/mihaicarabas/dragonfly
>

--14dae9340a6b294e9104c193f0d8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello again,<div><br></div><div>I created a new branch on my repo [2] named=
 &quot;smt_usched_bsd4&quot; where are all my changes. At [1] are all my mo=
difications made till now. Also I renamed the the cpu_topology.c in subr_cp=
u_topology.c at Alex recomandation, to be=A0consistent with the current nam=
ing.</div>
<div><br></div><div>[1]=A0
<a href=3D"https://github.com/mihaicarabas/dragonfly/compare/smt_usched_bsd=
4">https://github.com/mihaicarabas/dragonfly/compare/smt_usched_bsd4</a>=A0=
<br>[2]=A0
<a href=3D"https://github.com/mihaicarabas/dragonfly";>https://github.com/mi=
haicarabas/dragonfly</a>=A0</div><div><br></div><div>Mihai Carabas.</div><d=
iv><br><div class=3D"gmail_quote">On Sun, Jun 3, 2012 at 2:00 PM, Mihai Car=
abas <span dir=3D"ltr">&lt;<a href=3D"mailto:mihai.carabas@gmail.com"; targe=
t=3D"_blank">mihai.carabas@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hello,<div><br></div><div>This week, I manag=
ed to <i style=3D"font-weight:bold">dynamicly detect </i>the CPU topology o=
f a platform.=A0<span>There are 2 components: platform depedent code which =
determines the mask_size within APICID for logical and core ids. For now, i=
s available only for 64bit, intel and amd (I will make code available for 3=
2bit soon). The code was written here [1], from line 1107.</span></div>

<div><div><br></div><div>Another component, is the platform independent. I =
used the logical_CPU_bits and core_bits to determine the number of entities=
 per level and build a topology tree (I tried to make all as general as pos=
sible). For this code I added a new file [2]. The init function is register=
ed through SYSINIT to run before the initialization of the USCHED.=A0All th=
e topology information is available through sysctl.</div>

<div><br></div><div>Here are outputs for 3 different topologies. Unfortunat=
ely, I don&#39;t have an AMD platform to test on. All tests are done on INT=
EL platforms.</div><div><br></div><div><b><i>1) two physical CPUs (emulated=
 through VMWARE - yes vmware gives this posibility)</i></b></div>

<div><div><br></div><div>hw.cpu_topology.tree:</div><div>\-PACKAGE MEMBERS:=
 cpu0 cpu1</div><div>=A0 |-CHIP ID 0: cpu0</div><div>=A0 \-CHIP ID 1: cpu1<=
/div><div>hw.cpu_topology.members: cpu0 cpu1</div><div><br></div><div>
hw.cpu_topology.cpu0.physical_id: 0</div><div>hw.cpu_topology.cpu0.physical=
_sibings: cpu0</div><div><br></div><div>hw.cpu_topology.cpu1.physical_id: 1=
</div><div>hw.cpu_topology.cpu1.physical_sibings: cpu1</div><div><br></div>

</div><div><br></div><div><b><i>2) two cores on one physical CPU</i></b></d=
iv><div><div><br></div><div>hw.cpu_topology.tree:</div><div>\-PACKAGE MEMBE=
RS: cpu0 cpu1</div><div>=A0 \-CHIP ID 0: cpu0 cpu1</div>
<div>=A0 =A0 |-CORE ID 0: cpu0</div><div>=A0 =A0 \-CORE ID 1: cpu1</div><di=
v>hw.cpu_topology.members: cpu0 cpu1</div><div><br></div><div>hw.cpu_topolo=
gy.cpu0.physical_id: 0</div><div>hw.cpu_topology.cpu0.physical_sibings: cpu=
0 cpu1</div>

<div>hw.cpu_topology.cpu0.core_id: 0</div><div>hw.cpu_topology.cpu0.core_si=
blings: cpu0</div><div><br></div><div>hw.cpu_topology.cpu1.physical_id: 0</=
div><div>hw.cpu_topology.cpu1.physical_sibings: cpu0 cpu1</div><div>hw.cpu_=
topology.cpu1.core_id: 1</div>

<div>hw.cpu_topology.cpu1.core_siblings: cpu1</div></div><div><br></div><di=
v><br></div><div><i><b>3) two cores on one physical CPU and two threads on =
each core.</b></i></div><div><div><br></div><div>
hw.cpu_topology.tree:</div><div>\-PACKAGE MEMBERS: cpu0 cpu1 cpu2 cpu3</div=
><div>=A0 \-CHIP ID 0: cpu0 cpu1 cpu2 cpu3</div><div>=A0 =A0 |-CORE ID 0: c=
pu0 cpu2</div><div>=A0 =A0 | |-THREAD ID 0: cpu0</div><div>=A0 =A0 | \-THRE=
AD ID 1: cpu2</div>

<div>=A0 =A0 \-CORE ID 1: cpu1 cpu3</div><div>=A0 =A0 =A0 |-THREAD ID 0: cp=
u1</div><div>=A0 =A0 =A0 \-THREAD ID 1: cpu3</div><div>hw.cpu_topology.memb=
ers: cpu0 cpu1 cpu2 cpu3</div><div><br></div><div>hw.cpu_topology.cpu0.phys=
ical_id: 0</div>

<div>hw.cpu_topology.cpu0.physical_sibings: cpu0 cpu1 cpu2 cpu3</div><div>h=
w.cpu_topology.cpu0.core_id: 0</div><div>hw.cpu_topology.cpu0.core_siblings=
: cpu0 cpu2</div><div><br></div><div>hw.cpu_topology.cpu1.physical_id: 0</d=
iv>

<div>hw.cpu_topology.cpu1.physical_sibings: cpu0 cpu1 cpu2 cpu3</div><div>h=
w.cpu_topology.cpu1.core_id: 1</div><div>hw.cpu_topology.cpu1.core_siblings=
: cpu1 cpu3</div><div><br></div><div>hw.cpu_topology.cpu2.physical_id: 0</d=
iv>

<div>hw.cpu_topology.cpu2.physical_sibings: cpu0 cpu1 cpu2 cpu3</div><div>h=
w.cpu_topology.cpu2.core_id: 0</div><div>hw.cpu_topology.cpu2.core_siblings=
: cpu0 cpu2</div><div><br></div><div>hw.cpu_topology.cpu3.physical_id: 0</d=
iv>

<div>hw.cpu_topology.cpu3.physical_sibings: cpu0 cpu1 cpu2 cpu3</div><div>h=
w.cpu_topology.cpu3.core_id: 1</div><div>hw.cpu_topology.cpu3.core_siblings=
: cpu1 cpu3</div></div><div><br></div><div>Now, every CPU, have in its own =
structure, the knowledge of the whole topology. The next step is to develop=
 some meaningful tests and begin playing with scheduling decisions. Schedul=
ing will take into account the load of the target&#39;s siblings cpu, too.<=
/div>

<div class=3D"gmail_quote"><br></div></div><div class=3D"gmail_quote">For t=
hose who want to test this, they have to clone the repo [3]. May be next we=
ek, if you want, I will make a full patch with my code till now.</div><div =
class=3D"gmail_quote">

<div><br></div><div>Any feedback is welcome!</div><div><br></div><div>Thank=
s,</div><div>Mihai Carabas</div><div><br></div><div>[1]=A0<a href=3D"https:=
//github.com/mihaicarabas/dragonfly/blob/master/sys/platform/pc64/x86_64/mp=
_machdep.c" style=3D"color:rgb(17,85,204)" target=3D"_blank">https://github=
.com/mihaicarabas/dragonfly/blob/master/sys/platform/pc64/x86_64/mp_machdep=
.c</a></div>

<div>[2]=A0<a href=3D"https://github.com/mihaicarabas/dragonfly/blob/master=
/sys/kern/cpu_topology.c" style=3D"color:rgb(17,85,204)" target=3D"_blank">=
https://github.com/mihaicarabas/dragonfly/blob/master/sys/kern/cpu_topology=
.c</a></div>

</div><div class=3D"gmail_quote">[3]=A0<a href=3D"https://github.com/mihaic=
arabas/dragonfly" target=3D"_blank">https://github.com/mihaicarabas/dragonf=
ly</a></div>
</blockquote></div><br></div>

--14dae9340a6b294e9104c193f0d8--



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