Skip to contentSkip to conversation

Rework gcov support in Xen

RFC PATCH Superseded Wei Liu 3 participants 23 messages Oct 6, 2016 – Oct 7, 2016

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover Rework gcov support in Xen

The original implementation of gcov support in Xen has several limitations:

1. The internal data structures are tied to gcc 3.4 format.
2. The sysctl interface is tied to gcc 3.4 format.
3. The gcov type definition is wrong, doesn't work with 32 bit hypervisor, which means arm32 wouldn't work.

Since the hypervisor interface is sysctl, we have the liberty to not care about backward compatibility. This series completely rewrites the gcov support inside Xen.

1. Support both gcc 3.4 and 4.7 format, configurable via Kconfig.
2. The sysctl interface is not tied to particular gcc format version.
3. Should work with arm32.

I have tested using both formats on x86. I was able to get gcov to recognise the extracted data. I haven't really analyse the data in detail though.

The patch series mostly consists of two parts. The meat is in the first few patches. A few other patches are added to make available automatic format detection.

There are still some rough edges, but I feel that this is good enough to post so that people can review the sysctl interface.

Wei.

Wei Liu (8):
Kconfig: add BROKEN config
xen: delete gcno files in clean target
xen, tools: rip out old gcov implementation
gcov: add new interface and 3.4 and 4.7 format support
gcov: userspace tools to extract and split gcov data Config.mk: expand cc-ver a bit
Config.mk: introduce cc-ifversion
gcov: provide the capability to select gcov format automatically

 Config.mk                   |  13 +-
 tools/misc/Makefile         |   2 +-
 tools/misc/xencov.c         | 111 +++++++-------
 tools/misc/xencov_split     | 288 ++++++++++++-----------------------
 xen/Kconfig                 |   3 +
 xen/Kconfig.debug           |  30 +++-
 xen/Makefile                |   1 +
 xen/common/gcov/Makefile    |   7 +-
 xen/common/gcov/gcc_3_4.c   | 363 ++++++++++++++++++++++++++++++++++++++++++++
 xen/common/gcov/gcc_4_7.c   | 201 ++++++++++++++++++++++++
 xen/common/gcov/gcov.c      | 305 ++++++++++++++++++++-----------------
 xen/common/gcov/gcov.h      |  36 +++++
 xen/common/gcov/gcov_base.c |  64 ++++++++
 xen/common/sysctl.c         |   7 +-
 xen/include/public/gcov.h   | 115 --------------
 xen/include/public/sysctl.h |  59 ++++---
 xen/include/xen/gcov.h      |  94 +-----------
 17 files changed, 1070 insertions(+), 629 deletions(-)
 create mode 100644 xen/common/gcov/gcc_3_4.c
 create mode 100644 xen/common/gcov/gcc_4_7.c
 create mode 100644 xen/common/gcov/gcov.h
 create mode 100644 xen/common/gcov/gcov_base.c
 delete mode 100644 xen/include/public/gcov.h
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

RFC PATCH 1/8 Kconfig: add BROKEN config

Used to hide feature that is completely broken.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Doug Goldstein <[email protected]>

---
 xen/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
xen/Kconfig +3 -0
index 0fe7a1a..942001e 100644
@@ -12,6 +12,9 @@ config ARCH
 	string
 	option env="ARCH"
 
+config BROKEN
+       bool
+
 source "arch/$SRCARCH/Kconfig"
 
 config XEN_FULLVERSION
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#3 lore raw

RFC PATCH 2/8 xen: delete gcno files in clean target

In reply to Wei Liu

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/Makefile | 1 +
 1 file changed, 1 insertion(+)
xen/Makefile +1 -0
index c511330..80fff6d 100644
@@ -117,6 +117,7 @@ _clean: delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C test clean
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
 	find . \( -name "*.o" -o -name ".*.d" \) -exec rm -f {} \;
+	find . -name "*.gcno" -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
 	rm -f include/asm-*/asm-offsets.h
 	rm -f .banner
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#16 lore raw

RFC PATCH 6/8 Config.mk: expand cc-ver a bit

In reply to Wei Liu

... so that we can do other comparisons as well.

No functional change.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 Config.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Config.mk +4 -4
index 3c3ff68..a97036e 100644
@@ -112,17 +112,17 @@ endef
 
 cc-options-add = $(foreach o,$(3),$(call cc-option-add,$(1),$(2),$(o)))
 
-# cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
-# Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
+# cc-ver: Check compiler against the version requirement. Return boolean 'y'/'n'.
+# Usage: ifeq ($(call cc-ver,$(CC),-ge,0x030400),y)
 cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
-           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
+           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) $(2) $$(($(3))) ]; \
            then echo y; else echo n; fi ;)
 
 # cc-ver-check: Check compiler is at least specified version, else fail.
 # Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
 cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
 define cc-ver-check-closure
-    ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
+    ifeq ($$(call cc-ver,$$($(1)),-ge,$(2)),n)
         override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1;
         cc-option := n
     endif
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#20 lore raw

RFC PATCH 8/8 gcov: provide the capability to select gcov format automatically

In reply to Wei Liu

And make it the default in Kconfig.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/Kconfig.debug        | 9 ++++++++-
 xen/common/gcov/Makefile | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)
xen/Kconfig.debug +8 -1
index a8eb668..03a58a7 100644
@@ -38,10 +38,17 @@ config GCOV
 choice
 	prompt "Specify Gcov format"
 	depends on GCOV
-	default GCOV_FORMAT_4_7
+	default GCOV_FORMAT_AUTODETECT
 	---help---
 	The gcov format is determined by gcc version.
 
+	If unsure, choose "Autodetect".
+
+config GCOV_FORMAT_AUTODETECT
+       bool "Autodetect"
+       ---help---
+       Automatically select gcov format based on GCC version.
+
 config GCOV_FORMAT_4_7
        bool "GCC 4.7 format"
        ---help---
xen/common/gcov/Makefile +2 -0
index 03ac1e5..c778334 100644
@@ -1,3 +1,5 @@
 obj-y += gcov_base.o gcov.o
 obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_3_4.o
 obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_4_7.o
+obj-$(CONFIG_GCOV_FORMAT_AUTODETECT) += $(call cc-ifversion, -ge, 0x040700, \
+						gcc_4_7.o, gcc_3_4.o)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#13 lore raw

RFC PATCH 5/8 gcov: userspace tools to extract and split gcov data

In reply to Wei Liu

Provide two tools: a small C program to extract data from hypervisor and a python script to split data into multiple files.

The file xencov.c is salvaged and modified from the original xencov.c.

---
Cc: Ian Jackson <[email protected]>

---
 tools/misc/Makefile     |   6 ++
 tools/misc/xencov.c     | 148 ++++++++++++++++++++++++++++++++++++++++++++++++
 tools/misc/xencov_split | 100 ++++++++++++++++++++++++++++++++
 3 files changed, 254 insertions(+)
 create mode 100644 tools/misc/xencov.c
 create mode 100755 tools/misc/xencov_split
tools/misc/Makefile +6 -0
index 5ba6672..c029401 100644
@@ -13,6 +13,7 @@ CFLAGS += $(CFLAGS_libxenstore)
 INSTALL_BIN-$(CONFIG_X86)      += xen-cpuid
 INSTALL_BIN-$(CONFIG_X86)      += xen-detect
 INSTALL_BIN                    += xencons
+INSTALL-BIN                    += xencov_split
 INSTALL_BIN += $(INSTALL_BIN-y)
 
 # Everything to be installed in regular sbin/
@@ -24,6 +25,7 @@ INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd
 INSTALL_SBIN-$(CONFIG_X86)     += xen-mfndump
 INSTALL_SBIN                   += xen-ringwatch
 INSTALL_SBIN                   += xen-tmem-list-parse
+INSTALL_SBIN                   += xencov
 INSTALL_SBIN                   += xenlockprof
 INSTALL_SBIN                   += xenperf
 INSTALL_SBIN                   += xenpm
@@ -41,6 +43,7 @@ TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
 TARGETS_COPY += xen-bugtool
 TARGETS_COPY += xen-ringwatch
 TARGETS_COPY += xencons
+TARGETS_COPY += xencov_split
 TARGETS_COPY += xenpvnetboot
 
 # Everything which needs to be built
@@ -102,4 +105,7 @@ xen-livepatch: xen-livepatch.o
 xen-lowmemd: xen-lowmemd.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
+xencov: xencov.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+
 -include $(DEPS)
tools/misc/xencov.c new file +148 -0

148 lines not on this page · raw message

tools/misc/xencov_split new file +100 -0

100 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#19 lore raw

RFC PATCH 7/8 Config.mk: introduce cc-ifversion

In reply to Wei Liu

It returns different string depending on compiler version.

No user yet.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 Config.mk | 5 +++++
 1 file changed, 5 insertions(+)
Config.mk +5 -0
index a97036e..d5834cd 100644
@@ -128,6 +128,11 @@ define cc-ver-check-closure
     endif
 endef
 
+# cc-ifversion: Check compiler version and take branch accordingly
+# Usage $(call cc-ifversion, -lt, 0x040700, string_if_y, string_if_n)
+cc-ifversion = $(shell [ $(call cc-ver,$(CC),$(1),$(2)) = "y" ] \
+				&& echo $(3) || echo $(4))
+
 # Require GCC v4.1+
 check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")
 $(eval $(check-y))
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#7 lore raw

RFC PATCH 4/8 gcov: add new interface and 3.4 and 4.7 format support

In reply to Wei Liu

A new sysctl interface for passing gcov data back to userspace. The new interface uses a customised record file format. The new sysctl reuses original sysctl number but renames the op to gcov_op.

Both gcc 3.4 and 4.7 format are supported. The code is rewritten so that a new format can be easily added in the future. Version specific code is grouped into different files. The format one needs to use can be picked via Kconfig. The default format is 4.7 format.

