提交 eb954ede 编写于 作者: M Michal Privoznik 提交者: Eric Blake

Add support for s390(x) cpu options parsing

Up to now we missed parser for cpuinfo on x390(x) machines. Those machines
have only 1 thread, core, socket. What is missing is information about
CPU frequency.
上级 29fca785
......@@ -165,8 +165,10 @@ static int parse_socket(unsigned int cpu)
{
int ret = get_cpu_value(cpu, "topology/physical_package_id", false);
# if defined(__powerpc__) || \
defined(__powerpc64__)
/* ppc has -1 */
defined(__powerpc64__) || \
defined(__s390__) || \
defined(__s390x__)
/* ppc and s390(x) has -1 */
if (ret < 0)
ret = 0;
# endif
......@@ -265,6 +267,29 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
&& (*p == '\0' || *p == '.' || c_isspace(*p)))
nodeinfo->mhz = ui;
}
# elif defined(__s390__) || \
defined(__s390x__)
} else if (STRPREFIX(buf, "# processors")) {
char *p;
unsigned int ui;
buf += 12;
while (*buf && c_isspace(*buf))
buf++;
if (*buf != ':' || !buf[1]) {
nodeReportError(VIR_ERR_INTERNAL_ERROR,
_("parsing number of processors %c"), *buf);
return -1;
}
if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0
&& (*p == '\0' || c_isspace(*p)))
nodeinfo->cpus = ui;
/* No other interesting infos are available in /proc/cpuinfo.
* However, there is a line identifying processor's version,
* identification and machine, but we don't want it to be caught
* and parsed in next iteration, because it is not in expected
* format and thus lead to error. */
break;
}
# else
# warning Parser for /proc/cpuinfo needs to be adapted for your architecture
# endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册