mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
x86/pv: Move x86/trace.c to x86/pv/trace.c
This entire file is pv-only, and not excluded from the build by CONFIG_TRACEBUFFER. Move it into the pv/ directory, build it conditionally, and drop unused includes. Also move the contents of asm/trace.h to asm/pv/trace.h to avoid the functions being declared across the entire hypervisor. One caller in fixup_page_fault() is effectively PV only, but is not subject to dead code elimination. Add an additional IS_ENABLED(CONFIG_PV) to keep the build happy. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
91bac8ad7c
commit
8aae4f376c
10 files changed
+60
-55
No files matched your search
@@ -61,7 +61,6 @@ obj-y += spec_ctrl.o
|
||||
obj-y += srat.o
|
||||
obj-y += string.o
|
||||
obj-y += time.o
|
||||
obj-y += trace.o
|
||||
obj-y += traps.o
|
||||
obj-y += tsx.o
|
||||
obj-y += usercopy.o
|
||||
|
||||
@@ -12,6 +12,7 @@ obj-y += misc-hypercalls.o
|
||||
obj-y += mm.o
|
||||
obj-y += ro-page-fault.o
|
||||
obj-$(CONFIG_PV_SHIM) += shim.o
|
||||
obj-$(CONFIG_TRACEBUFFER) += trace.o
|
||||
obj-y += traps.o
|
||||
|
||||
obj-bin-y += dom0_build.init.o
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* along with this program; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <xen/trace.h>
|
||||
#include <asm/pv/trace.h>
|
||||
|
||||
#include "emulate.h"
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <asm/hypercall.h>
|
||||
#include <asm/mc146818rtc.h>
|
||||
#include <asm/pv/domain.h>
|
||||
#include <asm/pv/trace.h>
|
||||
#include <asm/shared.h>
|
||||
|
||||
#include <xsm/xsm.h>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* along with this program; If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <xen/trace.h>
|
||||
#include <asm/pv/trace.h>
|
||||
#include <asm/shadow.h>
|
||||
|
||||
#include "emulate.h"
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include <xen/init.h>
|
||||
#include <xen/kernel.h>
|
||||
#include <xen/lib.h>
|
||||
#include <xen/domain.h>
|
||||
#include <xen/sched.h>
|
||||
#include <xen/trace.h>
|
||||
|
||||
#include <asm/pv/trace.h>
|
||||
|
||||
void __trace_pv_trap(int trapnr, unsigned long eip,
|
||||
int use_error_code, unsigned error_code)
|
||||
@@ -21,7 +18,7 @@ void __trace_pv_trap(int trapnr, unsigned long eip,
|
||||
d.trapnr = trapnr;
|
||||
d.error_code = error_code;
|
||||
d.use_error_code=!!use_error_code;
|
||||
|
||||
|
||||
__trace_var(TRC_PV_TRAP, 1, sizeof(d), &d);
|
||||
}
|
||||
else
|
||||
@@ -38,7 +35,7 @@ void __trace_pv_trap(int trapnr, unsigned long eip,
|
||||
d.trapnr = trapnr;
|
||||
d.error_code = error_code;
|
||||
d.use_error_code=!!use_error_code;
|
||||
|
||||
|
||||
event = TRC_PV_TRAP;
|
||||
event |= TRC_64_FLAG;
|
||||
__trace_var(event, 1, sizeof(d), &d);
|
||||
@@ -58,7 +55,7 @@ void __trace_pv_page_fault(unsigned long addr, unsigned error_code)
|
||||
d.eip = eip;
|
||||
d.addr = addr;
|
||||
d.error_code = error_code;
|
||||
|
||||
|
||||
__trace_var(TRC_PV_PAGE_FAULT, 1, sizeof(d), &d);
|
||||
}
|
||||
else
|
||||
@@ -22,10 +22,10 @@
|
||||
#include <xen/event.h>
|
||||
#include <xen/hypercall.h>
|
||||
#include <xen/lib.h>
|
||||
#include <xen/trace.h>
|
||||
#include <xen/softirq.h>
|
||||
|
||||
#include <asm/apic.h>
|
||||
#include <asm/pv/trace.h>
|
||||
#include <asm/shared.h>
|
||||
#include <asm/traps.h>
|
||||
#include <irq_vectors.h>
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
#include <xsm/xsm.h>
|
||||
#include <asm/mach-default/irq_vectors.h>
|
||||
#include <asm/pv/traps.h>
|
||||
#include <asm/pv/trace.h>
|
||||
#include <asm/pv/mm.h>
|
||||
|
||||
/*
|
||||
@@ -1480,7 +1481,7 @@ static int fixup_page_fault(unsigned long addr, struct cpu_user_regs *regs)
|
||||
{
|
||||
int ret = paging_fault(addr, regs);
|
||||
|
||||
if ( ret == EXCRET_fault_fixed )
|
||||
if ( IS_ENABLED(CONFIG_PV) && ret == EXCRET_fault_fixed )
|
||||
trace_trap_two_addr(TRC_PV_PAGING_FIXUP, regs->rip, addr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef XEN_X86_PV_TRACE_H
|
||||
#define XEN_X86_PV_TRACE_H
|
||||
|
||||
#include <xen/trace.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
|
||||
void __trace_pv_trap(int trapnr, unsigned long eip,
|
||||
int use_error_code, unsigned error_code);
|
||||
static inline void trace_pv_trap(int trapnr, unsigned long eip,
|
||||
int use_error_code, unsigned error_code)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_pv_trap(trapnr, eip, use_error_code, error_code);
|
||||
}
|
||||
|
||||
void __trace_pv_page_fault(unsigned long addr, unsigned error_code);
|
||||
static inline void trace_pv_page_fault(unsigned long addr,
|
||||
unsigned error_code)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_pv_page_fault(addr, error_code);
|
||||
}
|
||||
|
||||
void __trace_trap_one_addr(unsigned event, unsigned long va);
|
||||
static inline void trace_trap_one_addr(unsigned event, unsigned long va)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_trap_one_addr(event, va);
|
||||
}
|
||||
|
||||
void __trace_trap_two_addr(unsigned event, unsigned long va1,
|
||||
unsigned long va2);
|
||||
static inline void trace_trap_two_addr(unsigned event, unsigned long va1,
|
||||
unsigned long va2)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_trap_two_addr(event, va1, va2);
|
||||
}
|
||||
|
||||
void __trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte);
|
||||
static inline void trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_ptwr_emulation(addr, npte);
|
||||
}
|
||||
|
||||
#endif /* XEN_X86_PV_TRACE_H */
|
||||
@@ -1,46 +1,4 @@
|
||||
#ifndef __ASM_TRACE_H__
|
||||
#define __ASM_TRACE_H__
|
||||
|
||||
#include <asm/page.h>
|
||||
|
||||
void __trace_pv_trap(int trapnr, unsigned long eip,
|
||||
int use_error_code, unsigned error_code);
|
||||
static inline void trace_pv_trap(int trapnr, unsigned long eip,
|
||||
int use_error_code, unsigned error_code)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_pv_trap(trapnr, eip, use_error_code, error_code);
|
||||
}
|
||||
|
||||
void __trace_pv_page_fault(unsigned long addr, unsigned error_code);
|
||||
static inline void trace_pv_page_fault(unsigned long addr,
|
||||
unsigned error_code)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_pv_page_fault(addr, error_code);
|
||||
}
|
||||
|
||||
void __trace_trap_one_addr(unsigned event, unsigned long va);
|
||||
static inline void trace_trap_one_addr(unsigned event, unsigned long va)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_trap_one_addr(event, va);
|
||||
}
|
||||
|
||||
void __trace_trap_two_addr(unsigned event, unsigned long va1,
|
||||
unsigned long va2);
|
||||
static inline void trace_trap_two_addr(unsigned event, unsigned long va1,
|
||||
unsigned long va2)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_trap_two_addr(event, va1, va2);
|
||||
}
|
||||
|
||||
void __trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte);
|
||||
static inline void trace_ptwr_emulation(unsigned long addr, l1_pgentry_t npte)
|
||||
{
|
||||
if ( unlikely(tb_init_done) )
|
||||
__trace_ptwr_emulation(addr, npte);
|
||||
}
|
||||
|
||||
#endif /* __ASM_TRACE_H__ */
|
||||