Userspace programs to handle extracted data will come in a later patch.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/Kconfig.debug           |  24 ++-
 xen/common/gcov/Makefile    |   3 +
 xen/common/gcov/gcc_3_4.c   | 363 ++++++++++++++++++++++++++++++++++++++++++++
 xen/common/gcov/gcc_4_7.c   | 201 ++++++++++++++++++++++++
 xen/common/gcov/gcov.c      | 254 +++++++++++++++++++++++++++++++
 xen/common/gcov/gcov.h      |  36 +++++
 xen/common/gcov/gcov_base.c |  64 ++++++++
 xen/common/sysctl.c         |   8 +
 xen/include/public/sysctl.h |  37 ++++-
 xen/include/xen/gcov.h      |   9 ++
 10 files changed, 993 insertions(+), 6 deletions(-)
 create mode 100644 xen/common/gcov/gcc_3_4.c
 create mode 100644 xen/common/gcov/gcc_4_7.c
 create mode 100644 xen/common/gcov/gcov.c
 create mode 100644 xen/common/gcov/gcov.h
 create mode 100644 xen/common/gcov/gcov_base.c
 create mode 100644 xen/include/xen/gcov.h
xen/Kconfig.debug +19 -5
index 056d5da..a8eb668 100644
@@ -30,16 +30,30 @@ config FRAME_POINTER
 
 config GCOV
        bool "Gcov Support"
-       depends on BROKEN
        ---help---
          Enable gcov (a test coverage program in GCC) support.
 
-         Currently the data structure and hypercall interface are tied
-         to GCC 3.4 gcov format. You need to have a version of GCC
-         that is compatible with that format to make gcov work.
-
          If unsure, say N here.
 
+choice
+	prompt "Specify Gcov format"
+	depends on GCOV
+	default GCOV_FORMAT_4_7
+	---help---
+	The gcov format is determined by gcc version.
+
+config GCOV_FORMAT_4_7
+       bool "GCC 4.7 format"
+       ---help---
+       Select this option to use the format specified in GCC 4.7.
+
+config GCOV_FORMAT_3_4
+       bool "GCC 3.4 format"
+       ---help---
+       Select this option to use the format specified in GCC 3.4.
+
+endchoice
+
 config LOCK_PROFILE
 	bool "Lock Profiling"
 	---help---
xen/common/gcov/Makefile +3 -0
index e69de29..03ac1e5 100644
@@ -0,0 +1,3 @@
+obj-y += gcov_base.o gcov.o
+obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_3_4.o
+obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_4_7.o
xen/common/gcov/gcc_3_4.c new file +363 -0

363 lines not on this page · raw message

xen/common/gcov/gcc_4_7.c new file +201 -0

201 lines not on this page · raw message

xen/common/gcov/gcov.c new file +254 -0

254 lines not on this page · raw message

xen/common/gcov/gcov.h new file +36 -0
new file mode 100644
index 0000000..51810b5
@@ -0,0 +1,36 @@
+#ifndef _GCOV_H_
+#define _GCOV_H_
+
+#include <xen/guest_access.h>
+#include <xen/types.h>
+
+/*
+ * Profiling data types used for gcc 3.4 and above - these are defined by
+ * gcc and need to be kept as close to the original definition as possible to
+ * remain compatible.
+ */
+#define GCOV_DATA_MAGIC		((unsigned int) 0x67636461)
+#define GCOV_TAG_FUNCTION	((unsigned int) 0x01000000)
+#define GCOV_TAG_COUNTER_BASE	((unsigned int) 0x01a10000)
+#define GCOV_TAG_FOR_COUNTER(count)					\
+	(GCOV_TAG_COUNTER_BASE + ((unsigned int) (count) << 17))
+
+#if BITS_PER_LONG >= 64
+typedef long gcov_type;
+#else
+typedef long long gcov_type;
+#endif
+
+/* Opaque gcov_info -- tied to specific gcc gcov formats */
+struct gcov_info;
+
+void gcov_info_link(struct gcov_info *info);
+struct gcov_info *gcov_info_next(struct gcov_info *info);
+void gcov_info_reset(struct gcov_info *info);
+const char *gcov_info_filename(struct gcov_info *info);
+size_t gcov_info_to_gcda(char *buffer, struct gcov_info *info);
+
+size_t gcov_store_u32(void *buffer, size_t off, u32 v);
+size_t gcov_store_u64(void *buffer, size_t off, u64 v);
+
+#endif	/* _GCOV_H_ */
xen/common/gcov/gcov_base.c new file +64 -0

64 lines not on this page · raw message

xen/common/sysctl.c +8 -0
index 2cac451..03cca5c 100644
@@ -28,6 +28,7 @@
 #include <xsm/xsm.h>
 #include <xen/pmstat.h>
 #include <xen/livepatch.h>
+#include <xen/gcov.h>
 
 long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
 {
@@ -395,6 +396,13 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
     }
     break;
 
