|
Lines 1907-1912
sexpr_to_xend_node_info(struct sexpr *ro
Link Here
|
| 1907 |
info->mhz = sexpr_int(root, "node/cpu_mhz"); |
1907 |
info->mhz = sexpr_int(root, "node/cpu_mhz"); |
| 1908 |
info->nodes = sexpr_int(root, "node/nr_nodes"); |
1908 |
info->nodes = sexpr_int(root, "node/nr_nodes"); |
| 1909 |
info->sockets = sexpr_int(root, "node/sockets_per_node"); |
1909 |
info->sockets = sexpr_int(root, "node/sockets_per_node"); |
|
|
1910 |
info->cores = sexpr_int(root, "node/cores_per_socket"); |
| 1911 |
info->threads = sexpr_int(root, "node/threads_per_core"); |
| 1912 |
|
| 1910 |
/* Xen 3.2.0 replaces sockets_per_node with 'nr_cpus'. |
1913 |
/* Xen 3.2.0 replaces sockets_per_node with 'nr_cpus'. |
| 1911 |
* Old Xen calculated sockets_per_node using its internal |
1914 |
* Old Xen calculated sockets_per_node using its internal |
| 1912 |
* nr_cpus / (nodes*cores*threads), so fake it ourselves |
1915 |
* nr_cpus / (nodes*cores*threads), so fake it ourselves |
|
Lines 1914-1928
sexpr_to_xend_node_info(struct sexpr *ro
Link Here
|
| 1914 |
*/ |
1917 |
*/ |
| 1915 |
if (info->sockets == 0) { |
1918 |
if (info->sockets == 0) { |
| 1916 |
int nr_cpus = sexpr_int(root, "node/nr_cpus"); |
1919 |
int nr_cpus = sexpr_int(root, "node/nr_cpus"); |
| 1917 |
info->sockets = nr_cpus / (info->nodes * info->cores * info->threads); |
1920 |
int procs = info->nodes * info->cores * info->threads; |
| 1918 |
/* Should already be fine, but for sanity make |
1921 |
if (procs == 0) /* Sanity check in case of Xen bugs in futures..*/ |
|
|
1922 |
return (-1); |
| 1923 |
info->sockets = nr_cpus / procs; |
| 1924 |
/* Should already be fine, but for further sanity make |
| 1919 |
* sure we have at least one socket |
1925 |
* sure we have at least one socket |
| 1920 |
*/ |
1926 |
*/ |
| 1921 |
if (info->sockets == 0) |
1927 |
if (info->sockets == 0) |
| 1922 |
info->sockets = 1; |
1928 |
info->sockets = 1; |
| 1923 |
} |
1929 |
} |
| 1924 |
info->cores = sexpr_int(root, "node/cores_per_socket"); |
|
|
| 1925 |
info->threads = sexpr_int(root, "node/threads_per_core"); |
| 1926 |
return (0); |
1930 |
return (0); |
| 1927 |
} |
1931 |
} |
| 1928 |
|
1932 |
|