[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xenoprof: limit scope of types and #define-s
commit 8d928648fd816f97ba3ebe98ab5d4b4a7def58ff Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon May 4 11:51:47 2020 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon May 4 11:51:47 2020 +0200 xenoprof: limit scope of types and #define-s Quite a few of the items are used by xenoprof.c only, so move them there to limit their visibility as well as the amount of re-building needed in case of changes. Also drop the inclusion of the public header there. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Wei Liu <wl@xxxxxxx> --- xen/arch/x86/oprofile/nmi_int.c | 2 +- xen/common/xenoprof.c | 26 ++++++++++++++++++++++++++ xen/include/asm-x86/xenoprof.h | 2 ++ xen/include/xen/xenoprof.h | 33 ++------------------------------- xen/xsm/flask/hooks.c | 1 + 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c index 2969db47fc..0f103d80a6 100644 --- a/xen/arch/x86/oprofile/nmi_int.c +++ b/xen/arch/x86/oprofile/nmi_int.c @@ -19,7 +19,7 @@ #include <xen/string.h> #include <xen/delay.h> #include <xen/xenoprof.h> -#include <public/xen.h> +#include <public/xenoprof.h> #include <asm/msr.h> #include <asm/apic.h> #include <asm/regs.h> diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index 8a78957fbe..1926a92fe4 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -23,6 +23,32 @@ #undef virt_to_mfn #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) +#define XENOPROF_DOMAIN_IGNORED 0 +#define XENOPROF_DOMAIN_ACTIVE 1 +#define XENOPROF_DOMAIN_PASSIVE 2 + +#define XENOPROF_IDLE 0 +#define XENOPROF_INITIALIZED 1 +#define XENOPROF_COUNTERS_RESERVED 2 +#define XENOPROF_READY 3 +#define XENOPROF_PROFILING 4 + +#ifndef CONFIG_COMPAT +#define XENOPROF_COMPAT(x) false +typedef struct xenoprof_buf xenoprof_buf_t; +#define xenoprof_buf(d, b, field) ACCESS_ONCE((b)->field) +#else +#include <compat/xenoprof.h> +#define XENOPROF_COMPAT(x) ((x)->is_compat) +typedef union { + struct xenoprof_buf native; + struct compat_oprof_buf compat; +} xenoprof_buf_t; +#define xenoprof_buf(d, b, field) ACCESS_ONCE(*(!(d)->xenoprof->is_compat \ + ? &(b)->native.field \ + : &(b)->compat.field)) +#endif + /* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32 diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/asm-x86/xenoprof.h index eeac9f2ca1..1026ba2e1f 100644 --- a/xen/include/asm-x86/xenoprof.h +++ b/xen/include/asm-x86/xenoprof.h @@ -26,6 +26,8 @@ struct vcpu; #ifdef CONFIG_XENOPROF +#include <public/xen.h> + int nmi_reserve_counters(void); int nmi_setup_events(void); int nmi_enable_virq(void); diff --git a/xen/include/xen/xenoprof.h b/xen/include/xen/xenoprof.h index 35f3ea107b..101514c148 100644 --- a/xen/include/xen/xenoprof.h +++ b/xen/include/xen/xenoprof.h @@ -11,7 +11,6 @@ #define __XEN_XENOPROF_H__ #include <xen/inttypes.h> -#include <public/xenoprof.h> #include <asm/xenoprof.h> #define PMU_OWNER_NONE 0 @@ -20,37 +19,9 @@ #ifdef CONFIG_XENOPROF -#define XENOPROF_DOMAIN_IGNORED 0 -#define XENOPROF_DOMAIN_ACTIVE 1 -#define XENOPROF_DOMAIN_PASSIVE 2 - -#define XENOPROF_IDLE 0 -#define XENOPROF_INITIALIZED 1 -#define XENOPROF_COUNTERS_RESERVED 2 -#define XENOPROF_READY 3 -#define XENOPROF_PROFILING 4 - -#ifndef CONFIG_COMPAT -typedef struct xenoprof_buf xenoprof_buf_t; -#else -#include <compat/xenoprof.h> -typedef union { - struct xenoprof_buf native; - struct compat_oprof_buf compat; -} xenoprof_buf_t; -#endif - -#ifndef CONFIG_COMPAT -#define XENOPROF_COMPAT(x) 0 -#define xenoprof_buf(d, b, field) ACCESS_ONCE((b)->field) -#else -#define XENOPROF_COMPAT(x) ((x)->is_compat) -#define xenoprof_buf(d, b, field) ACCESS_ONCE(*(!(d)->xenoprof->is_compat \ - ? &(b)->native.field \ - : &(b)->compat.field)) -#endif - struct domain; +struct vcpu; +struct cpu_user_regs; int acquire_pmu_ownership(int pmu_ownership); void release_pmu_ownership(int pmu_ownership); diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 8af8602b46..4649e6fd95 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -29,6 +29,7 @@ #include <public/platform.h> #include <public/version.h> #include <public/hvm/params.h> +#include <public/xenoprof.h> #include <public/xsm/flask_op.h> #include <avc.h> -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |