Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 175910
b: refs/heads/master
c: c6e22f9
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Oct 29, 2009
1 parent 099dcc5 commit c7389f7
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 108 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f16250669d78a32bdfb27cec4d791e85141e11e2
refs/heads/master: c6e22f9e3e99cc221fe01a0cacf94a9da8a59c31
131 changes: 67 additions & 64 deletions trunk/arch/ia64/xen/irq_xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ xen_free_irq_vector(int vector)
}


static DEFINE_PER_CPU(int, timer_irq) = -1;
static DEFINE_PER_CPU(int, ipi_irq) = -1;
static DEFINE_PER_CPU(int, resched_irq) = -1;
static DEFINE_PER_CPU(int, cmc_irq) = -1;
static DEFINE_PER_CPU(int, cmcp_irq) = -1;
static DEFINE_PER_CPU(int, cpep_irq) = -1;
static DEFINE_PER_CPU(int, xen_timer_irq) = -1;
static DEFINE_PER_CPU(int, xen_ipi_irq) = -1;
static DEFINE_PER_CPU(int, xen_resched_irq) = -1;
static DEFINE_PER_CPU(int, xen_cmc_irq) = -1;
static DEFINE_PER_CPU(int, xen_cmcp_irq) = -1;
static DEFINE_PER_CPU(int, xen_cpep_irq) = -1;
#define NAME_SIZE 15
static DEFINE_PER_CPU(char[NAME_SIZE], timer_name);
static DEFINE_PER_CPU(char[NAME_SIZE], ipi_name);
static DEFINE_PER_CPU(char[NAME_SIZE], resched_name);
static DEFINE_PER_CPU(char[NAME_SIZE], cmc_name);
static DEFINE_PER_CPU(char[NAME_SIZE], cmcp_name);
static DEFINE_PER_CPU(char[NAME_SIZE], cpep_name);
static DEFINE_PER_CPU(char[NAME_SIZE], xen_timer_name);
static DEFINE_PER_CPU(char[NAME_SIZE], xen_ipi_name);
static DEFINE_PER_CPU(char[NAME_SIZE], xen_resched_name);
static DEFINE_PER_CPU(char[NAME_SIZE], xen_cmc_name);
static DEFINE_PER_CPU(char[NAME_SIZE], xen_cmcp_name);
static DEFINE_PER_CPU(char[NAME_SIZE], xen_cpep_name);
#undef NAME_SIZE

struct saved_irq {
Expand Down Expand Up @@ -144,64 +144,64 @@ __xen_register_percpu_irq(unsigned int cpu, unsigned int vec,
if (xen_slab_ready) {
switch (vec) {
case IA64_TIMER_VECTOR:
snprintf(per_cpu(timer_name, cpu),
sizeof(per_cpu(timer_name, cpu)),
snprintf(per_cpu(xen_timer_name, cpu),
sizeof(per_cpu(xen_timer_name, cpu)),
"%s%d", action->name, cpu);
irq = bind_virq_to_irqhandler(VIRQ_ITC, cpu,
action->handler, action->flags,
per_cpu(timer_name, cpu), action->dev_id);
per_cpu(timer_irq, cpu) = irq;
per_cpu(xen_timer_name, cpu), action->dev_id);
per_cpu(xen_timer_irq, cpu) = irq;
break;
case IA64_IPI_RESCHEDULE:
snprintf(per_cpu(resched_name, cpu),
sizeof(per_cpu(resched_name, cpu)),
snprintf(per_cpu(xen_resched_name, cpu),
sizeof(per_cpu(xen_resched_name, cpu)),
"%s%d", action->name, cpu);
irq = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu,
action->handler, action->flags,
per_cpu(resched_name, cpu), action->dev_id);
per_cpu(resched_irq, cpu) = irq;
per_cpu(xen_resched_name, cpu), action->dev_id);
per_cpu(xen_resched_irq, cpu) = irq;
break;
case IA64_IPI_VECTOR:
snprintf(per_cpu(ipi_name, cpu),
sizeof(per_cpu(ipi_name, cpu)),
snprintf(per_cpu(xen_ipi_name, cpu),
sizeof(per_cpu(xen_ipi_name, cpu)),
"%s%d", action->name, cpu);
irq = bind_ipi_to_irqhandler(XEN_IPI_VECTOR, cpu,
action->handler, action->flags,
per_cpu(ipi_name, cpu), action->dev_id);
per_cpu(ipi_irq, cpu) = irq;
per_cpu(xen_ipi_name, cpu), action->dev_id);
per_cpu(xen_ipi_irq, cpu) = irq;
break;
case IA64_CMC_VECTOR:
snprintf(per_cpu(cmc_name, cpu),
sizeof(per_cpu(cmc_name, cpu)),
snprintf(per_cpu(xen_cmc_name, cpu),
sizeof(per_cpu(xen_cmc_name, cpu)),
"%s%d", action->name, cpu);
irq = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu,
action->handler,
action->flags,
per_cpu(cmc_name, cpu),
action->dev_id);
per_cpu(cmc_irq, cpu) = irq;
action->handler,
action->flags,
per_cpu(xen_cmc_name, cpu),
action->dev_id);
per_cpu(xen_cmc_irq, cpu) = irq;
break;
case IA64_CMCP_VECTOR:
snprintf(per_cpu(cmcp_name, cpu),
sizeof(per_cpu(cmcp_name, cpu)),
snprintf(per_cpu(xen_cmcp_name, cpu),
sizeof(per_cpu(xen_cmcp_name, cpu)),
"%s%d", action->name, cpu);
irq = bind_ipi_to_irqhandler(XEN_CMCP_VECTOR, cpu,
action->handler,
action->flags,
per_cpu(cmcp_name, cpu),
action->dev_id);
per_cpu(cmcp_irq, cpu) = irq;
action->handler,
action->flags,
per_cpu(xen_cmcp_name, cpu),
action->dev_id);
per_cpu(xen_cmcp_irq, cpu) = irq;
break;
case IA64_CPEP_VECTOR:
snprintf(per_cpu(cpep_name, cpu),
sizeof(per_cpu(cpep_name, cpu)),
snprintf(per_cpu(xen_cpep_name, cpu),
sizeof(per_cpu(xen_cpep_name, cpu)),
"%s%d", action->name, cpu);
irq = bind_ipi_to_irqhandler(XEN_CPEP_VECTOR, cpu,
action->handler,
action->flags,
per_cpu(cpep_name, cpu),
action->dev_id);
per_cpu(cpep_irq, cpu) = irq;
action->handler,
action->flags,
per_cpu(xen_cpep_name, cpu),
action->dev_id);
per_cpu(xen_cpep_irq, cpu) = irq;
break;
case IA64_CPE_VECTOR:
case IA64_MCA_RENDEZ_VECTOR:
Expand Down Expand Up @@ -275,30 +275,33 @@ unbind_evtchn_callback(struct notifier_block *nfb,

if (action == CPU_DEAD) {
/* Unregister evtchn. */
if (per_cpu(cpep_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(cpep_irq, cpu), NULL);
per_cpu(cpep_irq, cpu) = -1;
if (per_cpu(xen_cpep_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(xen_cpep_irq, cpu),
NULL);
per_cpu(xen_cpep_irq, cpu) = -1;
}
if (per_cpu(cmcp_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(cmcp_irq, cpu), NULL);
per_cpu(cmcp_irq, cpu) = -1;
if (per_cpu(xen_cmcp_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(xen_cmcp_irq, cpu),
NULL);
per_cpu(xen_cmcp_irq, cpu) = -1;
}
if (per_cpu(cmc_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(cmc_irq, cpu), NULL);
per_cpu(cmc_irq, cpu) = -1;
if (per_cpu(xen_cmc_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(xen_cmc_irq, cpu), NULL);
per_cpu(xen_cmc_irq, cpu) = -1;
}
if (per_cpu(ipi_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(ipi_irq, cpu), NULL);
per_cpu(ipi_irq, cpu) = -1;
if (per_cpu(xen_ipi_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(xen_ipi_irq, cpu), NULL);
per_cpu(xen_ipi_irq, cpu) = -1;
}
if (per_cpu(resched_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(resched_irq, cpu),
NULL);
per_cpu(resched_irq, cpu) = -1;
if (per_cpu(xen_resched_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu),
NULL);
per_cpu(xen_resched_irq, cpu) = -1;
}
if (per_cpu(timer_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL);
per_cpu(timer_irq, cpu) = -1;
if (per_cpu(xen_timer_irq, cpu) >= 0) {
unbind_from_irqhandler(per_cpu(xen_timer_irq, cpu),
NULL);
per_cpu(xen_timer_irq, cpu) = -1;
}
}
return NOTIFY_OK;
Expand Down
22 changes: 11 additions & 11 deletions trunk/arch/ia64/xen/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@

#include "../kernel/fsyscall_gtod_data.h"

DEFINE_PER_CPU(struct vcpu_runstate_info, runstate);
DEFINE_PER_CPU(unsigned long, processed_stolen_time);
DEFINE_PER_CPU(unsigned long, processed_blocked_time);
static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
static DEFINE_PER_CPU(unsigned long, xen_stolen_time);
static DEFINE_PER_CPU(unsigned long, xen_blocked_time);

/* taken from i386/kernel/time-xen.c */
static void xen_init_missing_ticks_accounting(int cpu)
{
struct vcpu_register_runstate_memory_area area;
struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
struct vcpu_runstate_info *runstate = &per_cpu(xen_runstate, cpu);
int rc;

memset(runstate, 0, sizeof(*runstate));
Expand All @@ -52,8 +52,8 @@ static void xen_init_missing_ticks_accounting(int cpu)
&area);
WARN_ON(rc && rc != -ENOSYS);

per_cpu(processed_blocked_time, cpu) = runstate->time[RUNSTATE_blocked];
per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
per_cpu(xen_blocked_time, cpu) = runstate->time[RUNSTATE_blocked];
per_cpu(xen_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
+ runstate->time[RUNSTATE_offline];
}

Expand All @@ -68,7 +68,7 @@ static void get_runstate_snapshot(struct vcpu_runstate_info *res)

BUG_ON(preemptible());

state = &__get_cpu_var(runstate);
state = &__get_cpu_var(xen_runstate);

/*
* The runstate info is always updated by the hypervisor on
Expand Down Expand Up @@ -103,12 +103,12 @@ consider_steal_time(unsigned long new_itm)
* This function just checks and reject this effect.
*/
if (!time_after_eq(runstate.time[RUNSTATE_blocked],
per_cpu(processed_blocked_time, cpu)))
per_cpu(xen_blocked_time, cpu)))
blocked = 0;

if (!time_after_eq(runstate.time[RUNSTATE_runnable] +
runstate.time[RUNSTATE_offline],
per_cpu(processed_stolen_time, cpu)))
per_cpu(xen_stolen_time, cpu)))
stolen = 0;

if (!time_after(delta_itm + new_itm, ia64_get_itc()))
Expand Down Expand Up @@ -147,8 +147,8 @@ consider_steal_time(unsigned long new_itm)
} else {
local_cpu_data->itm_next = delta_itm + new_itm;
}
per_cpu(processed_stolen_time, cpu) += NS_PER_TICK * stolen;
per_cpu(processed_blocked_time, cpu) += NS_PER_TICK * blocked;
per_cpu(xen_stolen_time, cpu) += NS_PER_TICK * stolen;
per_cpu(xen_blocked_time, cpu) += NS_PER_TICK * blocked;
}
return delta_itm;
}
Expand Down
41 changes: 21 additions & 20 deletions trunk/arch/x86/xen/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@

cpumask_var_t xen_cpu_initialized_map;

static DEFINE_PER_CPU(int, resched_irq);
static DEFINE_PER_CPU(int, callfunc_irq);
static DEFINE_PER_CPU(int, callfuncsingle_irq);
static DEFINE_PER_CPU(int, debug_irq) = -1;
static DEFINE_PER_CPU(int, xen_resched_irq);
static DEFINE_PER_CPU(int, xen_callfunc_irq);
static DEFINE_PER_CPU(int, xen_callfuncsingle_irq);
static DEFINE_PER_CPU(int, xen_debug_irq) = -1;

static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
Expand Down Expand Up @@ -103,7 +103,7 @@ static int xen_smp_intr_init(unsigned int cpu)
NULL);
if (rc < 0)
goto fail;
per_cpu(resched_irq, cpu) = rc;
per_cpu(xen_resched_irq, cpu) = rc;

callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu);
rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR,
Expand All @@ -114,15 +114,15 @@ static int xen_smp_intr_init(unsigned int cpu)
NULL);
if (rc < 0)
goto fail;
per_cpu(callfunc_irq, cpu) = rc;
per_cpu(xen_callfunc_irq, cpu) = rc;

debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
IRQF_DISABLED | IRQF_PERCPU | IRQF_NOBALANCING,
debug_name, NULL);
if (rc < 0)
goto fail;
per_cpu(debug_irq, cpu) = rc;
per_cpu(xen_debug_irq, cpu) = rc;

callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
Expand All @@ -133,19 +133,20 @@ static int xen_smp_intr_init(unsigned int cpu)
NULL);
if (rc < 0)
goto fail;
per_cpu(callfuncsingle_irq, cpu) = rc;
per_cpu(xen_callfuncsingle_irq, cpu) = rc;

return 0;

fail:
if (per_cpu(resched_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL);
if (per_cpu(callfunc_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL);
if (per_cpu(debug_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL);
if (per_cpu(callfuncsingle_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL);
if (per_cpu(xen_resched_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
if (per_cpu(xen_callfunc_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
if (per_cpu(xen_debug_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
NULL);

return rc;
}
Expand Down Expand Up @@ -348,10 +349,10 @@ static void xen_cpu_die(unsigned int cpu)
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(HZ/10);
}
unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
xen_uninit_lock_cpu(cpu);
xen_teardown_timer(cpu);

Expand Down
Loading

0 comments on commit c7389f7

Please sign in to comment.