)
AC_SUBST([REALTIME_LIBS])
+AC_CHECK_LIB([rtas], [rtas_get_sysparm], [
+ RTAS_LIBS="-lrtas"
+ AC_DEFINE_UNQUOTED([HAVE_LIBRTAS], [1], [Define if librtas exists]), [],
+])
+AC_SUBST([RTAS_LIBS])
+
have_timer="no"
AC_CHECK_FUNCS([timer_createx],
[have_time="yes"],
.BR \-h | \-V
.SH DESCRIPTION
.B lscpu
-gathers CPU architecture information from sysfs and /proc/cpuinfo. The
+gathers CPU architecture information from sysfs, /proc/cpuinfo and any
+applicable architecture-specific libraries (e.g. librtas on Powerpc). The
command output can be optimized for parsing or for easy readability by humans.
The information includes, for example, the number of CPUs, threads, cores,
sockets, and Non-Uniform Memory Access (NUMA) nodes. There is also information
about the CPU caches and cache sharing, family, model, bogoMIPS, byte order,
and stepping.
+In virtualized environments, the CPU architecture information displayed
+reflects the configuration of the guest operating system which is
+typically different from the physical (host) system. On architectures that
+support retreiving physical topology information,
+.B lscpu
+also displays the number of physical sockets, chips, cores in the host system.
+
Options that result in an output table have a \fIlist\fP argument. Use this
argument to customize the command output. Specify a comma-separated list of
column labels to limit the output table to only the specified columns, arranged
# endif
#endif
+#if defined(HAVE_LIBRTAS)
+#include <librtas.h>
+#endif
+
#include <libsmartcols.h>
#include "cpuset.h"
int *polarization; /* cpu polarization */
int *addresses; /* physical cpu addresses */
int *configured; /* cpu configured */
+ int physsockets; /* Physical sockets (modules) */
+ int physchips; /* Physical chips */
+ int physcoresperchip; /* Physical cores per chip */
};
enum {
return m;
}
+#if defined(HAVE_LIBRTAS)
+#define PROCESSOR_MODULE_INFO 43
+static int strbe16toh(const char *buf, int offset)
+{
+ return (buf[offset] << 8) + buf[offset+1];
+}
+
+static void read_physical_info_powerpc(struct lscpu_desc *desc)
+{
+ char buf[BUFSIZ];
+ int rc, len, ntypes;
+
+ desc->physsockets = desc->physchips = desc->physcoresperchip = 0;
+
+ rc = rtas_get_sysparm(PROCESSOR_MODULE_INFO, sizeof(buf), buf);
+ if (rc < 0)
+ return;
+
+ len = strbe16toh(buf, 0);
+ if (len < 8)
+ return;
+
+ ntypes = strbe16toh(buf, 2);
+
+ assert(ntypes <= 1);
+ if (!ntypes)
+ return;
+
+ desc->physsockets = strbe16toh(buf, 4);
+ desc->physchips = strbe16toh(buf, 6);
+ desc->physcoresperchip = strbe16toh(buf, 8);
+}
+#else
+static void read_physical_info_powerpc(
+ struct lscpu_desc *desc __attribute__((__unused__)))
+{
+}
+#endif
+
static void
read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod)
{
desc->dispatching = path_read_s32(_PATH_SYS_CPU "/dispatching");
else
desc->dispatching = -1;
+
+ if (mod->system == SYSTEM_LIVE)
+ read_physical_info_powerpc(desc);
}
static int
if (desc->flags)
print_s(_("Flags:"), desc->flags);
+
+ if (desc->physsockets) {
+ print_n(_("Physical sockets:"), desc->physsockets);
+ print_n(_("Physical chips:"), desc->physchips);
+ print_n(_("Physical cores/chip:"), desc->physcoresperchip);
+ }
}
static void __attribute__((__noreturn__)) usage(FILE *out)