public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] lscpu: improve hypervisor detection
@ 2014-05-20 15:42 Ruediger Meier
  2014-05-20 15:42 ` [PATCH 1/5] lscpu: minor cleanup and " Ruediger Meier
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 15:42 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec, Petr Uzel

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This patch set is based on an openSUSE / SLE patch. Original author was
probably Petr Uzel.

I've splitted the original patch into smaller pieces, removed some
incompatible output format changes and added some test data.

You can also review and pull from my github repo
https://github.com/rudimeier/util-linux/compare/lscpu-detect?expand=1

CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>

Ruediger Meier (5):
  lscpu: minor cleanup and improve hypervisor detection
  tests: add vbox lscpu dump
  lscpu: detect OS/400 and pHyp hypervisors
  lscpu: improve vmware detection
  lscpu: avoid compiler warnings

 sys-utils/lscpu.c                    | 148 ++++++++++++++++++++++++++++++++++-
 sys-utils/lscpu.h                    |   5 +-
 tests/expected/lscpu/lscpu-vbox-win  |  29 +++++++
 tests/ts/lscpu/dumps/vbox-win.tar.gz | Bin 0 -> 15769 bytes
 4 files changed, 179 insertions(+), 3 deletions(-)
 create mode 100644 tests/expected/lscpu/lscpu-vbox-win
 create mode 100644 tests/ts/lscpu/dumps/vbox-win.tar.gz

-- 
1.8.4.5


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/5] lscpu: minor cleanup and improve hypervisor detection
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
@ 2014-05-20 15:42 ` Ruediger Meier
  2014-05-20 15:42 ` [PATCH 2/5] tests: add vbox lscpu dump Ruediger Meier
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 15:42 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec, Petr Uzel

From: Ruediger Meier <ruediger.meier@ga-group.nl>

- add HYPER_VBOX
- improve HYPER_VMWARE

This patch comes from openSUSE / SLE. Original author was probably
Petr Uzel.
Internal SUSE references: fate310255, sr226509

CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 sys-utils/lscpu.c | 29 +++++++++++++++++++++++++++--
 sys-utils/lscpu.h |  3 ++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index ad1a6b3..0203916 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -87,7 +87,26 @@ const char *hv_vendors[] = {
 	[HYPER_UML]	= "User-mode Linux",
 	[HYPER_INNOTEK]	= "Innotek GmbH",
 	[HYPER_HITACHI]	= "Hitachi",
-	[HYPER_PARALLELS] = "Parallels"
+	[HYPER_PARALLELS] = "Parallels",
+	[HYPER_VBOX]	= "Oracle"
+};
+
+const int hv_vendor_pci[] = {
+	[HYPER_NONE]	= 0x0000,
+	[HYPER_XEN]	= 0x5853,
+	[HYPER_KVM]	= 0x0000,
+	[HYPER_MSHV]	= 0x1414,
+	[HYPER_VMWARE]	= 0x15ad,
+	[HYPER_VBOX]	= 0x80ee
+};
+
+const int hv_graphics_pci[] = {
+	[HYPER_NONE]	= 0x0000,
+	[HYPER_XEN]	= 0x0001,
+	[HYPER_KVM]	= 0x0000,
+	[HYPER_MSHV]	= 0x5353,
+	[HYPER_VMWARE]	= 0x0710,
+	[HYPER_VBOX]	= 0xbeef
 };
 
 /* CPU modes */
@@ -589,9 +608,15 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 		desc->hyper = HYPER_XEN;
 
 	/* Xen full-virt on non-x86_64 */
-	} else if (has_pci_device(0x5853, 0x0001)) {
+	} else if (has_pci_device( hv_vendor_pci[HYPER_XEN], hv_graphics_pci[HYPER_XEN])) {
 		desc->hyper = HYPER_XEN;
 		desc->virtype = VIRT_FULL;
+	} else if (has_pci_device( hv_vendor_pci[HYPER_VMWARE], hv_graphics_pci[HYPER_VMWARE])) {
+		desc->hyper = HYPER_VMWARE;
+		desc->virtype = VIRT_FULL;
+	} else if (has_pci_device( hv_vendor_pci[HYPER_VBOX], hv_graphics_pci[HYPER_VBOX])) {
+		desc->hyper = HYPER_VBOX;
+		desc->virtype = VIRT_FULL;
 
 	/* IBM PR/SM */
 	} else if (path_exist(_PATH_PROC_SYSINFO)) {
diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h
index 312038f..7bb538d 100644
--- a/sys-utils/lscpu.h
+++ b/sys-utils/lscpu.h
@@ -13,7 +13,8 @@ enum {
 	HYPER_UML,
 	HYPER_INNOTEK,		/* VBOX */
 	HYPER_HITACHI,
-	HYPER_PARALLELS		/* OpenVZ/VIrtuozzo */
+	HYPER_PARALLELS,	/* OpenVZ/VIrtuozzo */
+	HYPER_VBOX
 };
 
 extern int read_hypervisor_dmi(void);
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/5] tests: add vbox lscpu dump
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
  2014-05-20 15:42 ` [PATCH 1/5] lscpu: minor cleanup and " Ruediger Meier