+#ifdef CONFIG_GCOV
+    case XEN_SYSCTL_gcov_op:
+        ret = sysctl_gcov_op(&op->u.gcov_op);
+        copyback = 1;
+        break;
+#endif
+
 #ifdef CONFIG_HAS_PCI
     case XEN_SYSCTL_pcitopoinfo:
     {
xen/include/public/sysctl.h +36 -1
index a939fa9..0be3dd5 100644
@@ -665,6 +665,40 @@ struct xen_sysctl_scheduler_op {
 typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t);
 
+/*
+ * Output format of gcov data:
+ *
+ * XEN_GCOV_FORMAT_MAGIC XEN_GCOV_RECORD ... XEN_GCOV_RECORD
+ *
+ * That is, one magic number followed by 0 or more record.
+ *
+ * The magic number is stored as an uint32_t field.
+ *
+ * The record is packed and variable in length. It has the form:
+ *
+ *  filename: a NULL terminated path name extracted from gcov, used to
+ *            create the name of gcda file.
+ *  size:     a uint32_t field indicating the size of the payload, the
+ *            unit is byte.
+ *  payload:  the actual payload, length is `size' bytes.
+ *
+ * Userspace tool will split the record to different files.
+ */
+
+#define XEN_GCOV_FORMAT_MAGIC    0x58434f56 /* XCOV */
+
+#define XEN_SYSCTL_GCOV_get_size 0 /* Get total size of output data */
+#define XEN_SYSCTL_GCOV_read     1 /* Read output data */
+#define XEN_SYSCTL_GCOV_reset    2 /* Reset all counters */
+
+struct xen_sysctl_gcov_op {
+    uint32_t cmd;
+    uint32_t size; /* IN/OUT: size of the buffer  */
+    XEN_GUEST_HANDLE_64(char) buffer; /* OUT */
+};
+typedef struct xen_sysctl_gcov_op xen_sysctl_gcov_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_gcov_op_t);
+
 #define XEN_SYSCTL_PSR_CMT_get_total_rmid            0
 #define XEN_SYSCTL_PSR_CMT_get_l3_upscaling_factor   1
 /* The L3 cache size is returned in KB unit */
