]> xenbits.xensource.com Git - xen.git/commit
xen/evtchn: Make sure all buckets below d->valid_evtchns are allocated
authorJulien Grall <jgrall@amazon.com>
Wed, 7 Sep 2022 16:27:32 +0000 (17:27 +0100)
committerJulien Grall <jgrall@amazon.com>
Thu, 8 Sep 2022 11:21:58 +0000 (12:21 +0100)
commit5d1cfe844e23cb1610ef07f60bc8076e058891d6
tree9e80b95ccb4e1b53e6605d8c8d0e90929bdd1079
parent64e302157a87b246473a31fa104377a6d48eb046
xen/evtchn: Make sure all buckets below d->valid_evtchns are allocated

Since commit 01280dc19cf3 "evtchn: simplify port_is_valid()", the event
channels code assumes that all the buckets below d->valid_evtchns are
always allocated.

This assumption hold in most of the situation because a guest is not
allowed to chose the port. Instead, it will be the first free from port
0.

When static event channel support will be added for dom0less domains
user can request to allocate the evtchn port numbers that are scattered
in nature.

The existing implementation of evtchn_allocate_port() is not able to
deal with such situation and will end up to override bucket or/and leave
some bucket unallocated. The latter will result to a droplet crash if
the event channel belongs to an unallocated bucket.

This can be solved by making sure that all the buckets below
d->valid_evtchns are allocated. There should be no impact for most of
the situation but LM/LU as only one bucket would be allocated. For
LM/LU, we may end up to allocate multiple buckets if ports in use are
sparse.

A potential alternative is to check that the bucket is valid in
is_port_valid(). This should still possible to do it without taking
per-domain lock but will result a couple more of memory access.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Rahul Singh <rahul.singh@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/event_channel.c