diff options
author | Juergen Gross <jgross@suse.com> | 2020-09-07 15:47:30 +0200 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2020-10-20 10:22:16 +0200 |
commit | e99502f76271d6bc4e374fe368c50c67a1fd3070 (patch) | |
tree | aadec8f665acbf22be002d42269ea26a9f01bea6 /drivers/xen/events/events_2l.c | |
parent | 7beb290caa2adb0a399e735a1e175db9aae0523a (diff) | |
download | lwn-e99502f76271d6bc4e374fe368c50c67a1fd3070.tar.gz lwn-e99502f76271d6bc4e374fe368c50c67a1fd3070.zip |
xen/events: defer eoi in case of excessive number of events
In case rogue guests are sending events at high frequency it might
happen that xen_evtchn_do_upcall() won't stop processing events in
dom0. As this is done in irq handling a crash might be the result.
In order to avoid that, delay further inter-domain events after some
time in xen_evtchn_do_upcall() by forcing eoi processing into a
worker on the same cpu, thus inhibiting new events coming in.
The time after which eoi processing is to be delayed is configurable
via a new module parameter "event_loop_timeout" which specifies the
maximum event loop time in jiffies (default: 2, the value was chosen
after some tests showing that a value of 2 was the lowest with an
only slight drop of dom0 network throughput while multiple guests
performed an event storm).
How long eoi processing will be delayed can be specified via another
parameter "event_eoi_delay" (again in jiffies, default 10, again the
value was chosen after testing with different delay values).
This is part of XSA-332.
Cc: stable@vger.kernel.org
Reported-by: Julien Grall <julien@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Wei Liu <wl@xen.org>
Diffstat (limited to 'drivers/xen/events/events_2l.c')
-rw-r--r-- | drivers/xen/events/events_2l.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c index e1af5e093ff4..fe5ad0e89cd8 100644 --- a/drivers/xen/events/events_2l.c +++ b/drivers/xen/events/events_2l.c @@ -161,7 +161,7 @@ static inline xen_ulong_t active_evtchns(unsigned int cpu, * a bitset of words which contain pending event bits. The second * level is a bitset of pending events themselves. */ -static void evtchn_2l_handle_events(unsigned cpu) +static void evtchn_2l_handle_events(unsigned cpu, struct evtchn_loop_ctrl *ctrl) { int irq; xen_ulong_t pending_words; @@ -242,10 +242,7 @@ static void evtchn_2l_handle_events(unsigned cpu) /* Process port. */ port = (word_idx * BITS_PER_EVTCHN_WORD) + bit_idx; - irq = get_evtchn_to_irq(port); - - if (irq != -1) - generic_handle_irq(irq); + handle_irq_for_port(port, ctrl); bit_idx = (bit_idx + 1) % BITS_PER_EVTCHN_WORD; |