@@ -1073,7 +1107,7 @@ struct xen_sysctl {
 #define XEN_SYSCTL_numainfo                      17
 #define XEN_SYSCTL_cpupool_op                    18
 #define XEN_SYSCTL_scheduler_op                  19
-/* #define XEN_SYSCTL_coverage_op                   20 */
+#define XEN_SYSCTL_gcov_op                       20
 #define XEN_SYSCTL_psr_cmt_op                    21
 #define XEN_SYSCTL_pcitopoinfo                   22
 #define XEN_SYSCTL_psr_cat_op                    23
@@ -1102,6 +1136,7 @@ struct xen_sysctl {
         struct xen_sysctl_lockprof_op       lockprof_op;
         struct xen_sysctl_cpupool_op        cpupool_op;
         struct xen_sysctl_scheduler_op      scheduler_op;
+        struct xen_sysctl_gcov_op           gcov_op;
         struct xen_sysctl_psr_cmt_op        psr_cmt_op;
         struct xen_sysctl_psr_cat_op        psr_cat_op;
         struct xen_sysctl_tmem_op           tmem_op;
xen/include/xen/gcov.h new file +9 -0
new file mode 100644
index 0000000..8b5d914
@@ -0,0 +1,9 @@
+#ifndef _XEN_GCOV_H
+#define _XEN_GCOV_H
+
+#ifdef CONFIG_GCOV
+#include <public/sysctl.h>
+int sysctl_gcov_op(xen_sysctl_gcov_op_t *op);
+#endif
+
+#endif	/* _XEN_GCOV_H */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#6 lore raw

RFC PATCH 3/8 xen, tools: rip out old gcov implementation

In reply to Wei Liu

The internal data structure and code are tied to an old gcov format. It's easier to just redo everything from scratch.

Salvage the reusable parts: leave xen/common/gcov and an empty Makefile there, leave gcov support in Kconfig but mark that as broken. Also reserve the sysctl number for later use (but delete relevant sysctl structures).

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/misc/Makefile         |   6 --
 tools/misc/xencov.c         | 147 -----------------------------
 tools/misc/xencov_split     | 188 ------------------------------------
 xen/Kconfig.debug           |   1 +
 xen/common/gcov/Makefile    |   2 -
 xen/common/gcov/gcov.c      | 225 --------------------------------------------
 xen/common/sysctl.c         |   7 --
 xen/include/public/gcov.h   | 115 ----------------------
 xen/include/public/sysctl.h |  38 +-------
 xen/include/xen/gcov.h      |  93 ------------------
 10 files changed, 2 insertions(+), 820 deletions(-)
 delete mode 100644 tools/misc/xencov.c
 delete mode 100755 tools/misc/xencov_split
 delete mode 100644 xen/common/gcov/gcov.c
 delete mode 100644 xen/include/public/gcov.h
 delete mode 100644 xen/include/xen/gcov.h
tools/misc/Makefile +0 -6
index 8152f7b..5ba6672 100644
@@ -13,7 +13,6 @@ CFLAGS += $(CFLAGS_libxenstore)
 INSTALL_BIN-$(CONFIG_X86)      += xen-cpuid
 INSTALL_BIN-$(CONFIG_X86)      += xen-detect
 INSTALL_BIN                    += xencons
-INSTALL_BIN                    += xencov_split
 INSTALL_BIN += $(INSTALL_BIN-y)
 
 # Everything to be installed in regular sbin/
@@ -25,7 +24,6 @@ INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd
 INSTALL_SBIN-$(CONFIG_X86)     += xen-mfndump
 INSTALL_SBIN                   += xen-ringwatch
 INSTALL_SBIN                   += xen-tmem-list-parse
-INSTALL_SBIN                   += xencov
 INSTALL_SBIN                   += xenlockprof
 INSTALL_SBIN                   += xenperf
 INSTALL_SBIN                   += xenpm
@@ -43,7 +41,6 @@ TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
 TARGETS_COPY += xen-bugtool
 TARGETS_COPY += xen-ringwatch
 TARGETS_COPY += xencons
-TARGETS_COPY += xencov_split
 TARGETS_COPY += xenpvnetboot
 
 # Everything which needs to be built
@@ -105,7 +102,4 @@ xen-livepatch: xen-livepatch.o
 xen-lowmemd: xen-lowmemd.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
-xencov: xencov.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
-
 -include $(DEPS)
tools/misc/xencov.c deleted +0 -147

147 lines not on this page · raw message

tools/misc/xencov_split deleted +0 -188

188 lines not on this page · raw message

xen/Kconfig.debug +1 -0
index 12a1193..056d5da 100644
@@ -30,6 +30,7 @@ config FRAME_POINTER
 
 config GCOV
        bool "Gcov Support"
+       depends on BROKEN
        ---help---
          Enable gcov (a test coverage program in GCC) support.
 
xen/common/gcov/Makefile +0 -2
index c9efe6c..e69de29 100644
@@ -1,2 +0,0 @@
-obj-y += gcov.o
-
xen/common/gcov/gcov.c deleted +0 -225

225 lines not on this page · raw message

xen/common/sysctl.c +0 -7
index 8aea6ef..2cac451 100644
@@ -27,7 +27,6 @@
 #include <xen/nodemask.h>
 #include <xsm/xsm.h>
 #include <xen/pmstat.h>
-#include <xen/gcov.h>
 #include <xen/livepatch.h>
 
 long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
@@ -396,12 +395,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
     }
     break;
 
-#ifdef CONFIG_GCOV
-    case XEN_SYSCTL_coverage_op:
-        ret = sysctl_coverage_op(&op->u.coverage_op);
-        break;
-#endif
-
 #ifdef CONFIG_HAS_PCI
     case XEN_SYSCTL_pcitopoinfo:
     {
xen/include/public/gcov.h deleted +0 -115

115 lines not on this page · raw message

xen/include/public/sysctl.h +1 -37
index 418f4bb..a939fa9 100644
@@ -665,41 +665,6 @@ struct xen_sysctl_scheduler_op {
 typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t);
 
-/* XEN_SYSCTL_coverage_op */
-/*
- * Get total size of information, to help allocate
- * the buffer. The pointer points to a 32 bit value.
- */
-#define XEN_SYSCTL_COVERAGE_get_total_size 0
-
-/*
- * Read coverage information in a single run
- * You must use a tool to split them.
- */
-#define XEN_SYSCTL_COVERAGE_read           1
-
-/*
- * Reset all the coverage counters to 0
- * No parameters.
- */
-#define XEN_SYSCTL_COVERAGE_reset          2
-
-/*
- * Like XEN_SYSCTL_COVERAGE_read but reset also
- * counters to 0 in a single call.
- */
-#define XEN_SYSCTL_COVERAGE_read_and_reset 3
-
-struct xen_sysctl_coverage_op {
-    uint32_t cmd;        /* XEN_SYSCTL_COVERAGE_* */
-    union {
-        uint32_t total_size; /* OUT */
-        XEN_GUEST_HANDLE_64(uint8)  raw_info;   /* OUT */
-    } u;
-};
-typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t;
-DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
-
 #define XEN_SYSCTL_PSR_CMT_get_total_rmid            0
 #define XEN_SYSCTL_PSR_CMT_get_l3_upscaling_factor   1
 /* The L3 cache size is returned in KB unit */
@@ -1108,7 +1073,7 @@ struct xen_sysctl {
 #define XEN_SYSCTL_numainfo                      17
 #define XEN_SYSCTL_cpupool_op                    18
 #define XEN_SYSCTL_scheduler_op                  19
-#define XEN_SYSCTL_coverage_op                   20
+/* #define XEN_SYSCTL_coverage_op                   20 */
 #define XEN_SYSCTL_psr_cmt_op                    21
 #define XEN_SYSCTL_pcitopoinfo                   22
 #define XEN_SYSCTL_psr_cat_op                    23
@@ -1137,7 +1102,6 @@ struct xen_sysctl {
         struct xen_sysctl_lockprof_op       lockprof_op;
         struct xen_sysctl_cpupool_op        cpupool_op;
         struct xen_sysctl_scheduler_op      scheduler_op;
-        struct xen_sysctl_coverage_op       coverage_op;
         struct xen_sysctl_psr_cmt_op        psr_cmt_op;
         struct xen_sysctl_psr_cat_op        psr_cat_op;
         struct xen_sysctl_tmem_op           tmem_op;
xen/include/xen/gcov.h deleted +0 -93

93 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#5 lore raw

Re: [RFC PATCH 2/8] xen: delete gcno files in clean target

In reply to Andrew Cooper
Quoted 15 lines · Andrew Cooper
Quoted 14 lines · Wei Liu

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/Makefile | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

xen/Makefile _clean: delete-unfresh-files · line 120

Quoted 9 lines
xen/Makefile +1 -0
index c511330..80fff6d 100644
@@ -117,6 +117,7 @@ _clean: delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C test clean
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
 	find . \( -name "*.o" -o -name ".*.d" \) -exec rm -f {} \;
+	find . -name "*.gcno" -exec rm -f {} \;

It would be a little more efficient to add -o -name "*.gcno" to the previous find invocation than to introduce a second.

Sure. I have no idea why I didn't do that.

Quoted 6 lines

~Andrew

Quoted 3 lines
xen/Makefile +0 -0
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
 	rm -f include/asm-*/asm-offsets.h
 	rm -f .banner

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Re: [RFC PATCH 2/8] xen: delete gcno files in clean target

In reply to Wei Liu
Quoted 19 lines · Wei Liu

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/Makefile | 1 +
 1 file changed, 1 insertion(+)
xen/Makefile +0 -0
index c511330..80fff6d 100644

xen/Makefile _clean: delete-unfresh-files · line 120

Quoted 4 lines
xen/Makefile +1 -0
@@ -117,6 +117,7 @@ _clean: delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C test clean
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
 	find . \( -name "*.o" -o -name ".*.d" \) -exec rm -f {} \;
+	find . -name "*.gcno" -exec rm -f {} \;

It would be a little more efficient to add -o -name "*.gcno" to the previous find invocation than to introduce a second.

~Andrew

xen/Makefile _clean: delete-unfresh-files · line 123

Quoted 3 lines
xen/Makefile +0 -0
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
 	rm -f include/asm-*/asm-offsets.h
 	rm -f .banner

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw

Re: [RFC PATCH 1/8] Kconfig: add BROKEN config

In reply to Wei Liu

xen/Kconfig config ARCH · line 16

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:
xen/Kconfig +2 -0
@@ -12,6 +12,9 @@ config ARCH
 	string
 	option env="ARCH"
 
+config BROKEN
+       bool

Please use tab indentation, like all the other options here do.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#17 lore raw

Re: [RFC PATCH 6/8] Config.mk: expand cc-ver a bit

In reply to Wei Liu
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:
Config.mk +2 -2
@@ -112,17 +112,17 @@ endef
 
 cc-options-add = $(foreach o,$(3),$(call cc-option-add,$(1),$(2),$(o)))
 
-# cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
-# Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
+# cc-ver: Check compiler against the version requirement. Return boolean 'y'/'n'.
+# Usage: ifeq ($(call cc-ver,$(CC),-ge,0x030400),y)
 cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \

Config.mk endef · line 125

Quoted 10 lines
Config.mk +2 -2
-           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
+           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) $(2) $$(($(3))) ]; \
            then echo y; else echo n; fi ;)
 
 # cc-ver-check: Check compiler is at least specified version, else fail.
 # Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
 cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
 define cc-ver-check-closure
-    ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
+    ifeq ($$(call cc-ver,$$($(1)),-ge,$(2)),n)

Could you keep the dash in the macro, making such invocations look a little more "normal"?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#21 lore raw

Re: [RFC PATCH 8/8] gcov: provide the capability to select gcov format automatically

In reply to Wei Liu

xen/Kconfig.debug config GCOV · line 50

Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:
xen/Kconfig.debug +4 -0
+config GCOV_FORMAT_AUTODETECT
+       bool "Autodetect"
+       ---help---
+       Automatically select gcov format based on GCC version.

Tab indentation again please, and I think help text usually gets indented by another one or two spaces from the "help" or "---help---" keyword's.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#18 lore raw

Re: [RFC PATCH 6/8] Config.mk: expand cc-ver a bit

In reply to Jan Beulich
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:
Config.mk +3 -3
@@ -112,17 +112,17 @@ endef
 
 cc-options-add = $(foreach o,$(3),$(call cc-option-add,$(1),$(2),$(o)))
 
-# cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
-# Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
+# cc-ver: Check compiler against the version requirement. Return boolean 'y'/'n'.
+# Usage: ifeq ($(call cc-ver,$(CC),-ge,0x030400),y)
 cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
-           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
+           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) $(2) $$(($(3))) ]; \
            then echo y; else echo n; fi ;)
 
