evtchn: arrange for preemption in evtchn_reset()
authorJan Beulich <jbeulich@suse.com>
Tue, 22 Sep 2020 13:53:10 +0000 (15:53 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 22 Sep 2020 13:53:10 +0000 (15:53 +0200)
commit2785b2a9e04abc148e1c5259f4faee708ea356f4
tree307bf486d576632b219069744542b272a0890e45
parent8fe7b5f9960f4d9ec46787af394d180c39c6b2db
evtchn: arrange for preemption in evtchn_reset()

Like for evtchn_destroy() looping over all possible event channels to
close them can take a significant amount of time. Unlike done there, we
can't alter domain properties (i.e. d->valid_evtchns) here. Borrow, in a
lightweight form, the paging domctl continuation concept, redirecting
the continuations to different sub-ops. Just like there this is to be
able to allow for predictable overall results of the involved sub-ops:
Racing requests should either complete or be refused.

Note that a domain can't interfere with an already started (by a remote
domain) reset, due to being paused. It can prevent a remote reset from
happening by leaving a reset unfinished, but that's only going to affect
itself.

This is part of XSA-344.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/domain.c
xen/common/domctl.c
xen/common/event_channel.c
xen/include/public/domctl.h
xen/include/public/event_channel.h
xen/include/xen/event.h
xen/include/xen/sched.h