build: convert perfc{,_arrays} to Kconfig
authorDoug Goldstein <cardoe@cardoe.com>
Wed, 8 Jun 2016 12:11:21 +0000 (14:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 8 Jun 2016 12:11:21 +0000 (14:11 +0200)
Convert the 'perfc' and 'perfc_arrays' options to Kconfig as
CONFIG_PERF_COUNTERS and CONFIG_PERF_ARRAYS.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
14 files changed:
INSTALL
xen/Kconfig.debug
xen/Rules.mk
xen/arch/x86/hvm/hvm.c
xen/arch/x86/time.c
xen/arch/x86/x86_64/asm-offsets.c
xen/common/Makefile
xen/common/keyhandler.c
xen/common/perfc.c
xen/common/sysctl.c
xen/include/asm-x86/asm_defns.h
xen/include/asm-x86/domain.h
xen/include/xen/perfc.h
xen/include/xen/sched.h

diff --git a/INSTALL b/INSTALL
index f55d42cc927ef5954848fa2102854646baf3c77c..623887d7ef4eeb338aa4b08f3e911fa091871278 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -227,8 +227,6 @@ VGABIOS_REL_DATE="dd Mon yyyy"
 
 The following variables can be used to tweak some aspects of the
 hypervisor build.
-perfc=y
-perfc_arrays=y
 lock_profile=y
 lto=y
 
index 664a67b52f401fe0f078bd85f151a37c0ce9f5dc..56d2c79c12341b11fba5ecd094c8a3b149bb0f17 100644 (file)
@@ -28,6 +28,21 @@ config FRAME_POINTER
          maybe slower, but it gives very useful debugging information
          in case of any Xen bugs.
 
+config PERF_COUNTERS
+       bool "Performance Counters"
+       ---help---
+         Enables software performance counters that allows you to analyze
+         bottlenecks in the system.  To access this data you can use serial
+         console to print (and reset) using 'p' and 'P' respectively, or
+         the 'xenperf' tool.
+
+config PERF_ARRAYS
+       bool "Performance Counter Array Histograms"
+       depends on PERF_COUNTERS
+       ---help---
+         Enables software performance counter array histograms.
+
+
 config VERBOSE_DEBUG
        bool "Verbose debug messages"
        default DEBUG
index 418fc74f1f73198141a15393d60e6a0b718637ae..209c91acfbb402de0bfe5c4bdd1ebf01f4010b03 100644 (file)
@@ -3,8 +3,6 @@
 # If you change any of these configuration options then you must
 # 'make clean' before rebuilding.
 #
-perfc         ?= n
-perfc_arrays  ?= n
 lock_profile  ?= n
 lto           ?= n
 
@@ -12,11 +10,6 @@ lto           ?= n
 
 include $(XEN_ROOT)/Config.mk
 
-# Hardcoded configuration implications and dependencies.
-# Do this is a neater way if it becomes unwieldy.
-ifeq ($(perfc_arrays),y)
-perfc := y
-endif
 
 ifneq ($(origin crash_debug),undefined)
 $(error "You must use 'make menuconfig' to enable/disable crash_debug now.")
@@ -30,6 +23,9 @@ endif
 ifneq ($(origin kexec),undefined)
 $(error "You must use 'make menuconfig' to enable/disable kexec now.")
 endif
+ifneq ($(origin perfc),undefined)
+$(error "You must use 'make menuconfig' to enable/disable perfc now.")
+endif
 ifneq ($(origin verbose),undefined)
 $(error "You must use 'make menuconfig' to enable/disable verbose now.")
 endif
@@ -60,8 +56,6 @@ ifneq ($(clang),y)
 CFLAGS += -Wa,--strip-local-absolute
 endif
 
-CFLAGS-$(perfc)         += -DPERF_COUNTERS
-CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(CONFIG_FRAME_POINTER) += -fno-omit-frame-pointer
 
index d224bc7a2fea5ef4c9fdfb8bb324c6d320dad811..42f07c24eadb7cd8ad1a7b2051249911bfaf57e2 100644 (file)
@@ -3580,7 +3580,7 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
 static uint64_t _hvm_rdtsc_intercept(void)
 {
     struct vcpu *curr = current;
-#if !defined(NDEBUG) || defined(PERF_COUNTERS)
+#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS)
     struct domain *currd = curr->domain;
 
     if ( currd->arch.vtsc )
index 6438b47b8f8729486e3143b84b045f0fd561bd17..3928a5fbcb371b59ecb809b5fc9f7c98a4c9b8f2 100644 (file)
@@ -1688,7 +1688,7 @@ void pv_soft_rdtsc(struct vcpu *v, struct cpu_user_regs *regs, int rdtscp)
 
     spin_lock(&d->arch.vtsc_lock);
 
-#if !defined(NDEBUG) || defined(PERF_COUNTERS)
+#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS)
     if ( guest_kernel_mode(v, regs) )
         d->arch.vtsc_kerncount++;
     else
@@ -1959,7 +1959,7 @@ static void dump_softtsc(unsigned char key)
             printk(",khz=%"PRIu32, d->arch.tsc_khz);
         if ( d->arch.incarnation )
             printk(",inc=%"PRIu32, d->arch.incarnation);
-#if !defined(NDEBUG) || defined(PERF_COUNTERS)
+#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS)
         if ( !(d->arch.vtsc_kerncount | d->arch.vtsc_usercount) )
             printk("\n");
         else
index a3ae7a475f59416e9a346c493408729862a2373e..05d2b851f858751816e68746ea4c87690239871f 100644 (file)
@@ -152,7 +152,7 @@ void __dummy__(void)
     OFFSET(TRAPBOUNCE_eip, struct trap_bounce, eip);
     BLANK();
 
-#if PERF_COUNTERS
+#ifdef CONFIG_PERF_COUNTERS
     DEFINE(ASM_PERFC_hypercalls, PERFC_hypercalls);
     DEFINE(ASM_PERFC_exceptions, PERFC_exceptions);
     BLANK();
index a4bd4d64fde7ff1bac8ab7a62c85c5e7bf208927..e9893e2e6b45a908fec92cc0d3fc320141d388f5 100644 (file)
@@ -27,6 +27,7 @@ obj-y += multicall.o
 obj-y += notifier.o
 obj-y += page_alloc.o
 obj-$(CONFIG_HAS_PDX) += pdx.o
+obj-$(CONFIG_PERF_COUNTERS) += perfc.o
 obj-y += preempt.o
 obj-y += random.o
 obj-y += rangeset.o
@@ -63,7 +64,6 @@ obj-y += xmalloc_tlsf.o
 
 obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma unlzo unlz4 earlycpio,$(n).init.o)
 
-obj-$(perfc)       += perfc.o
 
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o kernel.o memory.o multicall.o xlat.o)
 
index 4ff90f6694e5fce1349a15945dca84addfd15c21..65b70ced1fd8a18467c6dcbe3abfa506675629f1 100644 (file)
@@ -59,7 +59,7 @@ static struct keyhandler {
     IRQ_KEYHANDLER('%', do_debug_key, "trap to xendbg", 0),
     IRQ_KEYHANDLER('*', run_all_keyhandlers, "print all diagnostics", 0),
 
-#ifdef PERF_COUNTERS
+#ifdef CONFIG_PERF_COUNTERS
     KEYHANDLER('p', perfc_printall, "print performance counters", 1),
     KEYHANDLER('P', perfc_reset, "reset performance counters", 0),
 #endif
index 9f078e1abcf92146172e7c1cad25bfa5a372342c..3da4c964f4e4321f6e205a6786420c58fdb9e06c 100644 (file)
@@ -78,7 +78,7 @@ void perfc_printall(unsigned char key)
             printk("TOTAL[%12Lu]", sum);
             if (sum)
             {
-#ifdef PERF_ARRAYS
+#ifdef CONFIG_PERF_ARRAYS
                 for ( k = 0; k < perfc_info[i].nr_elements; k++ )
                 {
                     sum = 0;
index 75f4c0541a19671354c828e3a933fe9cdb6f8dbf..48de4799a0a5b24e429854076ee2d5336d35613d 100644 (file)
@@ -115,7 +115,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
     }
     break;
 
-#ifdef PERF_COUNTERS
+#ifdef CONFIG_PERF_COUNTERS
     case XEN_SYSCTL_perfc_op:
         ret = perfc_control(&op->u.perfc_op);
         break;
index 279d70298f1338c5219cbe09f466de5f03ddd383..e36e78f7855912944d215490e04d5e3c725446ad 100644 (file)
@@ -385,7 +385,7 @@ static always_inline void stac(void)
 
 #endif
 
-#ifdef PERF_COUNTERS
+#ifdef CONFIG_PERF_COUNTERS
 #define PERFC_INCR(_name,_idx,_cur)             \
         pushq _cur;                             \
         movslq VCPU_processor(_cur),_cur;       \
index 165e533ab3f74b3daba52dacb7294915aafc9863..783fa4f8a873dfdf858e7cdcb113808d58d5fc30 100644 (file)
@@ -377,7 +377,7 @@ struct arch_domain
                                      hardware TSC scaling cases */
     uint32_t incarnation;    /* incremented every restore or live migrate
                                 (possibly other cases in the future */
-#if !defined(NDEBUG) || defined(PERF_COUNTERS)
+#if !defined(NDEBUG) || defined(CONFIG_PERF_COUNTERS)
     uint64_t vtsc_kerncount;
     uint64_t vtsc_usercount;
 #endif
index 6cb0cd1739ed8b9ecf9c2c349f18dda744f79629..6846e7119fa30a699a2eea3c8af4d125893f0d5c 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __XEN_PERFC_H__
 #define __XEN_PERFC_H__
 
-#ifdef PERF_COUNTERS
+#ifdef CONFIG_PERF_COUNTERS
 
 #include <xen/lib.h>
 #include <xen/smp.h>
@@ -76,7 +76,7 @@ DECLARE_PER_CPU(perfc_t[NUM_PERFCOUNTERS], perfcounters);
  * Histogram: special treatment for 0 and 1 count. After that equally spaced 
  * with last bucket taking the rest.
  */
-#ifdef PERF_ARRAYS
+#ifdef CONFIG_PERF_ARRAYS
 #define perfc_incr_histo(x,v)                                           \
     do {                                                                \
         if ( (v) == 0 )                                                 \
@@ -100,7 +100,7 @@ extern void perfc_printall(unsigned char key);
 extern void perfc_reset(unsigned char key);
 
     
-#else /* PERF_COUNTERS */
+#else /* CONFIG_PERF_COUNTERS */
 
 #define perfc_value(x)    (0)
 #define perfc_valuea(x,y) (0)
@@ -114,6 +114,6 @@ extern void perfc_reset(unsigned char key);
 #define perfc_adda(x,y,z) ((void)0)
 #define perfc_incr_histo(x,y,z) ((void)0)
 
-#endif /* PERF_COUNTERS */
+#endif /* CONFIG_PERF_COUNTERS */
 
 #endif /* __XEN_PERFC_H__ */
index fe15e9c14d928bc56393b514ef81ec7133c57d99..46c82e7f211e017f789b79391c7449219a5e0514 100644 (file)
@@ -39,7 +39,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_runstate_info_compat_t);
  * Enable and ease the use of scheduling related performance counters.
  *
  */
-#ifdef PERF_COUNTERS
+#ifdef CONFIG_PERF_COUNTERS
 #define SCHED_STATS
 #endif