Quoted 10 lines

Config.mk endef · line 125

Quoted 6 lines
Config.mk +1 -1
 # cc-ver-check: Check compiler is at least specified version, else fail.
 # Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
 cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
 define cc-ver-check-closure
-    ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
+    ifeq ($$(call cc-ver,$$($(1)),-ge,$(2)),n)

Could you keep the dash in the macro, making such invocations look a little more "normal"?

NP. Changed in my tree.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw

Re: [RFC PATCH 5/8] gcov: userspace tools to extract and split gcov data

In reply to Wei Liu
Quoted 21 lines · Wei Liu

Provide two tools: a small C program to extract data from hypervisor and a python script to split data into multiple files.

The file xencov.c is salvaged and modified from the original xencov.c.

---
Cc: Ian Jackson <[email protected]>

---
 tools/misc/Makefile     |   6 ++
 tools/misc/xencov.c     | 148 ++++++++++++++++++++++++++++++++++++++++++++++++
 tools/misc/xencov_split | 100 ++++++++++++++++++++++++++++++++
 3 files changed, 254 insertions(+)
 create mode 100644 tools/misc/xencov.c
 create mode 100755 tools/misc/xencov_split
tools/misc/Makefile +0 -0
index 5ba6672..c029401 100644

tools/misc/Makefile CFLAGS += $(CFLAGS_libxenstore) · line 16

