All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Goldstein <cardoe@cardoe.com>
To: xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Doug Goldstein <cardoe@cardoe.com>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: [PATCH v2 1/2] xenoprof: fix up ability to disable it
Date: Mon,  8 Feb 2016 22:15:20 -0600	[thread overview]
Message-ID: <1454991321-399-1-git-send-email-cardoe@cardoe.com> (raw)

Allow Xenoprof to be fully disabled when toggling the option off.

CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
CC: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
change since v1:
- switch to #define empty 'functions' as suggested by Andrew Cooper
---
 xen/arch/x86/Makefile              | 2 +-
 xen/arch/x86/Rules.mk              | 2 ++
 xen/arch/x86/x86_64/compat/entry.S | 4 ++++
 xen/arch/x86/x86_64/entry.S        | 4 ++++
 xen/include/asm-x86/config.h       | 1 -
 xen/include/asm-x86/vpmu.h         | 9 +++++++++
 xen/include/asm-x86/xenoprof.h     | 7 +++++++
 xen/include/xen/xenoprof.h         | 4 ++++
 8 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 8e6e901..434d985 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -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
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index a1cdae0..94e4efd 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -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
 
diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 3088aa7..6424ed0 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -394,6 +394,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
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 94a54aa..0a73878 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -727,6 +727,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
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index d97877d..a45d3ee 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -47,7 +47,6 @@
 #define CONFIG_VGA 1
 #define CONFIG_VIDEO 1
 
-#define CONFIG_XENOPROF 1
 #define CONFIG_WATCHDOG 1
 
 #define CONFIG_MULTIBOOT 1
diff --git a/xen/include/asm-x86/vpmu.h b/xen/include/asm-x86/vpmu.h
index 67e73dc..4750a1f 100644
--- a/xen/include/asm-x86/vpmu.h
+++ b/xen/include/asm-x86/vpmu.h
@@ -89,10 +89,14 @@ static inline void vpmu_clear(struct vpmu_struct *vpmu)
 {
     vpmu->flags = 0;
 }
+#ifdef CONFIG_XENOPROF
 static inline bool_t vpmu_is_set(const struct vpmu_struct *vpmu, const u32 mask)
 {
     return !!(vpmu->flags & mask);
 }
+#else
+#define vpmu_is_set(x, y) (!!0)
+#endif
 static inline bool_t vpmu_are_all_set(const struct vpmu_struct *vpmu,
                                       const u32 mask)
 {
@@ -121,8 +125,13 @@ static inline int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
     return vpmu_do_msr(msr, msr_content, 0, 0);
 }
 
+#ifdef CONFIG_XENOPROF
 extern int acquire_pmu_ownership(int pmu_ownership);
 extern void release_pmu_ownership(int pmu_ownership);
+#else
+#define acquire_pmu_ownership(x) (1)
+#define release_pmu_ownership(x)
+#endif
 
 extern unsigned int vpmu_mode;
 extern unsigned int vpmu_features;
diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/asm-x86/xenoprof.h
index b006ddc..9574f33 100644
--- a/xen/include/asm-x86/xenoprof.h
+++ b/xen/include/asm-x86/xenoprof.h
@@ -67,9 +67,16 @@ void xenoprof_backtrace(struct vcpu *, const struct cpu_user_regs *,
                  "xenoprof/x86 with autotranslated mode enabled"    \
                  "isn't supported yet\n");                          \
     } while (0)
+
+#ifdef CONFIG_XENOPROF
 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
+#define passive_domain_do_rdmsr(x, y) (0)
+#define passive_domain_do_wrmsr(x, y) (0)
+#define passive_domain_destroy(x)
+#endif
 
 #endif /* __ASM_X86_XENOPROF_H__ */
 
diff --git a/xen/include/xen/xenoprof.h b/xen/include/xen/xenoprof.h
index 7804e69..2dd084a 100644
--- a/xen/include/xen/xenoprof.h
+++ b/xen/include/xen/xenoprof.h
@@ -74,7 +74,11 @@ int xenoprof_add_trace(struct vcpu *, uint64_t pc, int mode);
 #define PMU_OWNER_XENOPROF      1
 #define PMU_OWNER_HVM           2
 int acquire_pmu_ownship(int pmu_ownership);
+#ifdef CONFIG_XENOPROF
 void release_pmu_ownship(int pmu_ownership);
+#else
+#define release_pmu_ownship(x)
+#endif
 
 void xenoprof_log_event(struct vcpu *, const struct cpu_user_regs *,
                         uint64_t pc, int mode, int event);
-- 
2.4.10

             reply	other threads:[~2016-02-09  4:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09  4:15 Doug Goldstein [this message]
2016-02-09  4:15 ` [PATCH v2 2/2] build: convert xenoprof to Kconfig Doug Goldstein
2016-02-09 12:03   ` Jan Beulich
2016-02-09 10:05 ` [PATCH v2 1/2] xenoprof: fix up ability to disable it Andrew Cooper
2016-02-09 10:07   ` Andrew Cooper
2016-02-09 13:54   ` Boris Ostrovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454991321-399-1-git-send-email-cardoe@cardoe.com \
    --to=cardoe@cardoe.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.