Skip to content

Commit

Permalink
Revert "xen/events/fifo: Handle linked events when closing a port"
Browse files Browse the repository at this point in the history
This reverts commit fcdf31a.

This was causing a WARNING whenever a PIRQ was closed since
shutdown_pirq() is called with irqs disabled.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: <stable@vger.kernel.org>
  • Loading branch information
David Vrabel committed Aug 11, 2015
1 parent fc5fee8 commit ad6cd7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 53 deletions.
10 changes: 4 additions & 6 deletions drivers/xen/events/events_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,10 @@ static void xen_free_irq(unsigned irq)
irq_free_desc(irq);
}

static void xen_evtchn_close(unsigned int port, unsigned int cpu)
static void xen_evtchn_close(unsigned int port)
{
struct evtchn_close close;

xen_evtchn_op_close(port, cpu);

close.port = port;
if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
BUG();
Expand Down Expand Up @@ -546,7 +544,7 @@ static unsigned int __startup_pirq(unsigned int irq)

err:
pr_err("irq%d: Failed to set port to irq mapping (%d)\n", irq, rc);
xen_evtchn_close(evtchn, NR_CPUS);
xen_evtchn_close(evtchn);
return 0;
}

Expand All @@ -567,7 +565,7 @@ static void shutdown_pirq(struct irq_data *data)
return;

mask_evtchn(evtchn);
xen_evtchn_close(evtchn, cpu_from_evtchn(evtchn));
xen_evtchn_close(evtchn);
xen_irq_info_cleanup(info);
}

Expand Down Expand Up @@ -611,7 +609,7 @@ static void __unbind_from_irq(unsigned int irq)
if (VALID_EVTCHN(evtchn)) {
unsigned int cpu = cpu_from_irq(irq);

xen_evtchn_close(evtchn, cpu);
xen_evtchn_close(evtchn);

switch (type_from_irq(irq)) {
case IRQT_VIRQ:
Expand Down
45 changes: 5 additions & 40 deletions drivers/xen/events/events_fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,6 @@ static void evtchn_fifo_unmask(unsigned port)
}
}

static bool evtchn_fifo_is_linked(unsigned port)
{
event_word_t *word = event_word_from_port(port);
return sync_test_bit(EVTCHN_FIFO_BIT(LINKED, word), BM(word));
}

static uint32_t clear_linked(volatile event_word_t *word)
{
event_word_t new, old, w;
Expand All @@ -287,8 +281,7 @@ static void handle_irq_for_port(unsigned port)

static void consume_one_event(unsigned cpu,
struct evtchn_fifo_control_block *control_block,
unsigned priority, unsigned long *ready,
bool drop)
unsigned priority, unsigned long *ready)
{
struct evtchn_fifo_queue *q = &per_cpu(cpu_queue, cpu);
uint32_t head;
Expand Down Expand Up @@ -320,15 +313,13 @@ static void consume_one_event(unsigned cpu,
if (head == 0)
clear_bit(priority, ready);

if (evtchn_fifo_is_pending(port) && !evtchn_fifo_is_masked(port)) {
if (likely(!drop))
handle_irq_for_port(port);
}
if (evtchn_fifo_is_pending(port) && !evtchn_fifo_is_masked(port))
handle_irq_for_port(port);

q->head[priority] = head;
}

static void __evtchn_fifo_handle_events(unsigned cpu, bool drop)
static void evtchn_fifo_handle_events(unsigned cpu)
{
struct evtchn_fifo_control_block *control_block;
unsigned long ready;
Expand All @@ -340,16 +331,11 @@ static void __evtchn_fifo_handle_events(unsigned cpu, bool drop)

while (ready) {
q = find_first_bit(&ready, EVTCHN_FIFO_MAX_QUEUES);
consume_one_event(cpu, control_block, q, &ready, drop);
consume_one_event(cpu, control_block, q, &ready);
ready |= xchg(&control_block->ready, 0);
}
}

static void evtchn_fifo_handle_events(unsigned cpu)
{
__evtchn_fifo_handle_events(cpu, false);
}

static void evtchn_fifo_resume(void)
{
unsigned cpu;
Expand Down Expand Up @@ -385,26 +371,6 @@ static void evtchn_fifo_resume(void)
event_array_pages = 0;
}

static void evtchn_fifo_close(unsigned port, unsigned int cpu)
{
if (cpu == NR_CPUS)
return;

get_online_cpus();
if (cpu_online(cpu)) {
if (WARN_ON(irqs_disabled()))
goto out;

while (evtchn_fifo_is_linked(port))
cpu_relax();
} else {
__evtchn_fifo_handle_events(cpu, true);
}

out:
put_online_cpus();
}

static const struct evtchn_ops evtchn_ops_fifo = {
.max_channels = evtchn_fifo_max_channels,
.nr_channels = evtchn_fifo_nr_channels,
Expand All @@ -418,7 +384,6 @@ static const struct evtchn_ops evtchn_ops_fifo = {
.unmask = evtchn_fifo_unmask,
.handle_events = evtchn_fifo_handle_events,
.resume = evtchn_fifo_resume,
.close = evtchn_fifo_close,
};

static int evtchn_fifo_alloc_control_block(unsigned cpu)
Expand Down
7 changes: 0 additions & 7 deletions drivers/xen/events/events_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ struct evtchn_ops {
bool (*test_and_set_mask)(unsigned port);
void (*mask)(unsigned port);
void (*unmask)(unsigned port);
void (*close)(unsigned port, unsigned cpu);

void (*handle_events)(unsigned cpu);
void (*resume)(void);
Expand Down Expand Up @@ -146,12 +145,6 @@ static inline void xen_evtchn_resume(void)
evtchn_ops->resume();
}

static inline void xen_evtchn_op_close(unsigned port, unsigned cpu)
{
if (evtchn_ops->close)
return evtchn_ops->close(port, cpu);
}

void xen_evtchn_2l_init(void);
int xen_evtchn_fifo_init(void);

Expand Down

0 comments on commit ad6cd7b

Please sign in to comment.