|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] Add CPU topology info (thread/core/socket) in xe
To: |
Akio Takebe <takebe_akio@xxxxxxxxxxxxxx> |
Subject: |
Re: [Xen-devel] [PATCH] Add CPU topology info (thread/core/socket) in xenpm |
From: |
Yu Ke <mr.yuke@xxxxxxxxx> |
Date: |
Fri, 13 Mar 2009 20:45:21 +0800 |
Cc: |
"Liu, Jinsong" <jinsong.liu@xxxxxxxxx>, "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "Yu, Ke" <ke.yu@xxxxxxxxx>, "Wei, Gang" <gang.wei@xxxxxxxxx> |
Delivery-date: |
Fri, 13 Mar 2009 05:45:47 -0700 |
Dkim-signature: |
v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t6W78ln6rrEnF1/7dyTrXkCUFET94LOVJn59K3+Lrfs=; b=vi+gkWmeQUlbXBXVaKwy243zfxOGvpQdQ+SWVEb+hQ/+FMZiM7d1BJR05tstSPdmLw FzXy+8h/jOAUG/zK72DkVXhTw7LCz3/x2F/JjxJzCyMEIdbj9+MKiIAxeW3ap59XNqcr P7/KTnyT7XVZIrhMXQkio4YXG7iFLjyBtglS4= |
Domainkey-signature: |
a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=cbJ2HPGQcnF2H2gSRMAL8fxOdyPH+rh9lvxGJQep6PgP3t2GdbwIv0NIUFk9OsET0f uI8NjLypMOei1c41kLihl4YMlsyeDF2eOZoRMKOvjgFcLXyJk5Ae3vZ5ts7jvfKo0klf b4LkvLQYzI+slHTGyKTXRrfpFXm5VasXw6ZNA= |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<49BA397B.80305@xxxxxxxxxxxxxx> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
References: |
<4D05DB80B95B23498C72C700BD6C2E0B085EA034@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <49BA2B72.6090600@xxxxxxxxxxxxxx> <49BA397B.80305@xxxxxxxxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
2009/3/13 Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>:
> Hi,
>
> Akio Takebe wrote:
>> Hi, Yu
>>
>> Good patch! We wanted this feature.
>>
>>> Add CPU topology info (thread/core/socket) in xenpm
>> Can this patch show thread?
>>
>>> +#define MAX_NR_CPU 512
>>> +
>>> +void cpu_topology_func(int argc, char *argv[])
>>> +{
>>> + uint32_t cpu_to_core[MAX_NR_CPU];
>>> + uint32_t cpu_to_socket[MAX_NR_CPU];
>>> + struct xc_get_cputopo info;
>>> + int i, ret;
>>> +
>>> + info.cpu_to_core = cpu_to_core;
>>> + info.cpu_to_socket = cpu_to_socket;
>>> + info.max_cpus = MAX_NR_CPU;
>>> + ret = xc_get_cputopo(xc_fd, &info);
>>> + if (!ret)
>>> + {
>>> + printf("CPU\tcore\tsocket\n");
>>> + for (i=0; i<info.nr_cpus; i++)
>>> + {
>>> + if ( info.cpu_to_core[i] != INVALID_TOPOLOGY_ID &&
>>> + info.cpu_to_socket[i] != INVALID_TOPOLOGY_ID )
>>> + {
>>> + printf("CPU%d\t %d\t %d\n", i, info.cpu_to_core[i],
>>> + info.cpu_to_socket[i]);
>>> + }
>>> + }
>>> + }
>>> + else
>>> + {
>>> + printf("Can not get Xen CPU topology!\n");
>>> + }
>>> +
>>> + return ;
>>> +}
>> The function looks like only show core/socket.
>>
> Is the CPU%d means thread?
>
> Best Regards,
>
> Akio Takebe
Yes, you are right :) thread is the smallest unit, so here just use
CPU for thread.
A thread related example is, in a 2 sockets system, where 4 cores per
socket and 2 threads per core, here is a possible output
# xenpm get-cpu-topology
CPU core socket
CPU0 0 0
CPU1 0 1
CPU2 1 0
CPU3 1 1
CPU4 2 0
CPU5 2 1
CPU6 3 0
CPU7 3 1
CPU8 0 0
CPU9 0 1
CPU10 1 0
CPU11 1 1
CPU12 2 0
CPU13 2 1
CPU14 3 0
CPU15 3 1
Indicating the following topology
socket 0:
core 0: CPU0 CPU8
core 1: CPU2 CPU10
core 2: CPU4 CPU12
core 3: CPU6 CPU14
socket 1:
core 0: CPU1 CPU9
core 1: CPU3 CPU11
core 2: CPU5 CPU13
core 3: CPU7 CPU15
Probably later I can add one option to make xenpm output the above
more human-readable format.
Best Regards
Ke
Intel Open Source Technology Center
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|