[PATCH 4/4] virNodeParseSocket: Take ARM into account

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michal Privoznik <miso.privoznik@xxxxxxxxx>

The virNodeParseSocket() function tries to get socked ID from
'topology/physical_package_id' file. However, on some architectures
the file contains the -1 constant which makes in turn libvirt think
the info extraction was unsuccessful. If that's the case, we need to
overwrite the obtained integer with zero like we are doing for other
architectures.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 cfg.mk                                                       |  2 +-
 src/nodeinfo.c                                               |  6 ++++--
 tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo          | 12 ++++++++++++
 tests/nodeinfodata/linux-armv6l-raspberrypi.expected         |  1 +
 .../nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_id |  1 +
 .../linux-raspberrypi/cpu/cpu0/topology/core_siblings        |  1 +
 .../linux-raspberrypi/cpu/cpu0/topology/core_siblings_list   |  1 +
 .../linux-raspberrypi/cpu/cpu0/topology/physical_package_id  |  1 +
 .../linux-raspberrypi/cpu/cpu0/topology/thread_siblings      |  1 +
 .../linux-raspberrypi/cpu/cpu0/topology/thread_siblings_list |  1 +
 .../linux-raspberrypi/cpu/cpuidle/current_driver             |  1 +
 .../linux-raspberrypi/cpu/cpuidle/current_governor_ro        |  1 +
 tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max          |  1 +
 tests/nodeinfodata/linux-raspberrypi/cpu/offline             |  1 +
 tests/nodeinfodata/linux-raspberrypi/cpu/online              |  1 +
 tests/nodeinfodata/linux-raspberrypi/cpu/possible            |  1 +
 tests/nodeinfodata/linux-raspberrypi/cpu/present             |  1 +
 tests/nodeinfotest.c                                         |  1 +
 18 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo
 create mode 100644 tests/nodeinfodata/linux-armv6l-raspberrypi.expected
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_id
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings_list
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/physical_package_id
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings_list
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_driver
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_governor_ro
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/offline
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/online
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/possible
 create mode 100644 tests/nodeinfodata/linux-raspberrypi/cpu/present

diff --git a/cfg.mk b/cfg.mk
index 1f07639..77409a3 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1124,4 +1124,4 @@ exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
   ^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
 
 exclude_file_name_regexp--sc_prohibit_empty_first_line = \
-  ^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/vmwareverdata/fusion-5.0.3.txt)$$
+  ^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/vmwareverdata/fusion-5.0.3.txt|tests/nodeinfodata/linux-raspberrypi/cpu/offline)$$
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 56690b8..4c96024 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -398,8 +398,10 @@ virNodeParseSocket(const char *dir,
     if (arch == VIR_ARCH_PPC || arch == VIR_ARCH_PPCLE ||
         arch == VIR_ARCH_PPC64 || arch == VIR_ARCH_PPC64LE ||
         arch == VIR_ARCH_PPCEMB ||
-        arch == VIR_ARCH_S390 || arch == VIR_ARCH_S390X) {
-        /* ppc and s390(x) has -1 */
+        arch == VIR_ARCH_S390 || arch == VIR_ARCH_S390X ||
+        arch == VIR_ARCH_ARMV6L || arch == VIR_ARCH_ARMV7L ||
+        arch == VIR_ARCH_ARMV7B || arch == VIR_ARCH_AARCH64) {
+        /* arm, ppc and s390(x) has -1 */
         if (ret < 0)
             ret = 0;
     }
diff --git a/tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo b/tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo
new file mode 100644
index 0000000..8857da0
--- /dev/null
+++ b/tests/nodeinfodata/linux-armv6l-raspberrypi.cpuinfo
@@ -0,0 +1,12 @@
+Processor       : ARMv6-compatible processor rev 7 (v6l)
+BogoMIPS        : 697.95
+Features        : swp half thumb fastmult vfp edsp java tls 
+CPU implementer : 0x41
+CPU architecture: 7
+CPU variant     : 0x0
+CPU part        : 0xb76
+CPU revision    : 7
+
+Hardware        : BCM2708
+Revision        : 1000003
+Serial          : 000000008fbfc895
diff --git a/tests/nodeinfodata/linux-armv6l-raspberrypi.expected b/tests/nodeinfodata/linux-armv6l-raspberrypi.expected
new file mode 100644
index 0000000..146bd07
--- /dev/null
+++ b/tests/nodeinfodata/linux-armv6l-raspberrypi.expected
@@ -0,0 +1 @@
+CPUs: 1/1, MHz: 697, Nodes: 1, Sockets: 1, Cores: 1, Threads: 1
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_id b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_id
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_id
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings
@@ -0,0 +1 @@
+1
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings_list b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings_list
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/core_siblings_list
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/physical_package_id b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/physical_package_id
new file mode 100644
index 0000000..3a2e3f4
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/physical_package_id
@@ -0,0 +1 @@
+-1
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings
@@ -0,0 +1 @@
+1
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings_list b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings_list
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpu0/topology/thread_siblings_list
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_driver b/tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_driver
new file mode 100644
index 0000000..621e94f
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_driver
@@ -0,0 +1 @@
+none
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_governor_ro b/tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_governor_ro
new file mode 100644
index 0000000..c35a724
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/cpuidle/current_governor_ro
@@ -0,0 +1 @@
+menu
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max b/tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/kernel_max
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/offline b/tests/nodeinfodata/linux-raspberrypi/cpu/offline
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/offline
@@ -0,0 +1 @@
+
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/online b/tests/nodeinfodata/linux-raspberrypi/cpu/online
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/online
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/possible b/tests/nodeinfodata/linux-raspberrypi/cpu/possible
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/possible
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfodata/linux-raspberrypi/cpu/present b/tests/nodeinfodata/linux-raspberrypi/cpu/present
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/nodeinfodata/linux-raspberrypi/cpu/present
@@ -0,0 +1 @@
+0
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 650a674..3c76e5d 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -245,6 +245,7 @@ mymain(void)
         {"test6", VIR_ARCH_X86_64},
         {"test7", VIR_ARCH_X86_64},
         {"test8", VIR_ARCH_X86_64},
+        {"raspberrypi", VIR_ARCH_ARMV6L},
     };
 
     if (virInitialize() < 0)
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]