xen/events: access last_priority and last_vcpu_id together
authorJuergen Gross <jgross@suse.com>
Tue, 24 Nov 2020 10:23:42 +0000 (11:23 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Nov 2020 10:23:42 +0000 (11:23 +0100)
commit1277cb9dc5e966f1faf665bcded02b7533e38078
treef75689e0bf5c6e8e79a6efd5fa98945931cac742
parentb659a5cebd611dbe698e63c03485b5fe8cd964ad
xen/events: access last_priority and last_vcpu_id together

The queue for a fifo event is depending on the vcpu_id and the
priority of the event. When sending an event it might happen the
event needs to change queues and the old queue needs to be kept for
keeping the links between queue elements intact. For this purpose
the event channel contains last_priority and last_vcpu_id values
elements for being able to identify the old queue.

In order to avoid races always access last_priority and last_vcpu_id
with a single atomic operation avoiding any inconsistencies.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/common/event_fifo.c
xen/include/xen/sched.h