Quoted 4 lines
tools/misc/Makefile +1 -0
@@ -13,6 +13,7 @@ CFLAGS += $(CFLAGS_libxenstore)
 INSTALL_BIN-$(CONFIG_X86)      += xen-cpuid
 INSTALL_BIN-$(CONFIG_X86)      += xen-detect
 INSTALL_BIN                    += xencons
+INSTALL-BIN                    += xencov_split

You have typo'd INSTALL_BIN here, causing xencov_split not to be installed. (Luckily, RPM catches this, but I have spent a while staring in disbelief, trying to work out what was wrong.)

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#15 lore raw

Re: [RFC PATCH 5/8] gcov: userspace tools to extract and split gcov data

Quoted 17 lines · Andrew Cooper
Quoted 16 lines · Wei Liu

Provide two tools: a small C program to extract data from hypervisor and a python script to split data into multiple files.

The file xencov.c is salvaged and modified from the original xencov.c.

---
Cc: Ian Jackson <[email protected]>

---
 tools/misc/Makefile     |   6 ++
 tools/misc/xencov.c     | 148 ++++++++++++++++++++++++++++++++++++++++++++++++
 tools/misc/xencov_split | 100 ++++++++++++++++++++++++++++++++
 3 files changed, 254 insertions(+)
 create mode 100644 tools/misc/xencov.c
 create mode 100755 tools/misc/xencov_split
Quoted 14 lines

tools/misc/Makefile CFLAGS += $(CFLAGS_libxenstore) · line 16

Quoted 9 lines
tools/misc/Makefile +1 -0
index 5ba6672..c029401 100644
@@ -13,6 +13,7 @@ CFLAGS += $(CFLAGS_libxenstore)
 INSTALL_BIN-$(CONFIG_X86)      += xen-cpuid
 INSTALL_BIN-$(CONFIG_X86)      += xen-detect
 INSTALL_BIN                    += xencons
+INSTALL-BIN                    += xencov_split

You have typo'd INSTALL_BIN here, causing xencov_split not to be installed. (Luckily, RPM catches this, but I have spent a while staring in disbelief, trying to work out what was wrong.)

I stared at the two lines for 30s and finally figured out that went wrong.

Sorry about this! I will fix that in v2.

Wei.

Quoted 1 line

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Re: [RFC PATCH 4/8] gcov: add new interface and 3.4 and 4.7 format support

In reply to Wei Liu
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:

A new sysctl interface for passing gcov data back to userspace. The new interface uses a customised record file format. The new sysctl reuses original sysctl number but renames the op to gcov_op.

Quoted 8 lines

Both gcc 3.4 and 4.7 format are supported. The code is rewritten so that a new format can be easily added in the future. Version specific code is grouped into different files. The format one needs to use can be picked via Kconfig. The default format is 4.7 format.

Userspace programs to handle extracted data will come in a later patch.

Looks reasonable, but wants some cosmetics done: Constification seems to b possible in a number of places, labels should be indented by at least one blank, and pointless initializers would be nice to see eliminated. Also, unless at least the removal patch is still meant to go in for 4.8, you'll need to bump XEN_SYSCTL_INTERFACE_VERSION in the patch here.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#22 lore raw

Re: [RFC PATCH 8/8] gcov: provide the capability to select gcov format automatically

In reply to Jan Beulich
Quoted 10 lines · Jan Beulich

xen/Kconfig.debug config GCOV · line 50

Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:
xen/Kconfig.debug +4 -0
+config GCOV_FORMAT_AUTODETECT
+       bool "Autodetect"
+       ---help---
+       Automatically select gcov format based on GCC version.

Tab indentation again please, and I think help text usually gets indented by another one or two spaces from the "help" or "---help---" keyword's.

I will fix the issues you point out in this patch and previous ones.

Thanks for reviewing.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#9 lore raw

Re: [RFC PATCH 4/8] gcov: add new interface and 3.4 and 4.7 format support

In reply to Jan Beulich
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:

A new sysctl interface for passing gcov data back to userspace. The new interface uses a customised record file format. The new sysctl reuses original sysctl number but renames the op to gcov_op.

Both gcc 3.4 and 4.7 format are supported. The code is rewritten so that a new format can be easily added in the future. Version specific code is grouped into different files. The format one needs to use can be picked via Kconfig. The default format is 4.7 format.

Userspace programs to handle extracted data will come in a later patch.

Quoted 9 lines
Quoted 1 line

Looks reasonable, but wants some cosmetics done: Constification seems to b possible in a number of places, labels should be indented by at least one blank, and pointless initializers would be nice to see eliminated. Also, unless at least the removal patch is still meant to go in for 4.8, you'll need to bump XEN_SYSCTL_INTERFACE_VERSION in the patch here.

Regarding cosmetic issues, I will try to fix as many as possible.

The removal patch won't go in 4.8 because though the implementation has a lot of limitations it might still be useful to some people. I will bump XEN_SYSCTL_INTERFACE_VERSION here in this patch.

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#10 lore raw

