Skip to content

Commit

Permalink
[S390] Switch etr from tasklet to workqueue.
Browse files Browse the repository at this point in the history
The clock synchronization of the ETR code requires an smp_call_function
to synchronize all cpus. Calling smp_call_function from a tasklet is
illegal. Replace the tasklet with a job on the global workqueue.
ETR work is rare and can be postponed to a be done by a kernel thread.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Martin Schwidefsky committed Apr 27, 2007
1 parent 6c21048 commit ecdcc02
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions arch/s390/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ static void clock_comparator_interrupt(__u16 code)
}

static void etr_reset(void);
static void etr_init(void);
static void etr_ext_handler(__u16);

/*
Expand Down Expand Up @@ -355,7 +354,6 @@ void __init time_init(void)
#ifdef CONFIG_VIRT_TIMER
vtime_init();
#endif
etr_init();
}

/*
Expand Down Expand Up @@ -426,11 +424,11 @@ static struct etr_aib etr_port1;
static int etr_port1_uptodate;
static unsigned long etr_events;
static struct timer_list etr_timer;
static struct tasklet_struct etr_tasklet;
static DEFINE_PER_CPU(atomic_t, etr_sync_word);

static void etr_timeout(unsigned long dummy);
static void etr_tasklet_fn(unsigned long dummy);
static void etr_work_fn(struct work_struct *work);
static DECLARE_WORK(etr_work, etr_work_fn);

/*
* The etr get_clock function. It will write the current clock value
Expand Down Expand Up @@ -507,29 +505,31 @@ static void etr_reset(void)
}
}

static void etr_init(void)
static int __init etr_init(void)
{
struct etr_aib aib;

if (test_bit(ETR_FLAG_ENOSYS, &etr_flags))
return;
return 0;
/* Check if this machine has the steai instruction. */
if (etr_steai(&aib, ETR_STEAI_STEPPING_PORT) == 0)
set_bit(ETR_FLAG_STEAI, &etr_flags);
setup_timer(&etr_timer, etr_timeout, 0UL);
tasklet_init(&etr_tasklet, etr_tasklet_fn, 0);
if (!etr_port0_online && !etr_port1_online)
set_bit(ETR_FLAG_EACCES, &etr_flags);
if (etr_port0_online) {
set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}
if (etr_port1_online) {
set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}
return 0;
}

arch_initcall(etr_init);

/*
* Two sorts of ETR machine checks. The architecture reads:
* "When a machine-check niterruption occurs and if a switch-to-local or
Expand All @@ -549,7 +549,7 @@ void etr_switch_to_local(void)
return;
etr_disable_sync_clock(NULL);
set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}

/*
Expand All @@ -564,7 +564,7 @@ void etr_sync_check(void)
return;
etr_disable_sync_clock(NULL);
set_bit(ETR_EVENT_SYNC_CHECK, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}

/*
Expand All @@ -591,13 +591,13 @@ static void etr_ext_handler(__u16 code)
* Both ports are not up-to-date now.
*/
set_bit(ETR_EVENT_PORT_ALERT, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}

static void etr_timeout(unsigned long dummy)
{
set_bit(ETR_EVENT_UPDATE, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}

/*
Expand Down Expand Up @@ -927,7 +927,7 @@ static struct etr_eacr etr_handle_update(struct etr_aib *aib,
if (!eacr.e0 && !eacr.e1)
return eacr;

/* Update port0 or port1 with aib stored in etr_tasklet_fn. */
/* Update port0 or port1 with aib stored in etr_work_fn. */
if (aib->esw.q == 0) {
/* Information for port 0 stored. */
if (eacr.p0 && !etr_port0_uptodate) {
Expand Down Expand Up @@ -1007,7 +1007,7 @@ static void etr_update_eacr(struct etr_eacr eacr)
* particular this is the only function that calls etr_update_eacr(),
* it "controls" the etr control register.
*/
static void etr_tasklet_fn(unsigned long dummy)
static void etr_work_fn(struct work_struct *work)
{
unsigned long long now;
struct etr_eacr eacr;
Expand Down Expand Up @@ -1220,13 +1220,13 @@ static ssize_t etr_online_store(struct sys_device *dev,
return count; /* Nothing to do. */
etr_port0_online = value;
set_bit(ETR_EVENT_PORT0_CHANGE, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
} else {
if (etr_port1_online == value)
return count; /* Nothing to do. */
etr_port1_online = value;
set_bit(ETR_EVENT_PORT1_CHANGE, &etr_events);
tasklet_hi_schedule(&etr_tasklet);
schedule_work(&etr_work);
}
return count;
}
Expand Down

0 comments on commit ecdcc02

Please sign in to comment.