@ 2014-05-20 15:42 ` Ruediger Meier
  2014-05-20 15:42 ` [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors Ruediger Meier
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 15:42 UTC (permalink / raw)
  To: util-linux; +Cc: Bernhard Voelker

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Taken from openSUSE-13.1 guest in VirtualBox-4.3.10 (host=Win7):
   Hypervisor vendor:     Oracle
   Virtualization type:   full

Dump was provides by Bernhard Voelker.

CC: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/expected/lscpu/lscpu-vbox-win  |  29 +++++++++++++++++++++++++++++
 tests/ts/lscpu/dumps/vbox-win.tar.gz | Bin 0 -> 15769 bytes
 2 files changed, 29 insertions(+)
 create mode 100644 tests/expected/lscpu/lscpu-vbox-win
 create mode 100644 tests/ts/lscpu/dumps/vbox-win.tar.gz

diff --git a/tests/expected/lscpu/lscpu-vbox-win b/tests/expected/lscpu/lscpu-vbox-win
new file mode 100644
index 0000000..569f078
--- /dev/null
+++ b/tests/expected/lscpu/lscpu-vbox-win
@@ -0,0 +1,29 @@
+CPU op-mode(s):        32-bit, 64-bit
+CPU(s):                2
+On-line CPU(s) list:   0,1
+Thread(s) per core:    1
+Core(s) per socket:    2
+Socket(s):             1
+NUMA node(s):          1
+Vendor ID:             GenuineIntel
+CPU family:            6
+Model:                 58
+Model name:            Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
+Stepping:              9
+CPU MHz:               1600.000
+CPU max MHz:           3800.0000
+CPU min MHz:           1600.0000
+BogoMIPS:              3355.62
+Hypervisor vendor:     Oracle
+Virtualization type:   full
+L1d cache:             32K
+L1d cache:             32K
+L2d cache:             6144K
+NUMA node0 CPU(s):     0,1
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node,,L1d,L1d,L2d
+0,0,0,0,,0,0,0
+1,1,0,0,,1,1,0
diff --git a/tests/ts/lscpu/dumps/vbox-win.tar.gz b/tests/ts/lscpu/dumps/vbox-win.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..e8204fe110175681d61973f8dcc8b7841acb622e
GIT binary patch
literal 15769
zcmbWec|29`_ctsGMKl_#Lz*KRNjQdt`baYohf0&`L`tT1ic}I(QPN3Bnn;5(w3V3*
zndg&vo*mA#_j;~F-|zi<e&65yyq^2+pI&n9y|2BlwbpxBJ4%4Kc$cx~ej$;|N9kA8
z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|?ijzq$W)CA-P
z|13eenks?3!-AUI<*_5ZU^mL#)Q;c2%nMr}b-<n%78TqB_t!$v(#hk(0{F?JELyQO
z8q=YVUv|m$z-KzFo{^24EpU-UCLv;P{a$2Pi{o!-)jvwQRiK2_ZNq0$VK(v+$~rL2
zY51H(MvO+$VV{0n6ggY;5I8|_XfvQQV~e!#%nPlt(tzthQ6csl4N1zlfIG9tNmS~y
z`~?@>1SV3`o*cRrg2Um(FVE!sGj)_WsmP+~2)u_$zSWLzVO~GvIA_YK$SJ|fQSe;X
z8^m|q`fJBjVXFgKG}X4Zu;w&L^X<V`3mua4+ab6_VDunvHtSN(zYY><{@uWsXXh)m
z;M!lw{~r!Px~L#gkgeeWZc8@sX)<j?8}<lY_&Zn^=zjB~Ad9{v*dkb0-!_>ZsH!?@
zOFa$q&^XZekNH)l|H&Xgj_Lnk5R`U*y<LW%<n%7QO&wRrCz)1v1-^kiC*eLa9cQ-T
zyQ~*mS=|MJ4o0qZYb2>c&`$XwHvoNCQyvRz-@(K4fZ3q`50dkvw#6KVFqx~p;Iee(
zxM%0xM+J|Pya`;bXnVLm$%x7J@%zCApVFzz21w-OVxtnie5y<$NfG+*f5?q&?77i_
K4MKlJh5jEkk0$E?

literal 0
HcmV?d00001

-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
  2014-05-20 15:42 ` [PATCH 1/5] lscpu: minor cleanup and " Ruediger Meier
  2014-05-20 15:42 ` [PATCH 2/5] tests: add vbox lscpu dump Ruediger Meier
@ 2014-05-20 15:42 ` Ruediger Meier
  2014-05-21  7:37   ` Karel Zak
  2014-05-21 23:03   ` Ruediger Meier
  2014-05-20 15:42 ` [PATCH 4/5] lscpu: improve vmware detection Ruediger Meier
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 15:42 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec, Petr Uzel

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This patch comes from openSUSE / SLE. Original author was probably
Petr Uzel.
Internal SUSE references: fate310255, sr226509

CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 sys-utils/lscpu.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 sys-utils/lscpu.h |  4 +++-
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 0203916..b9e07e6 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -60,6 +60,7 @@
 #define _PATH_PROC_STATUS	"/proc/self/status"
 #define _PATH_PROC_VZ	"/proc/vz"
 #define _PATH_PROC_BC	"/proc/bc"
+#define _PATH_PROC_DEVICETREE	"/proc/device-tree"
 #define _PATH_DEV_MEM 		"/dev/mem"
 
 /* virtualization types */
@@ -88,7 +89,9 @@ const char *hv_vendors[] = {
 	[HYPER_INNOTEK]	= "Innotek GmbH",
 	[HYPER_HITACHI]	= "Hitachi",
 	[HYPER_PARALLELS] = "Parallels",
-	[HYPER_VBOX]	= "Oracle"
+	[HYPER_VBOX]	= "Oracle",
+	[HYPER_OS400]	= "OS/400",
+	[HYPER_PHYP]	= "pHyp"
 };
 
 const int hv_vendor_pci[] = {
@@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
 static void
 read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
 {
+#ifdef __powerpc__
+	/* powerpc:
+	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400
+	 * IBM pSeries: always has a hypervisor
+	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
+	 *              otherwise its some partition created by Hardware Management Console
+	 *              in any case, its always some sort of HVM
+	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
+	 * Xen: not in use, not detected
+	 */
+	if (path_exist("/proc/iSeries")) {
+		desc->hyper = HYPER_OS400;
+		desc->virtype = VIRT_FULL;
+	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
+		FILE *fd;
+		desc->hyper = HYPER_PHYP;
+		desc->virtype = VIRT_FULL;
+		fd = fopen(_PATH_PROC_DEVICETREE "/ibm,partition-name", "r");
+		if (fd) {
+			char buf[256];
+			if (fscanf(fd, "%s", buf) == 1 && !strcmp(buf, "full"))
+				desc->virtype = VIRT_NONE;
+			fclose(fd);
+		}
+	} else if (path_exist(_PATH_PROC_DEVICETREE "/hypervisor/compatible")) {
+		FILE *fd;
+		fd = fopen(_PATH_PROC_DEVICETREE "/hypervisor/compatible", "r");
+		if (fd) {
+			char buf[256];
+			int i;
+			memset(buf, 0, sizeof(buf));
+			fread(buf, sizeof(buf) - 1, 1, fd);
+			fclose(fd);
+			for (i = 0; i < sizeof(buf);) {
+				if (!strcmp(&buf[i], "linux,kvm")) {
+					desc->hyper = HYPER_KVM;
+					desc->virtype = VIRT_FULL;
+					break;
+				}
+				i += strlen(&buf[i]);
+				i++;
+			}
+		}
+	}
+#endif
 }
 #endif
 
diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h
index 7bb538d..6c25c4f 100644
--- a/sys-utils/lscpu.h
+++ b/sys-utils/lscpu.h
@@ -14,7 +14,9 @@ enum {
 	HYPER_INNOTEK,		/* VBOX */
 	HYPER_HITACHI,
 	HYPER_PARALLELS,	/* OpenVZ/VIrtuozzo */
-	HYPER_VBOX
+	HYPER_VBOX,
+	HYPER_OS400,
+	HYPER_PHYP
 };
 
 extern int read_hypervisor_dmi(void);
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/5] lscpu: improve vmware detection
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
                   ` (2 preceding siblings ...)
  2014-05-20 15:42 ` [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors Ruediger Meier
@ 2014-05-20 15:42 ` Ruediger Meier
  2014-05-20 18:40   ` Ruediger Meier
  2014-05-20 15:42 ` [PATCH 5/5] lscpu: avoid compiler warnings Ruediger Meier
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 15:42 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec, Petr Uzel

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This patch comes from openSUSE / SLE. Original author was probably
Petr Uzel.
Internal SUSE references: fate310255, sr226509

CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 sys-utils/lscpu.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index b9e07e6..ee3ad19 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -32,6 +32,15 @@
 #include <stdarg.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <stdint.h>
+#include <signal.h>
+#include <strings.h>
+#include <setjmp.h>
+#if defined(__x86_64__) || defined(__i386__)
+#ifdef HAVE_sys_io_h
+#include <sys/io.h>
+#endif
+#endif
 
 #include <libsmartcols.h>
 
@@ -573,6 +582,57 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
 		desc->hyper = HYPER_VMWARE;
 }
 
+#define VMWARE_BDOOR_MAGIC          0x564D5868
+#define VMWARE_BDOOR_PORT           0x5658
+#define VMWARE_BDOOR_CMD_GETVERSION 10
+
+#define VMWARE_BDOOR(eax, ebx, ecx, edx)                                  \
+        __asm__("inl (%%dx)" :                                            \
+               "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :               \
+               "0"(VMWARE_BDOOR_MAGIC), "1"(VMWARE_BDOOR_CMD_GETVERSION), \
+               "2"(VMWARE_BDOOR_PORT), "3"(0) :                           \
+               "memory");
+
+static jmp_buf segv_handler_env;
+
+static void
+segv_handler(int sig, siginfo_t *info, void *ignored)
+{
+	siglongjmp(segv_handler_env, 1);
+}
+
+static int
+is_vmware_platform(void)
+{
+	uint32_t eax, ebx, ecx, edx;
+	struct sigaction act, oact;
+
+	/*
+	 * The assembly routine for vmware detection works
+	 * fine under vmware, even if ran as regular user. But
+	 * on real HW or under other hypervisors, it segfaults (which is
+	 * expected). So we temporarily install SIGSEGV handler to catch
+	 * the signal. All this magic is needed because lscpu
+	 * isn't supposed to require root privileges.
+	 */
+	if (sigsetjmp(segv_handler_env, 1))
+		return 0;
+
+	bzero(&act, sizeof(act));
+	act.sa_sigaction = segv_handler;
+	act.sa_flags = SA_SIGINFO;
+
+	if (sigaction(SIGSEGV, &act, &oact))
+		err(EXIT_FAILURE, _("error: can not set signal handler"));
+
+	VMWARE_BDOOR(eax, ebx, ecx, edx);
+
+	if (sigaction(SIGSEGV, &oact, NULL))
+		err(EXIT_FAILURE, _("error: can not restore signal handler"));
+
+	return eax != (uint32_t)-1 && ebx == VMWARE_BDOOR_MAGIC;
+}
+
 #else	/* ! __x86_64__ */
 static void
 read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
@@ -623,6 +683,11 @@ read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
 	}
 #endif
 }
+
+static int is_vmware_platform(void)
+{
+	return 0;
+}
 #endif
 
 static void
@@ -659,6 +724,9 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
 	} else if (has_pci_device( hv_vendor_pci[HYPER_XEN], hv_graphics_pci[HYPER_XEN])) {
 		desc->hyper = HYPER_XEN;
 		desc->virtype = VIRT_FULL;
+	} else if (is_vmware_platform()) {
+		desc->hyper = HYPER_VMWARE;
+		desc->virtype = VIRT_FULL;
 	} else if (has_pci_device( hv_vendor_pci[HYPER_VMWARE], hv_graphics_pci[HYPER_VMWARE])) {
 		desc->hyper = HYPER_VMWARE;
 		desc->virtype = VIRT_FULL;
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/5] lscpu: avoid compiler warnings
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
                   ` (3 preceding siblings ...)
  2014-05-20 15:42 ` [PATCH 4/5] lscpu: improve vmware detection Ruediger Meier
@ 2014-05-20 15:42 ` Ruediger Meier
  2014-05-21  8:10   ` Karel Zak
  2014-05-20 16:34 ` [PATCH 0/5] lscpu: improve hypervisor detection Stanislav Brabec
  2014-05-21 22:29 ` Ruediger Meier
  6 siblings, 1 reply; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 15:42 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 sys-utils/lscpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index ee3ad19..58f6609 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -598,6 +598,9 @@ static jmp_buf segv_handler_env;
 static void
 segv_handler(int sig, siginfo_t *info, void *ignored)
 {
+	(void)sig;
+	(void)info;
+	(void)ignored;
 	siglongjmp(segv_handler_env, 1);
 }
 
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/5] lscpu: improve hypervisor detection
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
                   ` (4 preceding siblings ...)
  2014-05-20 15:42 ` [PATCH 5/5] lscpu: avoid compiler warnings Ruediger Meier
@ 2014-05-20 16:34 ` Stanislav Brabec
  2014-05-20 18:13   ` Ruediger Meier
  2014-05-21  8:24   ` Karel Zak
  2014-05-21 22:29 ` Ruediger Meier
  6 siblings, 2 replies; 21+ messages in thread
From: Stanislav Brabec @ 2014-05-20 16:34 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux, Petr Uzel

Ruediger Meierwrote:

> I've splitted the original patch into smaller pieces, removed some
> incompatible output format changes and added some test data.

There was a controversial part of this patch, that causes test failure.

There should be a way how to output result of the virtual machine
detection without breaking test cases (and possibly existing scripts).

Index: util-linux-2.24.1/sys-utils/lscpu.c
===================================================================
--- util-linux-2.24.1.orig/sys-utils/lscpu.c
+++ util-linux-2.24.1/sys-utils/lscpu.c
@@ -1181,6 +1322,7 @@ print_parsable(struct lscpu_desc *desc,
 		}
 		fputs(data && *data ? data : "", stdout);
 	}
+	printf(",HvVendor,VirtType");
 	putchar('\n');
 
 	/*
@@ -1210,7 +1352,9 @@ print_parsable(struct lscpu_desc *desc,
 					     buf, sizeof(buf));
 			fputs(data && *data ? data : "", stdout);
 		}
-		putchar('\n');
+		printf(",%s,%s\n",
+		       hv_vendors[desc->hyper] ? hv_vendors[desc->hyper] : "none",
+		       virt_types[desc->virtype]);
 	}
 }
 

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/5] lscpu: improve hypervisor detection
  2014-05-20 16:34 ` [PATCH 0/5] lscpu: improve hypervisor detection Stanislav Brabec
@ 2014-05-20 18:13   ` Ruediger Meier
  2014-05-21  8:24   ` Karel Zak
  1 sibling, 0 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 18:13 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux

On Tuesday 20 May 2014, Stanislav Brabec wrote:
> Ruediger Meierwrote:
> > I've splitted the original patch into smaller pieces, removed some
> > incompatible output format changes and added some test data.
>
> There was a controversial part of this patch, that causes test
> failure.
>
> There should be a way how to output result of the virtual machine
> detection without breaking test cases (and possibly existing
> scripts).

We already output it per default "lscpu" without options. As you can see 
in the newly added test output:

$ grep -A1 "Hypervisor"   tests/expected/lscpu/lscpu-vbox-win
Hypervisor vendor:     Oracle
Virtualization type:   full

The other part of the original patch below only affected "-p" which was 
IMO useless and bad because incompatible.


> Index: util-linux-2.24.1/sys-utils/lscpu.c
> ===================================================================
> --- util-linux-2.24.1.orig/sys-utils/lscpu.c
> +++ util-linux-2.24.1/sys-utils/lscpu.c
> @@ -1181,6 +1322,7 @@ print_parsable(struct lscpu_desc *desc,
>  		}
>  		fputs(data && *data ? data : "", stdout);
>  	}
> +	printf(",HvVendor,VirtType");
>  	putchar('\n');
>
>  	/*
> @@ -1210,7 +1352,9 @@ print_parsable(struct lscpu_desc *desc,
>  					     buf, sizeof(buf));
>  			fputs(data && *data ? data : "", stdout);
>  		}
> -		putchar('\n');
> +		printf(",%s,%s\n",
> +		       hv_vendors[desc->hyper] ? hv_vendors[desc->hyper] : "none",
> +		       virt_types[desc->virtype]);
>  	}
>  }



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/5] lscpu: improve vmware detection
  2014-05-20 15:42 ` [PATCH 4/5] lscpu: improve vmware detection Ruediger Meier
@ 2014-05-20 18:40   ` Ruediger Meier
  0 siblings, 0 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-20 18:40 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec

I guess this part of the patch set will be the most controversial one.

1. This inline assembler code breaks some compilers, e.g. clang on our
   travis build machine. Though this seems to be a bug of this
   particular old clang version.

2. The VMWARE_BDOOR function seems to be imported from kernel
   arch/x86/kernel/cpu/vmware.c
   I wonder if we couldn't just ask the kernel about vmware!? At least
   we should pull existing fixes from kernel.

BTW I've re-organized this patch a bit regarding ifdefs to let it look 
like this
https://github.com/rudimeier/util-linux/commit/8ff73842a1a552354272a954659983ff3caeb45c
(The ifdef __GNUC__ should actually be something which tells us whether 
that inline asm would work.)


On Tuesday 20 May 2014, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>
> This patch comes from openSUSE / SLE. Original author was probably
> Petr Uzel.
> Internal SUSE references: fate310255, sr226509
>
> CC: Stanislav Brabec <sbrabec@suse.cz>
> CC: Petr Uzel <petr.uzel@suse.cz>
> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> ---
>  sys-utils/lscpu.c | 68
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file
> changed, 68 insertions(+)
>
> diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
> index b9e07e6..ee3ad19 100644
> --- a/sys-utils/lscpu.c
> +++ b/sys-utils/lscpu.c
> @@ -32,6 +32,15 @@
>  #include <stdarg.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
> +#include <stdint.h>
> +#include <signal.h>
> +#include <strings.h>
> +#include <setjmp.h>
> +#if defined(__x86_64__) || defined(__i386__)
> +#ifdef HAVE_sys_io_h
> +#include <sys/io.h>
> +#endif
> +#endif
>
>  #include <libsmartcols.h>
>
> @@ -573,6 +582,57 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
>  		desc->hyper = HYPER_VMWARE;
>  }
>
> +#define VMWARE_BDOOR_MAGIC          0x564D5868
> +#define VMWARE_BDOOR_PORT           0x5658
> +#define VMWARE_BDOOR_CMD_GETVERSION 10
> +
> +#define VMWARE_BDOOR(eax, ebx, ecx, edx)                            
>      \ +        __asm__("inl (%%dx)" :                               
>             \ +               "=a"(eax), "=c"(ecx), "=d"(edx),
> "=b"(ebx) :               \ +               "0"(VMWARE_BDOOR_MAGIC),
> "1"(VMWARE_BDOOR_CMD_GETVERSION), \ +              
> "2"(VMWARE_BDOOR_PORT), "3"(0) :                           \ +       
>        "memory");
> +
> +static jmp_buf segv_handler_env;
> +
> +static void
> +segv_handler(int sig, siginfo_t *info, void *ignored)
> +{
> +	siglongjmp(segv_handler_env, 1);
> +}
> +
> +static int
> +is_vmware_platform(void)
> +{
> +	uint32_t eax, ebx, ecx, edx;
> +	struct sigaction act, oact;
> +
> +	/*
> +	 * The assembly routine for vmware detection works
> +	 * fine under vmware, even if ran as regular user. But
> +	 * on real HW or under other hypervisors, it segfaults (which is
> +	 * expected). So we temporarily install SIGSEGV handler to catch
> +	 * the signal. All this magic is needed because lscpu
> +	 * isn't supposed to require root privileges.
> +	 */
> +	if (sigsetjmp(segv_handler_env, 1))
> +		return 0;
> +
> +	bzero(&act, sizeof(act));
> +	act.sa_sigaction = segv_handler;
> +	act.sa_flags = SA_SIGINFO;
> +
> +	if (sigaction(SIGSEGV, &act, &oact))
> +		err(EXIT_FAILURE, _("error: can not set signal handler"));
> +
> +	VMWARE_BDOOR(eax, ebx, ecx, edx);
> +
> +	if (sigaction(SIGSEGV, &oact, NULL))
> +		err(EXIT_FAILURE, _("error: can not restore signal handler"));
> +
> +	return eax != (uint32_t)-1 && ebx == VMWARE_BDOOR_MAGIC;
> +}
> +
>  #else	/* ! __x86_64__ */
>  static void
>  read_hypervisor_cpuid(struct lscpu_desc *desc
> __attribute__((__unused__))) @@ -623,6 +683,11 @@
> read_hypervisor_cpuid(struct lscpu_desc *desc
> __attribute__((__unused__))) }
>  #endif
>  }
> +
> +static int is_vmware_platform(void)
> +{
> +	return 0;
> +}
>  #endif
>
>  static void
> @@ -659,6 +724,9 @@ read_hypervisor(struct lscpu_desc *desc, struct
> lscpu_modifier *mod) } else if (has_pci_device(
> hv_vendor_pci[HYPER_XEN], hv_graphics_pci[HYPER_XEN])) { desc->hyper
> = HYPER_XEN;
>  		desc->virtype = VIRT_FULL;
> +	} else if (is_vmware_platform()) {
> +		desc->hyper = HYPER_VMWARE;
> +		desc->virtype = VIRT_FULL;
>  	} else if (has_pci_device( hv_vendor_pci[HYPER_VMWARE],
> hv_graphics_pci[HYPER_VMWARE])) { desc->hyper = HYPER_VMWARE;
>  		desc->virtype = VIRT_FULL;

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-20 15:42 ` [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors Ruediger Meier
@ 2014-05-21  7:37   ` Karel Zak
  2014-05-21  9:43     ` Ruediger Meier
  2014-05-21 23:03   ` Ruediger Meier
  1 sibling, 1 reply; 21+ messages in thread
From: Karel Zak @ 2014-05-21  7:37 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux, Stanislav Brabec, Petr Uzel

On Tue, May 20, 2014 at 03:42:29PM +0000, Ruediger Meier wrote:
>  const int hv_vendor_pci[] = {
> @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
>  static void
>  read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
>  {
> +#ifdef __powerpc__
> +	/* powerpc:
> +	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400
> +	 * IBM pSeries: always has a hypervisor
> +	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
> +	 *              otherwise its some partition created by Hardware Management Console
> +	 *              in any case, its always some sort of HVM
> +	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
> +	 * Xen: not in use, not detected
> +	 */

 I don't see relation between this code and CPU ID. Why this  codes is
 with in read_hypervisor_cpuid() ? 
 
 Wouldn't be better to add  read_powerpc_hypervisor() and call it from 
 read_hypervisor()?

    Karel

> +	if (path_exist("/proc/iSeries")) {
> +		desc->hyper = HYPER_OS400;
> +		desc->virtype = VIRT_FULL;
> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
> +		FILE *fd;
> +		desc->hyper = HYPER_PHYP;
> +		desc->virtype = VIRT_FULL;
> +		fd = fopen(_PATH_PROC_DEVICETREE "/ibm,partition-name", "r");
> +		if (fd) {
> +			char buf[256];
> +			if (fscanf(fd, "%s", buf) == 1 && !strcmp(buf, "full"))
> +				desc->virtype = VIRT_NONE;
> +			fclose(fd);
> +		}
> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/hypervisor/compatible")) {
> +		FILE *fd;
> +		fd = fopen(_PATH_PROC_DEVICETREE "/hypervisor/compatible", "r");
> +		if (fd) {
> +			char buf[256];
> +			int i;
> +			memset(buf, 0, sizeof(buf));
> +			fread(buf, sizeof(buf) - 1, 1, fd);
> +			fclose(fd);
> +			for (i = 0; i < sizeof(buf);) {
> +				if (!strcmp(&buf[i], "linux,kvm")) {
> +					desc->hyper = HYPER_KVM;
> +					desc->virtype = VIRT_FULL;
> +					break;
> +				}
> +				i += strlen(&buf[i]);
> +				i++;
> +			}
> +		}
> +	}
> +#endif
>  }
>  #endif
>  
> diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h
> index 7bb538d..6c25c4f 100644
> --- a/sys-utils/lscpu.h
> +++ b/sys-utils/lscpu.h
> @@ -14,7 +14,9 @@ enum {
>  	HYPER_INNOTEK,		/* VBOX */
>  	HYPER_HITACHI,
>  	HYPER_PARALLELS,	/* OpenVZ/VIrtuozzo */
> -	HYPER_VBOX
> +	HYPER_VBOX,
> +	HYPER_OS400,
> +	HYPER_PHYP
>  };
>  
>  extern int read_hypervisor_dmi(void);
> -- 
> 1.8.4.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/5] lscpu: avoid compiler warnings
  2014-05-20 15:42 ` [PATCH 5/5] lscpu: avoid compiler warnings Ruediger Meier
@ 2014-05-21  8:10   ` Karel Zak
  0 siblings, 0 replies; 21+ messages in thread
From: Karel Zak @ 2014-05-21  8:10 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Tue, May 20, 2014 at 03:42:31PM +0000, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>
> 
> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> ---
>  sys-utils/lscpu.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
> index ee3ad19..58f6609 100644
> --- a/sys-utils/lscpu.c
> +++ b/sys-utils/lscpu.c
> @@ -598,6 +598,9 @@ static jmp_buf segv_handler_env;
>  static void
>  segv_handler(int sig, siginfo_t *info, void *ignored)
>  {
> +	(void)sig;
> +	(void)info;
> +	(void)ignored;

 please, use
 
    segv_handler(__attribute__((__unused__)) sig,
                 __attribute__((__unused__)) info,
                 __attribute__((__unused__)) ignored)

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/5] lscpu: improve hypervisor detection
  2014-05-20 16:34 ` [PATCH 0/5] lscpu: improve hypervisor detection Stanislav Brabec
  2014-05-20 18:13   ` Ruediger Meier
@ 2014-05-21  8:24   ` Karel Zak
  1 sibling, 0 replies; 21+ messages in thread
From: Karel Zak @ 2014-05-21  8:24 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: Ruediger Meier, util-linux, Petr Uzel

On Tue, May 20, 2014 at 06:34:22PM +0200, Stanislav Brabec wrote:
> Ruediger Meierwrote:
> 
> > I've splitted the original patch into smaller pieces, removed some
> > incompatible output format changes and added some test data.
> 
> There was a controversial part of this patch, that causes test failure.
> 
> There should be a way how to output result of the virtual machine
> detection without breaking test cases (and possibly existing scripts).

Like many other utils we have a way how to specify output columns

  lscpu --extended[=<list>]
  lscpu --parse[=<list>]

The man page:

  -p, --parse[=list]

  If  the  list  argument is omitted, the command output is compatible
  with earlier versions of lscpu. 

it means that HvVendor,VirtType have to be omitted from -p by default.


Frankly, I don't see any practical reason to have hypervisor info in -p
and -e at all. These output formats are about CPU topology and per-CPU
specific information. The global stuff makes more sense for the default
(without options) output where you can use 

    lscpu | awk '/Hypervisor type/ { print $2 }'

or so...

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-21  7:37   ` Karel Zak
@ 2014-05-21  9:43     ` Ruediger Meier
  2014-05-21 12:41       ` Karel Zak
  0 siblings, 1 reply; 21+ messages in thread
From: Ruediger Meier @ 2014-05-21  9:43 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux, Stanislav Brabec, Petr Uzel

On Wednesday 21 May 2014, Karel Zak wrote:
> On Tue, May 20, 2014 at 03:42:29PM +0000, Ruediger Meier wrote:
> >  const int hv_vendor_pci[] = {
> > @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
> >  static void
> >  read_hypervisor_cpuid(struct lscpu_desc *desc
> > __attribute__((__unused__))) {
> > +#ifdef __powerpc__
> > +	/* powerpc:
> > +	 * IBM iSeries: legacy, if /proc/iSeries exists, its
> > para-virtualized on top of OS/400 +	 * IBM pSeries: always has a
> > hypervisor
> > +	 *              if partition-name is "full", its kind of
> > "bare-metal": full-system-partition +	 *              otherwise its
> > some partition created by Hardware Management Console +	 *         
> >     in any case, its always some sort of HVM +	 * KVM: "linux,kvm"
> > in /hypervisor/compatible indicates a KVM guest +	 * Xen: not in
> > use, not detected
> > +	 */
>
>  I don't see relation between this code and CPU ID. Why this  codes
> is with in read_hypervisor_cpuid() ?
>
>  Wouldn't be better to add  read_powerpc_hypervisor() and call it
> from read_hypervisor()?

Yes, I would call it like this, ok?
--------
static void
read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
{
	FILE *fd;

	if (mod->system != SYSTEM_SNAPSHOT) {
		read_hypervisor_cpuid(desc);
		if (!desc->hyper)
			desc->hyper = read_hypervisor_dmi();
	}
	if (desc->hyper)
		desc->virtype = VIRT_FULL;

	else if (read_hypervisor_powerpc(desc) > 0) {}

	/* Xen para-virt or dom0 */
	else if (path_exist(_PATH_PROC_XEN)) {
        ....
----------

BTW this is also better calling this code in case SYSTEM_SNAPSHOT too 
and it was a mistake anway that it could set desc->virtype = VIRT_NONE 
which was overwritten afterwards.


>     Karel
>
> > +	if (path_exist("/proc/iSeries")) {
> > +		desc->hyper = HYPER_OS400;
> > +		desc->virtype = VIRT_FULL;
> > +	} else if (path_exist(_PATH_PROC_DEVICETREE
> > "/ibm,partition-name")) { +		FILE *fd;
> > +		desc->hyper = HYPER_PHYP;
> > +		desc->virtype = VIRT_FULL;
> > +		fd = fopen(_PATH_PROC_DEVICETREE "/ibm,partition-name", "r");
> > +		if (fd) {
> > +			char buf[256];
> > +			if (fscanf(fd, "%s", buf) == 1 && !strcmp(buf, "full"))
> > +				desc->virtype = VIRT_NONE;
> > +			fclose(fd);
> > +		}
> > +	} else if (path_exist(_PATH_PROC_DEVICETREE
> > "/hypervisor/compatible")) { +		FILE *fd;
> > +		fd = fopen(_PATH_PROC_DEVICETREE "/hypervisor/compatible", "r");
> > +		if (fd) {
> > +			char buf[256];
> > +			int i;
> > +			memset(buf, 0, sizeof(buf));
> > +			fread(buf, sizeof(buf) - 1, 1, fd);
> > +			fclose(fd);
> > +			for (i = 0; i < sizeof(buf);) {
> > +				if (!strcmp(&buf[i], "linux,kvm")) {
> > +					desc->hyper = HYPER_KVM;
> > +					desc->virtype = VIRT_FULL;
> > +					break;
> > +				}
> > +				i += strlen(&buf[i]);
> > +				i++;
> > +			}
> > +		}
> > +	}
> > +#endif
> >  }
> >  #endif
> >
> > diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h
> > index 7bb538d..6c25c4f 100644
> > --- a/sys-utils/lscpu.h
> > +++ b/sys-utils/lscpu.h
> > @@ -14,7 +14,9 @@ enum {
> >  	HYPER_INNOTEK,		/* VBOX */
> >  	HYPER_HITACHI,
> >  	HYPER_PARALLELS,	/* OpenVZ/VIrtuozzo */
> > -	HYPER_VBOX
> > +	HYPER_VBOX,
> > +	HYPER_OS400,
> > +	HYPER_PHYP
> >  };
> >
> >  extern int read_hypervisor_dmi(void);
> > --
> > 1.8.4.5
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > util-linux" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-21  9:43     ` Ruediger Meier
@ 2014-05-21 12:41       ` Karel Zak
  0 siblings, 0 replies; 21+ messages in thread
From: Karel Zak @ 2014-05-21 12:41 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux, Stanislav Brabec, Petr Uzel

On Wed, May 21, 2014 at 11:43:46AM +0200, Ruediger Meier wrote:
> On Wednesday 21 May 2014, Karel Zak wrote:
> > On Tue, May 20, 2014 at 03:42:29PM +0000, Ruediger Meier wrote:
> > >  const int hv_vendor_pci[] = {
> > > @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
> > >  static void
> > >  read_hypervisor_cpuid(struct lscpu_desc *desc
> > > __attribute__((__unused__))) {
> > > +#ifdef __powerpc__
> > > +	/* powerpc:
> > > +	 * IBM iSeries: legacy, if /proc/iSeries exists, its
> > > para-virtualized on top of OS/400 +	 * IBM pSeries: always has a
> > > hypervisor
> > > +	 *              if partition-name is "full", its kind of
> > > "bare-metal": full-system-partition +	 *              otherwise its
> > > some partition created by Hardware Management Console +	 *         
> > >     in any case, its always some sort of HVM +	 * KVM: "linux,kvm"
> > > in /hypervisor/compatible indicates a KVM guest +	 * Xen: not in
> > > use, not detected
> > > +	 */
> >
> >  I don't see relation between this code and CPU ID. Why this  codes
> > is with in read_hypervisor_cpuid() ?
> >
> >  Wouldn't be better to add  read_powerpc_hypervisor() and call it
> > from read_hypervisor()?
> 
> Yes, I would call it like this, ok?

 OK.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 0/5] lscpu: improve hypervisor detection
  2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
                   ` (5 preceding siblings ...)
  2014-05-20 16:34 ` [PATCH 0/5] lscpu: improve hypervisor detection Stanislav Brabec
@ 2014-05-21 22:29 ` Ruediger Meier
  6 siblings, 0 replies; 21+ messages in thread
From: Ruediger Meier @ 2014-05-21 22:29 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec, Petr Uzel

On Tuesday 20 May 2014, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>
>
> This patch set is based on an openSUSE / SLE patch. Original author
> was probably Petr Uzel.
>
> I've splitted the original patch into smaller pieces, removed some
> incompatible output format changes and added some test data.

I have updated these patches on github
https://github.com/karelzak/util-linux/pull/87

changes since v1:
* separate read_hypervisor_powerpc function:
 - fopen -> path_fopen
 - it works now for SYSTEM_SNAPSHOT and not only ifdef __powerpc_
*VMWARE_BDOOR:
 - cleanup ifdefs
 - attribute unused
 - must be only called if not SYSTEM_SNAPSHOT

Note VMWARE_BDOOR breaks travis build for (old) clang. To be fixed later 
via ifdef or just for travis.

cu,
Rudi

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-20 15:42 ` [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors Ruediger Meier
  2014-05-21  7:37   ` Karel Zak
@ 2014-05-21 23:03   ` Ruediger Meier
  2014-05-22  8:48     ` Karel Zak
  1 sibling, 1 reply; 21+ messages in thread
From: Ruediger Meier @ 2014-05-21 23:03 UTC (permalink / raw)
  To: util-linux; +Cc: Stanislav Brabec, Petr Uzel

On Tuesday 20 May 2014, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@ga-group.nl>
> 
> This patch comes from openSUSE / SLE. Original author was probably
> Petr Uzel.
> Internal SUSE references: fate310255, sr226509
> 
> CC: Stanislav Brabec <sbrabec@suse.cz>
> CC: Petr Uzel <petr.uzel@suse.cz>
> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
> ---
>  sys-utils/lscpu.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
>  sys-utils/lscpu.h |  4 +++-
>  2 files changed, 52 insertions(+), 2 deletions(-)
> 
> diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
> index 0203916..b9e07e6 100644
> --- a/sys-utils/lscpu.c
> +++ b/sys-utils/lscpu.c
> @@ -60,6 +60,7 @@
>  #define _PATH_PROC_STATUS	"/proc/self/status"
>  #define _PATH_PROC_VZ	"/proc/vz"
>  #define _PATH_PROC_BC	"/proc/bc"
> +#define _PATH_PROC_DEVICETREE	"/proc/device-tree"
>  #define _PATH_DEV_MEM 		"/dev/mem"
>  
>  /* virtualization types */
> @@ -88,7 +89,9 @@ const char *hv_vendors[] = {
>  	[HYPER_INNOTEK]	= "Innotek GmbH",
>  	[HYPER_HITACHI]	= "Hitachi",
>  	[HYPER_PARALLELS] = "Parallels",
> -	[HYPER_VBOX]	= "Oracle"
> +	[HYPER_VBOX]	= "Oracle",
> +	[HYPER_OS400]	= "OS/400",
> +	[HYPER_PHYP]	= "pHyp"
>  };
>  
>  const int hv_vendor_pci[] = {
> @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
>  static void
>  read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
>  {
> +#ifdef __powerpc__
> +	/* powerpc:
> +	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400

According to this comment ...

> +	 * IBM pSeries: always has a hypervisor
> +	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
> +	 *              otherwise its some partition created by Hardware Management Console
> +	 *              in any case, its always some sort of HVM
> +	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
> +	 * Xen: not in use, not detected
> +	 */
> +	if (path_exist("/proc/iSeries")) {
> +		desc->hyper = HYPER_OS400;
> +		desc->virtype = VIRT_FULL;

... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.

> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
> +		FILE *fd;
> +		desc->hyper = HYPER_PHYP;
> +		desc->virtype = VIRT_FULL;

Maybe more obvious here for pSeries where p seems to stand for para
http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP

> +		fd = fopen(_PATH_PROC_DEVICETREE "/ibm,partition-name", "r");
> +		if (fd) {
> +			char buf[256];
> +			if (fscanf(fd, "%s", buf) == 1 && !strcmp(buf, "full"))
> +				desc->virtype = VIRT_NONE;
> +			fclose(fd);
> +		}
> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/hypervisor/compatible")) {
> +		FILE *fd;
> +		fd = fopen(_PATH_PROC_DEVICETREE "/hypervisor/compatible", "r");
> +		if (fd) {
> +			char buf[256];
> +			int i;
> +			memset(buf, 0, sizeof(buf));
> +			fread(buf, sizeof(buf) - 1, 1, fd);
> +			fclose(fd);
> +			for (i = 0; i < sizeof(buf);) {
> +				if (!strcmp(&buf[i], "linux,kvm")) {
> +					desc->hyper = HYPER_KVM;
> +					desc->virtype = VIRT_FULL;
> +					break;
> +				}
> +				i += strlen(&buf[i]);
> +				i++;
> +			}
> +		}
> +	}
> +#endif
>  }
>  #endif
>  
> diff --git a/sys-utils/lscpu.h b/sys-utils/lscpu.h
> index 7bb538d..6c25c4f 100644
> --- a/sys-utils/lscpu.h
> +++ b/sys-utils/lscpu.h
> @@ -14,7 +14,9 @@ enum {
>  	HYPER_INNOTEK,		/* VBOX */
>  	HYPER_HITACHI,
>  	HYPER_PARALLELS,	/* OpenVZ/VIrtuozzo */
> -	HYPER_VBOX
> +	HYPER_VBOX,
> +	HYPER_OS400,
> +	HYPER_PHYP
>  };
>  
>  extern int read_hypervisor_dmi(void);

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-21 23:03   ` Ruediger Meier
@ 2014-05-22  8:48     ` Karel Zak
  2014-05-22  9:08       ` Heiko Carstens
  0 siblings, 1 reply; 21+ messages in thread
From: Karel Zak @ 2014-05-22  8:48 UTC (permalink / raw)
  To: Ruediger Meier, Heiko Carstens; +Cc: util-linux, Stanislav Brabec, Petr Uzel


 Heiko, can you help us to classify pSeries and iSeries virtualization?
 See below. Is it FULL or PARA virtualization? Thanks!

    Karel

On Thu, May 22, 2014 at 01:03:43AM +0200, Ruediger Meier wrote:
> > +	[HYPER_OS400]	= "OS/400",
> > +	[HYPER_PHYP]	= "pHyp"
> >  };
> >  
> >  const int hv_vendor_pci[] = {
> > @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
> >  static void
> >  read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
> >  {
> > +#ifdef __powerpc__
> > +	/* powerpc:
> > +	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400
> 
> According to this comment ...
> 
> > +	 * IBM pSeries: always has a hypervisor
> > +	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
> > +	 *              otherwise its some partition created by Hardware Management Console
> > +	 *              in any case, its always some sort of HVM
> > +	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
> > +	 * Xen: not in use, not detected
> > +	 */
> > +	if (path_exist("/proc/iSeries")) {
> > +		desc->hyper = HYPER_OS400;
> > +		desc->virtype = VIRT_FULL;
> 
> ... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.
> 
> > +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
> > +		FILE *fd;
> > +		desc->hyper = HYPER_PHYP;
> > +		desc->virtype = VIRT_FULL;
> 
> Maybe more obvious here for pSeries where p seems to stand for para
> http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-22  8:48     ` Karel Zak
@ 2014-05-22  9:08       ` Heiko Carstens
  2014-05-22  9:30         ` Alexander Graf
  0 siblings, 1 reply; 21+ messages in thread
From: Heiko Carstens @ 2014-05-22  9:08 UTC (permalink / raw)
  To: Karel Zak, Alexander Graf, Paul Mackerras
  Cc: Ruediger Meier, util-linux, Stanislav Brabec, Petr Uzel

Hi Karel,

I think Alexander Graf (who is kvm on powerpc maintainer) should answer
how he would like to have it classified.

[full quote below]

On Thu, May 22, 2014 at 10:48:20AM +0200, Karel Zak wrote:
> 
>  Heiko, can you help us to classify pSeries and iSeries virtualization?
>  See below. Is it FULL or PARA virtualization? Thanks!
> 
>     Karel
> 
> On Thu, May 22, 2014 at 01:03:43AM +0200, Ruediger Meier wrote:
> > > +	[HYPER_OS400]	= "OS/400",
> > > +	[HYPER_PHYP]	= "pHyp"
> > >  };
> > >  
> > >  const int hv_vendor_pci[] = {
> > > @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
> > >  static void
> > >  read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
> > >  {
> > > +#ifdef __powerpc__
> > > +	/* powerpc:
> > > +	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400
> > 
> > According to this comment ...
> > 
> > > +	 * IBM pSeries: always has a hypervisor
> > > +	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
> > > +	 *              otherwise its some partition created by Hardware Management Console
> > > +	 *              in any case, its always some sort of HVM
> > > +	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
> > > +	 * Xen: not in use, not detected
> > > +	 */
> > > +	if (path_exist("/proc/iSeries")) {
> > > +		desc->hyper = HYPER_OS400;
> > > +		desc->virtype = VIRT_FULL;
> > 
> > ... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.
> > 
> > > +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
> > > +		FILE *fd;
> > > +		desc->hyper = HYPER_PHYP;
> > > +		desc->virtype = VIRT_FULL;
> > 
> > Maybe more obvious here for pSeries where p seems to stand for para
> > http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP
> 
> -- 
>  Karel Zak  <kzak@redhat.com>
>  http://karelzak.blogspot.com
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-22  9:08       ` Heiko Carstens
@ 2014-05-22  9:30         ` Alexander Graf
  2014-05-28 21:54           ` Ruediger Meier
  0 siblings, 1 reply; 21+ messages in thread
From: Alexander Graf @ 2014-05-22  9:30 UTC (permalink / raw)
  To: Heiko Carstens, Karel Zak, Paul Mackerras
  Cc: Ruediger Meier, util-linux, Stanislav Brabec, Petr Uzel,
	Ben Herrenschmidt


On 22.05.14 11:08, Heiko Carstens wrote:
> Hi Karel,
>
> I think Alexander Graf (who is kvm on powerpc maintainer) should answer
> how he would like to have it classified.
>
> [full quote below]
>
> On Thu, May 22, 2014 at 10:48:20AM +0200, Karel Zak wrote:
>>   Heiko, can you help us to classify pSeries and iSeries virtualization?
>>   See below. Is it FULL or PARA virtualization? Thanks!
>>
>>      Karel
>>
>> On Thu, May 22, 2014 at 01:03:43AM +0200, Ruediger Meier wrote:
>>>> +	[HYPER_OS400]	= "OS/400",
>>>> +	[HYPER_PHYP]	= "pHyp"
>>>>   };
>>>>   
>>>>   const int hv_vendor_pci[] = {
>>>> @@ -574,6 +577,51 @@ read_hypervisor_cpuid(struct lscpu_desc *desc)
>>>>   static void
>>>>   read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__)))
>>>>   {
>>>> +#ifdef __powerpc__
>>>> +	/* powerpc:
>>>> +	 * IBM iSeries: legacy, if /proc/iSeries exists, its para-virtualized on top of OS/400
>>> According to this comment ...
>>>
>>>> +	 * IBM pSeries: always has a hypervisor
>>>> +	 *              if partition-name is "full", its kind of "bare-metal": full-system-partition
>>>> +	 *              otherwise its some partition created by Hardware Management Console
>>>> +	 *              in any case, its always some sort of HVM
>>>> +	 * KVM: "linux,kvm" in /hypervisor/compatible indicates a KVM guest
>>>> +	 * Xen: not in use, not detected
>>>> +	 */
>>>> +	if (path_exist("/proc/iSeries")) {
>>>> +		desc->hyper = HYPER_OS400;
>>>> +		desc->virtype = VIRT_FULL;
>>> ... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.

iSeries is PV, yes. Among others it's also dead :). But I'll let Ben 
comment.

>>>
>>>> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
>>>> +		FILE *fd;
>>>> +		desc->hyper = HYPER_PHYP;
>>>> +		desc->virtype = VIRT_FULL;
>>> Maybe more obvious here for pSeries where p seems to stand for para
>>> http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP

This is slightly more complicated. The ibm,partition-name device tree 
property is defined in sPAPR which is a specification that both pHyp and 
QEMU implement. Right now QEMU does not expose the ibm,partition-name 
property, but there's no reason it will stay that way.

There are a few ways we could try to distinguish QEMU's implementation 
of the pSeries machine and pHyp's implementation of it.

   /proc/device-tree/hmc-managed?

I don't think QEMU will ever implement this property, but at least my 
pHyp reference VM does. If it's there we can use it as a definite marker 
that we are in fact running on pHyp.

   /proc/device-tree/chosen/qemu,graphic-width

Only QEMU puts qemu, properties in the chosen directory. At least the 
current code always sets the graphic-* properties, so if we find one we 
can safely assume we're running on QEMU. We do not know whether we're 
running on KVM yet.

Checking on KVM is slightly more tricky. I think we have 2 options:

   1) Check if /proc/device-tree/cpus/*@0/timebase-frequency is 1000000000.

      If it is, we're emulated (no KVM). If it's not, we're running with 
a native CPU (KVM).

   2) Check whether /proc/device-tree/hypervisor/compatible == "linux,kvm"

     I have a patch in my queue to make the sPAPR compliant pSeries 
machine type in QEMU also ePAPR compliant and expose a /hypervisor node. 
Current versions of QEMU don't do this though, so this would not catch 
QEMU versions < 2.1.

     The nice thing about the ePAPR compliant check is that we'd catch 
non-pSeries machine types as well. We expose this node on all emulated 
Mac machines and on FSL e500 style machines.


Alex

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-22  9:30         ` Alexander Graf
@ 2014-05-28 21:54           ` Ruediger Meier
  2014-05-28 22:29             ` Alexander Graf
  0 siblings, 1 reply; 21+ messages in thread
From: Ruediger Meier @ 2014-05-28 21:54 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Heiko Carstens, Karel Zak, Paul Mackerras, util-linux,
	Stanislav Brabec, Petr Uzel, Ben Herrenschmidt

Thank you all for your comments!

Patch set updated here:
https://github.com/karelzak/util-linux/pull/87


On Thursday 22 May 2014, Alexander Graf wrote:
> >>>> +	if (path_exist("/proc/iSeries")) {
> >>>> +		desc->hyper = HYPER_OS400;
> >>>> +		desc->virtype = VIRT_FULL;
> >>> ... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.
> 
> iSeries is PV, yes. Among others it's also dead :). But I'll let Ben 
> comment.

We set VIRT_PARA now for iSeries and (real) pSeries. 
 
> >>>
> >>>> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
> >>>> +		FILE *fd;
> >>>> +		desc->hyper = HYPER_PHYP;
> >>>> +		desc->virtype = VIRT_FULL;
> >>> Maybe more obvious here for pSeries where p seems to stand for para
> >>> http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP
> 
> This is slightly more complicated. The ibm,partition-name device tree 
> property is defined in sPAPR which is a specification that both pHyp and 
> QEMU implement. Right now QEMU does not expose the ibm,partition-name 
> property, but there's no reason it will stay that way.
> 
> There are a few ways we could try to distinguish QEMU's implementation 
> of the pSeries machine and pHyp's implementation of it.
> 
>    /proc/device-tree/hmc-managed?
> 
> I don't think QEMU will ever implement this property, but at least my 
> pHyp reference VM does. If it's there we can use it as a definite marker 
> that we are in fact running on pHyp.
> 
>    /proc/device-tree/chosen/qemu,graphic-width

OK, we do it like this for now
  if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")
      && path_exist(_PATH_PROC_DEVICETREE "/hmc-managed?")
      && !path_exist(_PATH_PROC_DEVICETREE "/chosen/qemu,graphic-width")) {
  desc->hyper = HYPER_PHYP;
  desc->virtype = VIRT_PARA;
  ....  

Haven't yet done something about the "pSeries on QEMU/KVM" detection
according to the comments below. Could be that our existing KVM detection
would catch it already.

IMO we should add a script to easily make correct (and complete) /sys, /proc
dumps. So users who own exotic machines could send us test data.

> Only QEMU puts qemu, properties in the chosen directory. At least the 
> current code always sets the graphic-* properties, so if we find one we 
> can safely assume we're running on QEMU. We do not know whether we're 
> running on KVM yet.
> 
> Checking on KVM is slightly more tricky. I think we have 2 options:
> 
>    1) Check if /proc/device-tree/cpus/*@0/timebase-frequency is 1000000000.
> 
>       If it is, we're emulated (no KVM). If it's not, we're running with 
> a native CPU (KVM).
> 
>    2) Check whether /proc/device-tree/hypervisor/compatible == "linux,kvm"
> 
>      I have a patch in my queue to make the sPAPR compliant pSeries 
> machine type in QEMU also ePAPR compliant and expose a /hypervisor node. 
> Current versions of QEMU don't do this though, so this would not catch 
> QEMU versions < 2.1.
> 
>      The nice thing about the ePAPR compliant check is that we'd catch 
> non-pSeries machine types as well. We expose this node on all emulated 
> Mac machines and on FSL e500 style machines.
> 
> 
> Alex
> 
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors
  2014-05-28 21:54           ` Ruediger Meier
@ 2014-05-28 22:29             ` Alexander Graf
  0 siblings, 0 replies; 21+ messages in thread
From: Alexander Graf @ 2014-05-28 22:29 UTC (permalink / raw)
  To: Ruediger Meier
  Cc: Heiko Carstens, Karel Zak, Paul Mackerras, util-linux,
	Stanislav Brabec, Petr Uzel, Ben Herrenschmidt


On 28.05.14 23:54, Ruediger Meier wrote:
> Thank you all for your comments!
>
> Patch set updated here:
> https://github.com/karelzak/util-linux/pull/87
>
>
> On Thursday 22 May 2014, Alexander Graf wrote:
>>>>>> +	if (path_exist("/proc/iSeries")) {
>>>>>> +		desc->hyper = HYPER_OS400;
>>>>>> +		desc->virtype = VIRT_FULL;
>>>>> ... shouldn't this be VIRT_PARA? Somebody who knows this may correct this.
>> iSeries is PV, yes. Among others it's also dead :). But I'll let Ben
>> comment.
> We set VIRT_PARA now for iSeries and (real) pSeries.
>   
>>>>>> +	} else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")) {
>>>>>> +		FILE *fd;
>>>>>> +		desc->hyper = HYPER_PHYP;
>>>>>> +		desc->virtype = VIRT_FULL;
>>>>> Maybe more obvious here for pSeries where p seems to stand for para
>>>>> http://www.ibm.com/developerworks/aix/library/au-syspvirtualization/index.html?S_TACT=105AGX99&S_CMP=CP
>> This is slightly more complicated. The ibm,partition-name device tree
>> property is defined in sPAPR which is a specification that both pHyp and
>> QEMU implement. Right now QEMU does not expose the ibm,partition-name
>> property, but there's no reason it will stay that way.
>>
>> There are a few ways we could try to distinguish QEMU's implementation
>> of the pSeries machine and pHyp's implementation of it.
>>
>>     /proc/device-tree/hmc-managed?
>>
>> I don't think QEMU will ever implement this property, but at least my
>> pHyp reference VM does. If it's there we can use it as a definite marker
>> that we are in fact running on pHyp.
>>
>>     /proc/device-tree/chosen/qemu,graphic-width
> OK, we do it like this for now
>    if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name")
>        && path_exist(_PATH_PROC_DEVICETREE "/hmc-managed?")
>        && !path_exist(_PATH_PROC_DEVICETREE "/chosen/qemu,graphic-width")) {
>    desc->hyper = HYPER_PHYP;
>    desc->virtype = VIRT_PARA;
>    ....
>
> Haven't yet done something about the "pSeries on QEMU/KVM" detection
> according to the comments below. Could be that our existing KVM detection
> would catch it already.

I very much doubt it would, but if you give me a quick pointer I could 
verify.

I'll comment on more things inline on the github request.


Alex


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-05-28 22:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20 15:42 [PATCH 0/5] lscpu: improve hypervisor detection Ruediger Meier
2014-05-20 15:42 ` [PATCH 1/5] lscpu: minor cleanup and " Ruediger Meier
2014-05-20 15:42 ` [PATCH 2/5] tests: add vbox lscpu dump Ruediger Meier
2014-05-20 15:42 ` [PATCH 3/5] lscpu: detect OS/400 and pHyp hypervisors Ruediger Meier
2014-05-21  7:37   ` Karel Zak
2014-05-21  9:43     ` Ruediger Meier
2014-05-21 12:41       ` Karel Zak
2014-05-21 23:03   ` Ruediger Meier
2014-05-22  8:48     ` Karel Zak
2014-05-22  9:08       ` Heiko Carstens
2014-05-22  9:30         ` Alexander Graf
2014-05-28 21:54           ` Ruediger Meier
2014-05-28 22:29             ` Alexander Graf
2014-05-20 15:42 ` [PATCH 4/5] lscpu: improve vmware detection Ruediger Meier
2014-05-20 18:40   ` Ruediger Meier
2014-05-20 15:42 ` [PATCH 5/5] lscpu: avoid compiler warnings Ruediger Meier
2014-05-21  8:10   ` Karel Zak
2014-05-20 16:34 ` [PATCH 0/5] lscpu: improve hypervisor detection Stanislav Brabec
2014-05-20 18:13   ` Ruediger Meier
2014-05-21  8:24   ` Karel Zak
2014-05-21 22:29 ` Ruediger Meier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox