Patch "xen/events/fifo: Handle linked events when closing a port" has been added to the 4.1-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
xen/events/fifo: Handle linked events when closing a port
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xen-events-fifo-handle-linked-events-when-closing-a-port.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
fcdf31a7c162de0c93a2bee51df4688ab0a348f8Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <[email protected]>
Date: Fri, 31 Jul 2015 14:30:42 +0100
Subject: xen/events/fifo: Handle linked events when closing a port
From: Ross Lagerwall <[email protected]>
commit fcdf31a7c162de0c93a2bee51df4688ab0a348f8 upstream.
An event channel bound to a CPU that was offlined may still be linked on that CPU's queue. If this event channel is closed and reused, subsequent events will be lost because the event channel is never unlinked and thus cannot be linked onto the correct queue.
When a channel is closed and the event is still linked into a queue, ensure that it is unlinked before completing.
If the CPU to which the event channel bound is online, spin until the event is handled by that CPU. If that CPU is offline, it can't handle the event, so clear the event queue during the close, dropping the events.
This fixes the missing interrupts (and subsequent disk stalls etc.) when offlining a CPU.
--- drivers/xen/events/events_base.c | 10 ++++--- drivers/xen/events/events_fifo.c | 45 +++++++++++++++++++++++++++++++---- drivers/xen/events/events_internal.h | 7 +++++ 3 files changed, 53 insertions(+), 9 deletions(-)
drivers/xen/events/events_base.c +6 -4
@@ -452,10 +452,12 @@ static void xen_free_irq(unsigned irq)irq_free_desc (irq); } -static void xen_evtchn_close (unsigned int port) +static void xen_evtchn_close (unsigned int port,unsigned int cpu) {struct evtchn_close close; +xen_evtchn_op_close (port, cpu); + close.port = port;if (HYPERVISOR_event_channel_op (EVTCHNOP_close, &close) !=0 )BUG ();
@@ -544,7 +546,7 @@ out: err:pr_err ("irq%d: Failed to set port to irq mapping (%d)\n" , irq, rc); -xen_evtchn_close (evtchn); +xen_evtchn_close (evtchn,NR_CPUS );return 0 ; }
@@ -565,7 +567,7 @@ static void shutdown_pirq(struct irq_datreturn ;mask_evtchn (evtchn); -xen_evtchn_close (evtchn); +xen_evtchn_close (evtchn,cpu_from_evtchn (evtchn));xen_irq_info_cleanup (info); }
@@ -609,7 +611,7 @@ static void __unbind_from_irq(unsigned iif (VALID_EVTCHN (evtchn)) {unsigned int cpu =cpu_from_irq (irq); -xen_evtchn_close (evtchn); +xen_evtchn_close (evtchn, cpu);switch (type_from_irq (irq)) {case IRQT_VIRQ :
drivers/xen/events/events_fifo.c +40 -5
89 lines not on this page · raw message
drivers/xen/events/events_internal.h +7 -0
@@ -68,6 +68,7 @@ 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 );
@@ -145,6 +146,12 @@ static inline void xen_evtchn_resume(voi 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 );
Patches currently in stable-queue which might be from [email protected] are
queue-4.1/xen-events-fifo-handle-linked-events-when-closing-a-port.patch
David Vrabel
AppliedThe commit causes WARNING spam and has been reverted. Please don't backport.
David
________________________________________
From: [email protected] [[email protected]]
Sent: 14 August 2015 01:44
To: Ross Lagerwall; David Vrabel; [email protected]
Cc: [email protected]; [email protected]
Subject: Patch "xen/events/fifo: Handle linked events when closing a port" has been added to the 4.1-stable tree
This is a note to let you know that I've just added the patch titled
xen/events/fifo: Handle linked events when closing a port
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xen-events-fifo-handle-linked-events-when-closing-a-port.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
fcdf31a7c162de0c93a2bee51df4688ab0a348f8Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <[email protected]>
Date: Fri, 31 Jul 2015 14:30:42 +0100
Subject: xen/events/fifo: Handle linked events when closing a port
From: Ross Lagerwall <[email protected]>
commit fcdf31a7c162de0c93a2bee51df4688ab0a348f8 upstream.
An event channel bound to a CPU that was offlined may still be linked on that CPU's queue. If this event channel is closed and reused, subsequent events will be lost because the event channel is never unlinked and thus cannot be linked onto the correct queue.
When a channel is closed and the event is still linked into a queue, ensure that it is unlinked before completing.
If the CPU to which the event channel bound is online, spin until the event is handled by that CPU. If that CPU is offline, it can't handle the event, so clear the event queue during the close, dropping the events.
This fixes the missing interrupts (and subsequent disk stalls etc.) when offlining a CPU.
--- drivers/xen/events/events_base.c | 10 ++++--- drivers/xen/events/events_fifo.c | 45 +++++++++++++++++++++++++++++++---- drivers/xen/events/events_internal.h | 7 +++++ 3 files changed, 53 insertions(+), 9 deletions(-)
drivers/xen/events/events_base.c +6 -4
@@ -452,10 +452,12 @@ static void xen_free_irq(unsigned irq)irq_free_desc (irq); } -static void xen_evtchn_close (unsigned int port) +static void xen_evtchn_close (unsigned int port,unsigned int cpu) {struct evtchn_close close; +xen_evtchn_op_close (port, cpu); + close.port = port;if (HYPERVISOR_event_channel_op (EVTCHNOP_close, &close) !=0 )BUG ();
@@ -544,7 +546,7 @@ out: err:pr_err ("irq%d: Failed to set port to irq mapping (%d)\n" , irq, rc); -xen_evtchn_close (evtchn); +xen_evtchn_close (evtchn,NR_CPUS );return 0 ; }
@@ -565,7 +567,7 @@ static void shutdown_pirq(struct irq_datreturn ;mask_evtchn (evtchn); -xen_evtchn_close (evtchn); +xen_evtchn_close (evtchn,cpu_from_evtchn (evtchn));xen_irq_info_cleanup (info); }
@@ -609,7 +611,7 @@ static void __unbind_from_irq(unsigned iif (VALID_EVTCHN (evtchn)) {unsigned int cpu =cpu_from_irq (irq); -xen_evtchn_close (evtchn); +xen_evtchn_close (evtchn, cpu);switch (type_from_irq (irq)) {case IRQT_VIRQ :
drivers/xen/events/events_fifo.c +40 -5
89 lines not on this page · raw message
drivers/xen/events/events_internal.h +7 -0
@@ -68,6 +68,7 @@ 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 );
@@ -145,6 +146,12 @@ static inline void xen_evtchn_resume(voi 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 );
Patches currently in stable-queue which might be from [email protected] are
queue-4.1/xen-events-fifo-handle-linked-events-when-closing-a-port.patch
[email protected]
maintainerQuoted 1 line · David Vrabel
The commit causes WARNING spam and has been reverted. Please don't backport.
Thanks for letting me know, now removed.
greg k-h