evtchn: convert domain event lock to an r/w one
authorJan Beulich <jbeulich@suse.com>
Wed, 3 Aug 2022 10:10:26 +0000 (12:10 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 3 Aug 2022 10:10:26 +0000 (12:10 +0200)
commit9875c69c4b7decf0c1d2bc493e590ade2880fa5e
tree2ebca11a71e892f1ba521f28e2ba301014f004d8
parent800f21499e0ec112771ce1e94490ca5811578bc2
evtchn: convert domain event lock to an r/w one

Especially for the use in evtchn_move_pirqs() (called when moving a vCPU
across pCPU-s) and the ones in EOI handling in PCI pass-through code,
serializing perhaps an entire domain isn't helpful when no state (which
isn't e.g. further protected by the per-channel lock) changes.

Unfortunately this implies dropping of lock profiling for this lock,
until r/w locks may get enabled for such functionality.

While ->notify_vcpu_id is now meant to be consistently updated with the
per-channel lock held, an extension applies to ECS_PIRQ: The field is
also guaranteed to not change with the per-domain event lock held for
writing. Therefore the link_pirq_port() call from evtchn_bind_pirq()
could in principle be moved out of the per-channel locked regions, but
this further code churn didn't seem worth it.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
15 files changed:
xen/arch/x86/domain.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/irq.c
xen/arch/x86/hvm/vioapic.c
xen/arch/x86/hvm/vmsi.c
xen/arch/x86/io_apic.c
xen/arch/x86/irq.c
xen/arch/x86/physdev.c
xen/arch/x86/pv/shim.c
xen/common/event_channel.c
xen/common/event_fifo.c
xen/drivers/passthrough/vtd/x86/hvm.c
xen/drivers/passthrough/x86/hvm.c
xen/include/xen/sched.h
xen/xsm/flask/flask_op.c