xen: xen: compile irq functions without -pg for ftrace
Subsystems (3)
PATCH 1/1 xen: xen: compile irq functions without -pg for ftrace
For some reason I managed to miss a bunch of irq-related functions which also need to be compiled without -pg when using ftrace. This patch moves them into their own file, and starts a cleanup process I've been meaning to do anyway.
[ Sam, Ingo: I think the problem was that I enabled CONFIG_FTRACE
but didn't do a clean build. Shouldn't the build-system notice that the config changes the CFLAGS and rebuild everything? That didn't seem to happen in this case. ]
---
arch/x86/kernel/ldt.c | 2 arch/x86/xen/Makefile | 3 arch/x86/xen/enlighten.c | 122 -------------------------------------- arch/x86/xen/irq.c | 143 +++++++++++++++++++++++++++++++++++++++++++++ arch/x86/xen/xen-asm_32.S | 2 arch/x86/xen/xen-asm_64.S | 2 arch/x86/xen/xen-ops.h | 1 drivers/xen/events.c | 11 --- 8 files changed, 152 insertions(+), 134 deletions(-)
===================================================================
arch/x86/xen/Makefile +0 -0
@@ -2,9 +2,10 @@
# Do not profile debug and lowlevel utilities
CFLAGS_REMOVE_spinlock.o = -pg
CFLAGS_REMOVE_time.o = -pg
+CFLAGS_REMOVE_irq.o = -pg
endif
-obj-y := enlighten.o setup.o multicalls.o mmu.o \
+obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ time.o xen-asm_$(BITS).o grant-table.o suspend.o
obj-$(CONFIG_SMP) += smp.o spinlock.o
===================================================================
arch/x86/xen/enlighten.c +0 -0
@@ -30,7 +30,6 @@
#include <xen/interface/xen.h>
#include <xen/interface/physdev.h>
#include <xen/interface/vcpu.h>
-#include <xen/interface/sched.h>
#include <xen/features.h>
#include <xen/page.h>
#include <xen/hvc-console.h>
@@ -293,94 +292,6 @@
static unsigned long xen_get_debugreg(int reg)
{
return HYPERVISOR_get_debugreg(reg);-}
-
-static unsigned long xen_save_fl(void)
-{
- struct vcpu_info *vcpu;
- unsigned long flags;
-
- vcpu = x86_read_percpu(xen_vcpu);
-
- /* flag has opposite sense of mask */
- flags = !vcpu->evtchn_upcall_mask;
-
- /* convert to IF type flag
- -0 -> 0x00000000
- -1 -> 0xffffffff
- */
- return (-flags) & X86_EFLAGS_IF;
-}
-
-static void xen_restore_fl(unsigned long flags)
-{
- struct vcpu_info *vcpu;
-
- /* convert from IF type flag */
- flags = !(flags & X86_EFLAGS_IF);
-
- /* There's a one instruction preempt window here. We need to
- make sure we're don't switch CPUs between getting the vcpu
- pointer and updating the mask. */
- preempt_disable();
- vcpu = x86_read_percpu(xen_vcpu);
- vcpu->evtchn_upcall_mask = flags;
- preempt_enable_no_resched();
-
- /* Doesn't matter if we get preempted here, because any
- pending event will get dealt with anyway. */
-
- if (flags == 0) {
- preempt_check_resched();
- barrier(); /* unmask then check (avoid races) */
- if (unlikely(vcpu->evtchn_upcall_pending))
- force_evtchn_callback();
- }
-}
-
-static void xen_irq_disable(void)
-{
- /* There's a one instruction preempt window here. We need to
- make sure we're don't switch CPUs between getting the vcpu
- pointer and updating the mask. */
- preempt_disable();
- x86_read_percpu(xen_vcpu)->evtchn_upcall_mask = 1;
- preempt_enable_no_resched();
-}
-
-static void xen_irq_enable(void)
-{
- struct vcpu_info *vcpu;
-
- /* We don't need to worry about being preempted here, since
- either a) interrupts are disabled, so no preemption, or b) - the caller is confused and is trying to re-enable interrupts - on an indeterminate processor. */
-
- vcpu = x86_read_percpu(xen_vcpu);
- vcpu->evtchn_upcall_mask = 0;
-
- /* Doesn't matter if we get preempted here, because any
- pending event will get dealt with anyway. */
-
- barrier(); /* unmask then check (avoid races) */
- if (unlikely(vcpu->evtchn_upcall_pending))
- force_evtchn_callback();
-}
-
-static void xen_safe_halt(void)
-{
- /* Blocking includes an implicit local_irq_enable(). */
- if (HYPERVISOR_sched_op(SCHEDOP_block, NULL) != 0)
- BUG();
-}
-
-static void xen_halt(void)
-{
- if (irqs_disabled())
- HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
- else
- xen_safe_halt();
}
static void xen_leave_lazy(void)
@@ -1378,36 +1289,6 @@
}, };
-static void __init __xen_init_IRQ(void)
-{
-#ifdef CONFIG_X86_64
- int i;
-
- /* Create identity vector->irq map */
- for(i = 0; i < NR_VECTORS; i++) {
- int cpu;
-
- for_each_possible_cpu(cpu)
- per_cpu(vector_irq, cpu)[i] = i;
- }
-#endif /* CONFIG_X86_64 */
-
- xen_init_IRQ();
-}
-
-static const struct pv_irq_ops xen_irq_ops __initdata = {
- .init_IRQ = __xen_init_IRQ,
- .save_fl = xen_save_fl,
- .restore_fl = xen_restore_fl,
- .irq_disable = xen_irq_disable,
- .irq_enable = xen_irq_enable,
- .safe_halt = xen_safe_halt,
- .halt = xen_halt,
-#ifdef CONFIG_X86_64
- .adjust_exception_frame = xen_adjust_exception_frame,
-#endif
-};
-
static const struct pv_apic_ops xen_apic_ops __initdata = { #ifdef CONFIG_X86_LOCAL_APIC
.setup_boot_clock = paravirt_nop,
@@ -1810,9 +1691,10 @@
pv_init_ops = xen_init_ops; pv_time_ops = xen_time_ops; pv_cpu_ops = xen_cpu_ops; - pv_irq_ops = xen_irq_ops; pv_apic_ops = xen_apic_ops; pv_mmu_ops = xen_mmu_ops;
+
+ xen_init_irq_ops();
#ifdef CONFIG_X86_LOCAL_APIC /*
===================================================================
arch/x86/xen/irq.c new file +143 -0
143 lines not on this page · raw message
===================================================================
arch/x86/xen/xen-asm_32.S +0 -0
@@ -298,7 +298,7 @@
push %eax
push %ecx
push %edx
- call force_evtchn_callback
+ call xen_force_evtchn_callback
pop %edx
pop %ecx
pop %eax
===================================================================
arch/x86/xen/xen-asm_64.S +0 -0
@@ -122,7 +122,7 @@
push %r9 push %r10 push %r11 - call force_evtchn_callback + call xen_force_evtchn_callback pop %r11 pop %r10 pop %r9
===================================================================
arch/x86/xen/xen-ops.h +0 -0
@@ -32,6 +32,7 @@
void __init xen_build_dynamic_phys_to_machine(void);
+void xen_init_irq_ops(void);
void xen_setup_timer(int cpu);
void xen_setup_cpu_clockevents(void);
unsigned long xen_tsc_khz(void);
===================================================================
drivers/xen/events.c +0 -0
@@ -83,17 +83,6 @@
/* Xen will never allocate port zero for any purpose. */
#define VALID_EVTCHN(chn) ((chn) != 0)
-
-/*
- * Force a proper event-channel callback from Xen after clearing the
- * callback mask. We do this in a very simple manner, by making a call
- * down into Xen. The pending flag will be checked by Xen on return.
- */
-void force_evtchn_callback(void)
-{
- (void)HYPERVISOR_xen_version(0, NULL);
-}
-EXPORT_SYMBOL_GPL(force_evtchn_callback);
static struct irq_chip xen_dynamic_chip;
Quoted 9 lines · Jeremy Fitzhardinge
For some reason I managed to miss a bunch of irq-related functions which also need to be compiled without -pg when using ftrace. This patch moves them into their own file, and starts a cleanup process I've been meaning to do anyway.
[ Sam, Ingo: I think the problem was that I enabled
CONFIG_FTRACE
but didn't do a clean build. Shouldn't the build-system notice that the config changes the CFLAGS and rebuild everything? That didn't seem to happen in this case. ]
The build system usually does this.
And I have no reports that this has regressed until now. What file?
Can you tell me how to reproduce it?
Quoted 10 lines
===================================================================
arch/x86/xen/Makefile +0
-0@@ -2,9 +2,10 @@ # Do not profile debug and lowlevel utilitiesCFLAGS_REMOVE_spinlock.o = -pg
CFLAGS_REMOVE_time.o = -pg
+CFLAGS_REMOVE_irq.o = -pg
endif
I already NACK'ed this syntax and described the way it should be done. Is this ignored or on a TODO list?
Sam
Quoted 13 lines · Sam Ravnborg
Quoted 10 lines · Jeremy Fitzhardinge
For some reason I managed to miss a bunch of irq-related functions which also need to be compiled without -pg when using ftrace. This patch moves them into their own file, and starts a cleanup process I've been meaning to do anyway.
[ Sam, Ingo: I think the problem was that I enabled
CONFIG_FTRACE
but didn't do a clean build. Shouldn't the build-system notice that the config changes the CFLAGS and rebuild everything? That didn't seem to happen in this case. ]
Quoted 5 lines
The build system usually does this.
And I have no reports that this has regressed until now. What file?
Can you tell me how to reproduce it?
OK. It was just a suspicion. I'll try to confirm what's really going on.
J
Ingo Molnar
AppliedQuoted 4 lines · Jeremy Fitzhardinge
For some reason I managed to miss a bunch of irq-related functions which also need to be compiled without -pg when using ftrace. This patch moves them into their own file, and starts a cleanup process I've been meaning to do anyway.
applied to tip/x86/xen - thanks Jeremy.
Ingo