]> xenbits.xensource.com Git - xen.git/commitdiff
xenoprof: fix up ability to disable it
authorDoug Goldstein <cardoe@cardoe.com>
Fri, 19 Feb 2016 04:25:56 +0000 (22:25 -0600)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 19 Feb 2016 16:22:18 +0000 (11:22 -0500)
Allow Xenoprof to be fully disabled when toggling the option off.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
xen/arch/x86/Makefile
xen/arch/x86/Rules.mk
xen/arch/x86/x86_64/compat/entry.S
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/config.h
xen/include/asm-x86/xenoprof.h
xen/include/xen/xenoprof.h

index 8e6e9019da5be273ec3fc426eac53f1179f215ac..434d9857898a3134a34ad03c8a152138b40fa93b 100644 (file)
@@ -3,7 +3,7 @@ subdir-y += cpu
 subdir-y += genapic
 subdir-y += hvm
 subdir-y += mm
-subdir-y += oprofile
+subdir-$(xenoprof) += oprofile
 subdir-y += x86_64
 
 obj-bin-y += alternative.init.o
index a1cdae04e8d58672bb2bd0d02e9d3658eab1044a..94e4efd11230edae40436894a14014f5a93f23eb 100644 (file)
@@ -10,6 +10,8 @@ CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
 CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
 
+CFLAGS-$(xenoprof) += -DCONFIG_XENOPROF
+
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
 
index 8cb8bca6695ea67d79708be7fcffa92029b4c283..927439ddd4c3db8eb52e248f3cc01dbcdf85fa0d 100644 (file)
@@ -345,6 +345,10 @@ compat_crash_page_fault:
 #define compat_kexec_op do_ni_hypercall
 #endif
 
+#ifndef CONFIG_XENOPROF
+#define compat_xenoprof_op do_ni_hypercall
+#endif
+
 ENTRY(compat_hypercall_table)
         .quad compat_set_trap_table     /*  0 */
         .quad do_mmu_update
index fc81a93bf11d714e2c87828158ea6933d97088a4..e0f5c83ac754392d0b78b924adae89d0fd763c85 100644 (file)
@@ -682,6 +682,10 @@ ENTRY(exception_table)
 #define do_kexec_op do_ni_hypercall
 #endif
 
+#ifndef CONFIG_XENOPROF
+#define do_xenoprof_op do_ni_hypercall
+#endif
+
 ENTRY(hypercall_table)
         .quad do_set_trap_table     /*  0 */
         .quad do_mmu_update
index d97877dd78ce7373d2580ca7d40e068b69ae1832..a45d3ee7cbe0a97eb14a7fc86bde5ade0c375ec0 100644 (file)
@@ -47,7 +47,6 @@
 #define CONFIG_VGA 1
 #define CONFIG_VIDEO 1
 
-#define CONFIG_XENOPROF 1
 #define CONFIG_WATCHDOG 1
 
 #define CONFIG_MULTIBOOT 1
index b006ddc01944bf3d8a11b34822cc3d7f3ed74919..dca422336fe2b1eaf1b14ac58ab9de762ee296b6 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef __ASM_X86_XENOPROF_H__
 #define __ASM_X86_XENOPROF_H__
 
+#ifdef CONFIG_XENOPROF
+
 int nmi_reserve_counters(void);
 int nmi_setup_events(void);
 int nmi_enable_virq(void);
@@ -67,10 +69,29 @@ void xenoprof_backtrace(struct vcpu *, const struct cpu_user_regs *,
                  "xenoprof/x86 with autotranslated mode enabled"    \
                  "isn't supported yet\n");                          \
     } while (0)
+
 int passive_domain_do_rdmsr(unsigned int msr, uint64_t *msr_content);
 int passive_domain_do_wrmsr(unsigned int msr, uint64_t msr_content);
 void passive_domain_destroy(struct vcpu *v);
 
+#else
+
+static inline int passive_domain_do_rdmsr(unsigned int msr,
+                                          uint64_t *msr_content)
+{
+    return 0;
+}
+
+static inline int passive_domain_do_wrmsr(unsigned int msr,
+                                          uint64_t msr_content)
+{
+    return 0;
+}
+
+static inline void passive_domain_destroy(struct vcpu *v) {}
+
+#endif /* CONFIG_XENOPROF */
+
 #endif /* __ASM_X86_XENOPROF_H__ */
 
 /*
index 9b9ef56d4c99897b4d7c1251840a51ba1457e859..8f045abce67862b24baefcaa1b8d38649bfa5211 100644 (file)
 #include <public/xenoprof.h>
 #include <asm/xenoprof.h>
 
+#define PMU_OWNER_NONE          0
+#define PMU_OWNER_XENOPROF      1
+#define PMU_OWNER_HVM           2
+
+#ifdef CONFIG_XENOPROF
+
 #define XENOPROF_DOMAIN_IGNORED    0
 #define XENOPROF_DOMAIN_ACTIVE     1
 #define XENOPROF_DOMAIN_PASSIVE    2
@@ -64,19 +70,28 @@ struct xenoprof {
 #endif
 
 struct domain;
+
+int acquire_pmu_ownership(int pmu_ownership);
+void release_pmu_ownership(int pmu_ownership);
+
 int is_active(struct domain *d);
 int is_passive(struct domain *d);
 void free_xenoprof_pages(struct domain *d);
 
 int xenoprof_add_trace(struct vcpu *, uint64_t pc, int mode);
 
-#define PMU_OWNER_NONE          0
-#define PMU_OWNER_XENOPROF      1
-#define PMU_OWNER_HVM           2
-int acquire_pmu_ownership(int pmu_ownership);
-void release_pmu_ownership(int pmu_ownership);
-
 void xenoprof_log_event(struct vcpu *, const struct cpu_user_regs *,
                         uint64_t pc, int mode, int event);
 
+#else
+static inline int acquire_pmu_ownership(int pmu_ownership)
+{
+    return 1;
+}
+
+static inline void release_pmu_ownership(int pmu_ownership)
+{
+}
+#endif /* CONFIG_XENOPROF */
+
 #endif  /* __XEN__XENOPROF_H__ */