Re: [RFC PATCH 4/8] gcov: add new interface and 3.4 and 4.7 format support

Quoted 23 lines · Wei Liu
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:

A new sysctl interface for passing gcov data back to userspace. The new interface uses a customised record file format. The new sysctl reuses original sysctl number but renames the op to gcov_op.

Both gcc 3.4 and 4.7 format are supported. The code is rewritten so that a new format can be easily added in the future. Version specific code is grouped into different files. The format one needs to use can be picked via Kconfig. The default format is 4.7 format.

Userspace programs to handle extracted data will come in a later patch.

Quoted 9 lines
Quoted 1 line

Looks reasonable, but wants some cosmetics done: Constification seems to b possible in a number of places, labels should be indented by at least one blank, and pointless initializers would be nice to see eliminated. Also, unless at least the removal patch is still meant to go in for 4.8, you'll need to bump XEN_SYSCTL_INTERFACE_VERSION in the patch here.

Quoted 6 lines

Regarding cosmetic issues, I will try to fix as many as possible.

The removal patch won't go in 4.8 because though the implementation has a lot of limitations it might still be useful to some people. I will bump XEN_SYSCTL_INTERFACE_VERSION here in this patch.

I go through most (if not all) initialisers, actually they are necessary:

1. those accumulative counters need to be initialised to 0.
2. gcov_info_next expects NULL for first invocation.

Wei.

Quoted 4 lines

Wei.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [RFC PATCH 4/8] gcov: add new interface and 3.4 and 4.7 format support

Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 07.10.16 at 13:43, <[email protected]> wrote:
Quoted 25 lines · Wei Liu
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:

A new sysctl interface for passing gcov data back to userspace. The new interface uses a customised record file format. The new sysctl reuses original sysctl number but renames the op to gcov_op.

Both gcc 3.4 and 4.7 format are supported. The code is rewritten so that a new format can be easily added in the future. Version specific code is grouped into different files. The format one needs to use can be picked via Kconfig. The default format is 4.7 format.

Userspace programs to handle extracted data will come in a later patch.

Quoted 9 lines
Quoted 1 line

Looks reasonable, but wants some cosmetics done: Constification seems to b possible in a number of places, labels should be indented by at least one blank, and pointless initializers would be nice to see eliminated. Also, unless at least the removal patch is still meant to go in for 4.8, you'll need to bump XEN_SYSCTL_INTERFACE_VERSION in the patch here.

Regarding cosmetic issues, I will try to fix as many as possible.

Quoted 8 lines
Quoted 4 lines

The removal patch won't go in 4.8 because though the implementation has a lot of limitations it might still be useful to some people. I will bump XEN_SYSCTL_INTERFACE_VERSION here in this patch.

I go through most (if not all) initialisers, actually they are necessary:

1. those accumulative counters need to be initialised to 0.

In e.g.

+ uint32_t total_size = 0;
+ struct gcov_info *info = NULL;
+
+ /* Magic number XCOV */
+ total_size += sizeof(uint32_t);

I can't see why the sizeof(uint32_t) can't be the initializer right away, or the initializer be dropped and = used in place of += .

Quoted 1 line

2. gcov_info_next expects NULL for first invocation.

Oh, I've indeed overlooked this requirement.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#12 lore raw

Re: [RFC PATCH 4/8] gcov: add new interface and 3.4 and 4.7 format support

Quoted 44 lines · Jan Beulich
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 07.10.16 at 13:43, <[email protected]> wrote:
Quoted 25 lines · Wei Liu
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.10.16 at 16:37, <[email protected]> wrote:

A new sysctl interface for passing gcov data back to userspace. The new interface uses a customised record file format. The new sysctl reuses original sysctl number but renames the op to gcov_op.

Both gcc 3.4 and 4.7 format are supported. The code is rewritten so that a new format can be easily added in the future. Version specific code is grouped into different files. The format one needs to use can be picked via Kconfig. The default format is 4.7 format.

Userspace programs to handle extracted data will come in a later patch.

Quoted 9 lines
Quoted 1 line

Looks reasonable, but wants some cosmetics done: Constification seems to b possible in a number of places, labels should be indented by at least one blank, and pointless initializers would be nice to see eliminated. Also, unless at least the removal patch is still meant to go in for 4.8, you'll need to bump XEN_SYSCTL_INTERFACE_VERSION in the patch here.

Regarding cosmetic issues, I will try to fix as many as possible.

Quoted 8 lines
Quoted 4 lines

The removal patch won't go in 4.8 because though the implementation has a lot of limitations it might still be useful to some people. I will bump XEN_SYSCTL_INTERFACE_VERSION here in this patch.

I go through most (if not all) initialisers, actually they are necessary:

1. those accumulative counters need to be initialised to 0.

In e.g.

xen/common/gcov/gcov.c new file +5 -0
+    uint32_t total_size = 0;
+    struct gcov_info *info = NULL;
+
+    /* Magic number XCOV */
+    total_size += sizeof(uint32_t);
Quoted 3 lines

I can't see why the sizeof(uint32_t) can't be the initializer right away, or the initializer be dropped and = used in place of += .

Sure, I can change this and check if there are other similar instances.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel