[CRIU] [PATCH 09/12] cpuinfo: x86 -- Add protobuf entry
Cyrill Gorcunov
gorcunov at openvz.org
Tue Sep 30 10:18:52 PDT 2014
At the moment only x86 is covered, ARM needs own handler.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-show.c | 1 +
image-desc.c | 1 +
include/image-desc.h | 1 +
include/magic.h | 1 +
include/protobuf-desc.h | 5 +++--
protobuf-desc.c | 1 +
protobuf/Makefile | 1 +
protobuf/cpuinfo.proto | 25 +++++++++++++++++++++++++
8 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 protobuf/cpuinfo.proto
diff --git a/cr-show.c b/cr-show.c
index 0e1a2c6dccf7..b70e9d16a010 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -322,6 +322,7 @@ static struct show_image_info show_infos[] = {
SHOW_PLAIN(TUNFILE),
SHOW_PLAINS(EXT_FILE),
SHOW_PLAIN(IRMAP_CACHE),
+ SHOW_PLAIN(CPUINFO),
{ FILE_LOCKS_MAGIC, PB_FILE_LOCK, false, NULL, "3:%u", },
{ TCP_STREAM_MAGIC, PB_TCP_STREAM, true, show_tcp_stream, "1:%u 2:%u 3:%u 4:%u 12:%u", },
diff --git a/image-desc.c b/image-desc.c
index 616cbe9dd558..3257b5dbfe51 100644
--- a/image-desc.c
+++ b/image-desc.c
@@ -79,6 +79,7 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
FD_ENTRY(TUNFILE, "tunfile"),
FD_ENTRY(CGROUP, "cgroup"),
FD_ENTRY(TIMERFD, "timerfd"),
+ FD_ENTRY(CPUINFO, "cpuinfo"),
[CR_FD_STATS] = {
.fmt = "stats-%s",
diff --git a/include/image-desc.h b/include/image-desc.h
index 9cfca299aeae..d66d2194ebe7 100644
--- a/include/image-desc.h
+++ b/include/image-desc.h
@@ -87,6 +87,7 @@ enum {
CR_FD_FILE_LOCKS_PID,
CR_FD_IRMAP_CACHE,
+ CR_FD_CPUINFO,
CR_FD_SIGNAL,
CR_FD_PSIGNAL,
diff --git a/include/magic.h b/include/magic.h
index 5192a60a9b5d..ff00a51ff3ee 100644
--- a/include/magic.h
+++ b/include/magic.h
@@ -74,6 +74,7 @@
#define TUNFILE_MAGIC 0x57143751 /* Kalyazin */
#define CGROUP_MAGIC 0x59383330 /* Tikhvin */
#define TIMERFD_MAGIC 0x50493712 /* Korocha */
+#define CPUINFO_MAGIC 0x61404013 /* Nyandoma */
#define IFADDR_MAGIC RAW_IMAGE_MAGIC
#define ROUTE_MAGIC RAW_IMAGE_MAGIC
diff --git a/include/protobuf-desc.h b/include/protobuf-desc.h
index 01c9f4c153bf..f8b6d3330ae1 100644
--- a/include/protobuf-desc.h
+++ b/include/protobuf-desc.h
@@ -52,14 +52,15 @@ enum {
PB_IRMAP_CACHE,
PB_CGROUP,
PB_TIMERFD,
+ PB_CPUINFO,
/* PB_AUTOGEN_STOP */
PB_PAGEMAP_HEAD,
PB_IDS,
PB_SIGACT,
- PB_NETDEV,
- PB_REMAP_FPATH, /* 50 */
+ PB_NETDEV, /* 50 */
+ PB_REMAP_FPATH,
PB_SK_QUEUES,
PB_IPCNS_MSG,
PB_IPCNS_MSG_ENT,
diff --git a/protobuf-desc.c b/protobuf-desc.c
index b97418bb2fd9..ba1b37754fe3 100644
--- a/protobuf-desc.c
+++ b/protobuf-desc.c
@@ -59,6 +59,7 @@
#include "protobuf/tun.pb-c.h"
#include "protobuf/cgroup.pb-c.h"
#include "protobuf/timerfd.pb-c.h"
+#include "protobuf/cpuinfo.pb-c.h"
struct cr_pb_message_desc cr_pb_descs[PB_MAX];
diff --git a/protobuf/Makefile b/protobuf/Makefile
index 7f6485b75607..509f3c33cf61 100644
--- a/protobuf/Makefile
+++ b/protobuf/Makefile
@@ -14,6 +14,7 @@ proto-obj-y += core.o
proto-obj-y += core-x86.o
proto-obj-y += core-arm.o
proto-obj-y += core-aarch64.o
+proto-obj-y += cpuinfo.o
proto-obj-y += inventory.o
proto-obj-y += fdinfo.o
proto-obj-y += fown.o
diff --git a/protobuf/cpuinfo.proto b/protobuf/cpuinfo.proto
new file mode 100644
index 000000000000..a62ff19b5c83
--- /dev/null
+++ b/protobuf/cpuinfo.proto
@@ -0,0 +1,25 @@
+message cpuinfo_x86_entry {
+ enum vendor {
+ UNKNOWN = 0;
+ INTEL = 1;
+ AMD = 2;
+ }
+
+ required vendor vendor_id = 1;
+ required uint32 cpu_family = 2;
+ required uint32 model = 3;
+ required uint32 stepping = 4;
+ required uint32 capability_ver = 5;
+ repeated uint32 capability = 6;
+
+ optional string model_id = 7;
+}
+
+message cpuinfo_entry {
+ /*
+ * Usually on SMP system there should be same CPUs
+ * installed, but it might happen that system carries
+ * various CPUs so @repeated used.
+ */
+ repeated cpuinfo_x86_entry x86_entry = 1;
+}
--
1.9.3
More information about the CRIU
mailing list